compute: accept VCC and EXEC as sources in 64-bit scalar comparisons #3414

Manually merged
github merged 2 commits from github-bot/gh-3412 into main 2026-11-29 08:45:42 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-28 23:24 UTC · original
Ammmae0x:compute/salu-cmp64-vcc-exec → main · +335 −7 · 5 files · 2 commits · merged 2026-11-29 08:43 UTC

Refs #3226, #2935

The direct C++ compute handler for the four 64-bit SOPC instructions refused VCC (106) and EXEC (126) as 64-bit sources. scalar64 now reads them through operand32 / pair_high like any aligned SGPR pair, so VCC and EXEC work as the S0 pair (and as the S1 pair for s_cmp_eq_u64 / s_cmp_lg_u64). M0 (124) and odd SGPRs are still refused as 64-bit sources (via pair_high), and VCC / EXEC / M0 are still refused as the s_bitcmp*_b64 bit index.

Fix: the refusal programs now prime M0 with s_mov_b32 m0, 0 (and s[22:25] in the new test) so require_numeric does not refuse unbound M0 before pair_high runs; native_compute_ir_dump added to the WIN-VERIFY targets so native_salu_cmp64_ir is built.

  • src/gfx1013_direct_compute.inl: drop the VCC/EXEC refusal in scalar64.
  • tests/native_salu_cmp64_check.py: the two obsolete VCC/EXEC refusal controls now use M0 (124) with the existing "unsupported wave64 scalar pair" error; the VCC bit-index refusal is unchanged.
  • tests/native_salu_cmp64_vcc_exec_check.py + tests/cmake/native_salu_cmp64_vcc_exec.cmake: new controls/hardware tests (wave64 and wave32, all four ops from both sources, including VCC vs EXEC, EXEC vs literal, high-word / cross-word bit indices >= 32, wrapped indices 65 and 96, 8 negative controls, 6 reference mutants).
  • docs/experiments/native-direct-salu-cmp64.md: document the accepted VCC/EXEC sources.

Linux checks (this host, no Windows/DXC):

  • /tmp/pe-env/bin/python -B tests/form_coverage_check.py: passed
  • /tmp/pe-env/bin/python -B tests/docs_links_check.py: passed (160 files, 682 links)
  • /tmp/pe-env/bin/python -B tests/bidi_controls_check.py: passed (2582 files)
  • py_compile on touched Python files: passed
  • Offline harness v2 (19 cases, oracle + 6 mutants + instruction decoding + refused-program priming check): passed; 6/6 spot-mutations on /tmp copies failed as expected.

Windows verification (compile_dxil, native CTest) still pending.

Windows Verification (667145e8)

Commit: 667145e8a83ba9daa506995d06fa4e6db1fa40ac (Windows 11 build 26100.7623)
Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (D3D12 debug layer not enabled by native_store_replay)
dev:
  cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump
  $env:XBOX2WINDOWS_ADAPTER='NVIDIA'; ctest --preset dev --no-tests=error -R '^(native_salu_cmp64_vcc_exec_|native_salu_cmp64_)' --output-on-failure
  -> 5/5 passed, 0 failed, 0 skipped (15.89s; both _hardware suites passed on RTX 4050)
Repo checks: form_coverage_check, docs_links_check, bidi_controls_check -> 3/3 passed
AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-11-28 23:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3412) `Ammmae0x:compute/salu-cmp64-vcc-exec` → `main` · +335 −7 · 5 files · 2 commits · merged 2026-11-29 08:43 UTC Refs #3226, #2935 The direct C++ compute handler for the four 64-bit SOPC instructions refused VCC (106) and EXEC (126) as 64-bit sources. `scalar64` now reads them through `operand32` / `pair_high` like any aligned SGPR pair, so VCC and EXEC work as the `S0` pair (and as the `S1` pair for `s_cmp_eq_u64` / `s_cmp_lg_u64`). `M0` (124) and odd SGPRs are still refused as 64-bit sources (via `pair_high`), and VCC / EXEC / M0 are still refused as the `s_bitcmp*_b64` bit index. Fix: the refusal programs now prime M0 with `s_mov_b32 m0, 0` (and `s[22:25]` in the new test) so `require_numeric` does not refuse unbound M0 before `pair_high` runs; `native_compute_ir_dump` added to the WIN-VERIFY targets so `native_salu_cmp64_ir` is built. - `src/gfx1013_direct_compute.inl`: drop the VCC/EXEC refusal in `scalar64`. - `tests/native_salu_cmp64_check.py`: the two obsolete VCC/EXEC refusal controls now use `M0` (124) with the existing "unsupported wave64 scalar pair" error; the VCC bit-index refusal is unchanged. - `tests/native_salu_cmp64_vcc_exec_check.py` + `tests/cmake/native_salu_cmp64_vcc_exec.cmake`: new controls/hardware tests (wave64 and wave32, all four ops from both sources, including VCC vs EXEC, EXEC vs literal, high-word / cross-word bit indices >= 32, wrapped indices 65 and 96, 8 negative controls, 6 reference mutants). - `docs/experiments/native-direct-salu-cmp64.md`: document the accepted VCC/EXEC sources. Linux checks (this host, no Windows/DXC): - `/tmp/pe-env/bin/python -B tests/form_coverage_check.py`: passed - `/tmp/pe-env/bin/python -B tests/docs_links_check.py`: passed (160 files, 682 links) - `/tmp/pe-env/bin/python -B tests/bidi_controls_check.py`: passed (2582 files) - `py_compile` on touched Python files: passed - Offline harness v2 (19 cases, oracle + 6 mutants + instruction decoding + refused-program priming check): passed; 6/6 spot-mutations on `/tmp` copies failed as expected. Windows verification (compile_dxil, native CTest) still pending. ### Windows Verification (667145e8) ```text Commit: 667145e8a83ba9daa506995d06fa4e6db1fa40ac (Windows 11 build 26100.7623) Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (D3D12 debug layer not enabled by native_store_replay) dev: cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump $env:XBOX2WINDOWS_ADAPTER='NVIDIA'; ctest --preset dev --no-tests=error -R '^(native_salu_cmp64_vcc_exec_|native_salu_cmp64_)' --output-on-failure -> 5/5 passed, 0 failed, 0 skipped (15.89s; both _hardware suites passed on RTX 4050) Repo checks: form_coverage_check, docs_links_check, bidi_controls_check -> 3/3 passed AI-assisted. ``` <!-- WIN-VERIFY: passed | sha=667145e8a83ba9daa506995d06fa4e6db1fa40ac -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 23:27:19 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 04:08 UTC · original · approved these changes

Approve 667145e8. Reviewed by reading the diff and the cited sources; nothing built or run here.

  • src/gfx1013_direct_compute.inl: the only change is the removal of the VCC (106) / EXEC (126) refusal in scalar64 (:3566-3567 on main; the lambda is :3563-3567 at this head). pair_high (:243-251) already treats 106/126 as aligned pairs and reads the high word through operand32(i, src + 1) (107/127, accepted at :180-183). This matches the SOPC rule in tools/disasm_rdna2.py:2443-2444 (src0 is 64-bit for all four ops, src1 only for s_cmp_eq_u64/s_cmp_lg_u64) and SCC = S0.u64 == / != S1.u64 (tools/startup/gfx2hlsl.py:11559). m0, odd SGPRs and vcc_hi/exec_hi as a pair stay refused by pair_high, and VCC/EXEC/M0 stay refused as the bit index (:3578).
  • On main (212d4b5f), tests/native_salu_cmp64_check.py:170-171 assert the refusal this PR removes. The PR retargets both to m0 with "unsupported wave64 scalar pair" and primes m0 (:167), which is needed because require_numeric refuses an unbound m0 first (src/gfx1013_compute_native.cpp:1229-1230 at this head, :1244-1245 on main).
  • Tests, by reading only: restoring either half of the refusal fails the VCC or the EXEC compile in _controls (tests/native_salu_cmp64_vcc_exec_check.py:219-226). The 6 "reference mutants" (:250-259) mutate the Python reference, not the C++. A wrong value on the VCC/EXEC path would be caught only by _hardware. Not covered: the refusal of vcc_hi (107) / exec_hi (127) as S0.
  • CI: neither new test runs on this PR, since the pr preset filter (CMakePresets.json:51) has no native_salu_*. The non-PR job runs dev with -E '_hardware$' (.github/workflows/windows.yml:498), so the _hardware evidence is the author's run in the PR body (5/5, 0 skipped at this head).
  • #3406 (@@ -3639), #3408 (@@ -3680) and #3409 (@@ -3700) change the same file in other hunks than this one (@@ -3563), and share no test or doc file with this PR.
  • Nit: the added ctest -R '^native_salu_cmp64_vcc_exec_' line in docs/experiments/native-direct-salu-cmp64.md:45 is redundant, because :44 -R '^native_salu_cmp64_' already matches the new tests.
**@⁠Leyukaka** on GitHub · 2026-11-29 04:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3412#pullrequestreview-6101348704) · **approved these changes** Approve `667145e8`. Reviewed by reading the diff and the cited sources; nothing built or run here. - `src/gfx1013_direct_compute.inl`: the only change is the removal of the VCC (106) / EXEC (126) refusal in `scalar64` (`:3566-3567` on `main`; the lambda is `:3563-3567` at this head). `pair_high` (`:243-251`) already treats 106/126 as aligned pairs and reads the high word through `operand32(i, src + 1)` (107/127, accepted at `:180-183`). This matches the SOPC rule in `tools/disasm_rdna2.py:2443-2444` (src0 is 64-bit for all four ops, src1 only for `s_cmp_eq_u64`/`s_cmp_lg_u64`) and `SCC = S0.u64 == / != S1.u64` (`tools/startup/gfx2hlsl.py:11559`). `m0`, odd SGPRs and `vcc_hi`/`exec_hi` as a pair stay refused by `pair_high`, and VCC/EXEC/M0 stay refused as the bit index (`:3578`). - On `main` (212d4b5f), `tests/native_salu_cmp64_check.py:170-171` assert the refusal this PR removes. The PR retargets both to `m0` with "unsupported wave64 scalar pair" and primes `m0` (`:167`), which is needed because `require_numeric` refuses an unbound `m0` first (`src/gfx1013_compute_native.cpp:1229-1230` at this head, `:1244-1245` on `main`). - Tests, by reading only: restoring either half of the refusal fails the VCC or the EXEC compile in `_controls` (`tests/native_salu_cmp64_vcc_exec_check.py:219-226`). The 6 "reference mutants" (`:250-259`) mutate the Python reference, not the C++. A wrong value on the VCC/EXEC path would be caught only by `_hardware`. Not covered: the refusal of `vcc_hi` (107) / `exec_hi` (127) as `S0`. - CI: neither new test runs on this PR, since the `pr` preset filter (`CMakePresets.json:51`) has no `native_salu_*`. The non-PR job runs `dev` with `-E '_hardware$'` (`.github/workflows/windows.yml:498`), so the `_hardware` evidence is the author's run in the PR body (5/5, 0 skipped at this head). - #3406 (`@@ -3639`), #3408 (`@@ -3680`) and #3409 (`@@ -3700`) change the same file in other hunks than this one (`@@ -3563`), and share no test or doc file with this PR. - Nit: the added `ctest -R '^native_salu_cmp64_vcc_exec_'` line in `docs/experiments/native-direct-salu-cmp64.md:45` is redundant, because `:44` `-R '^native_salu_cmp64_'` already matches the new tests.
github manually merged commit 3407455c3b into main 2026-11-29 08:45:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.