compute: accept VCC and EXEC as sources in s_cmov_b64 #3421

Manually merged
github merged 1 commit from github-bot/gh-3419 into gh-pr/3419/base 2026-11-29 08:33:16 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-29 00:13 UTC · original
Ammmae0x:compute/salu-cmov64-vcc-exec → main · +252 −7 · 5 files · 1 commits · merged 2026-11-29 08:27 UTC

Accept VCC (106) and EXEC (126) as 64-bit S0 sources in s_cmov_b64 in the direct C++ compute path.

Refs #3226, #2935

  • src/gfx1013_direct_compute.inl: the s_cmov_b64 source guard now accepts s0 == 106 || s0 == 126 alongside aligned SGPR pairs and integer/literal constants. M0 (124), odd SGPRs, float inline constants, and EXEC (126) as a destination are still refused with invalid s_cmov_b64 source / invalid s_cmov_b64 destination. old_lo/old_hi and new_lo/new_hi are all read before either destination word is written, so in-place s_cmov_b64 vcc, vcc and s_cmov_b64 vcc, exec stay overlap-safe (pair_high already handles 106/126).
  • tests/native_salu_cmov_check.py: the obsolete VCC-source refusal was replaced with an M0-source refusal (the s0 guard runs before operand32, so M0 triggers invalid s_cmov_b64 source directly); the refusal count is unchanged.
  • tests/native_salu_cmov64_vcc_exec_check.py + tests/cmake/native_salu_cmov64_vcc_exec.cmake: 12 hardware dispatches (wave64 SCC=0/1 into an SGPR pair and in place into vcc; wave32 SCC=0/1 into an SGPR pair and in place into vcc), each storing a result plane and a preserved-SCC plane. Controls compile the vcc, exec, and in-place exec-into-vcc forms (checking select i1), verify 8 invalid destination/source refusals, and check 5 reference mutants differ. EXEC is restored to all ones before the vector readback stores.
  • docs/experiments/native-direct-salu-cmov.md: documents the new sources, the overlap safety, and the new fixture.

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

  • py_compile on both touched Python files: passed.
  • tests/form_coverage_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py: all passed.
  • Offline harness (12 cases, program encodings, guard + read-before-write order, existing check_mutants + M0 refusal): passed.
  • 5/5 spot-mutations on /tmp copies caught (reference ignores inverted/swapped/clobber_scc; guard drops VCC/EXEC); /tmp copies cleaned up.

Windows verification (compile_dxil, native CTest) still pending.

Windows Verification (c49220b9)

Commit: c49220b9c9329ab8d2e48664ed4a5f0630a83add (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_cmov64_vcc_exec_|native_salu_cmov_)' --output-on-failure
  -> 5/5 passed, 0 failed, 0 skipped (12.01s; 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-29 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3419) `Ammmae0x:compute/salu-cmov64-vcc-exec` → `main` · +252 −7 · 5 files · 1 commits · merged 2026-11-29 08:27 UTC Accept `VCC` (`106`) and `EXEC` (`126`) as 64-bit `S0` sources in `s_cmov_b64` in the direct C++ compute path. Refs #3226, #2935 - `src/gfx1013_direct_compute.inl`: the `s_cmov_b64` source guard now accepts `s0 == 106 || s0 == 126` alongside aligned SGPR pairs and integer/literal constants. `M0` (`124`), odd SGPRs, float inline constants, and `EXEC` (`126`) as a destination are still refused with `invalid s_cmov_b64 source` / `invalid s_cmov_b64 destination`. `old_lo`/`old_hi` and `new_lo`/`new_hi` are all read before either destination word is written, so in-place `s_cmov_b64 vcc, vcc` and `s_cmov_b64 vcc, exec` stay overlap-safe (`pair_high` already handles `106`/`126`). - `tests/native_salu_cmov_check.py`: the obsolete `VCC`-source refusal was replaced with an `M0`-source refusal (the `s0` guard runs before `operand32`, so `M0` triggers `invalid s_cmov_b64 source` directly); the refusal count is unchanged. - `tests/native_salu_cmov64_vcc_exec_check.py` + `tests/cmake/native_salu_cmov64_vcc_exec.cmake`: 12 hardware dispatches (wave64 `SCC=0`/`1` into an SGPR pair and in place into `vcc`; wave32 `SCC=0`/`1` into an SGPR pair and in place into `vcc`), each storing a result plane and a preserved-`SCC` plane. Controls compile the `vcc`, `exec`, and in-place `exec`-into-`vcc` forms (checking `select i1`), verify 8 invalid destination/source refusals, and check 5 reference mutants differ. `EXEC` is restored to all ones before the vector readback stores. - `docs/experiments/native-direct-salu-cmov.md`: documents the new sources, the overlap safety, and the new fixture. Linux checks (this host, no Windows/DXC/GPU): - `py_compile` on both touched Python files: passed. - `tests/form_coverage_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`: all passed. - Offline harness (12 cases, program encodings, guard + read-before-write order, existing `check_mutants` + `M0` refusal): passed. - 5/5 spot-mutations on `/tmp` copies caught (reference ignores `inverted`/`swapped`/`clobber_scc`; guard drops `VCC`/`EXEC`); `/tmp` copies cleaned up. Windows verification (compile_dxil, native CTest) still pending. ### Windows Verification (c49220b9) ```text Commit: c49220b9c9329ab8d2e48664ed4a5f0630a83add (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_cmov64_vcc_exec_|native_salu_cmov_)' --output-on-failure -> 5/5 passed, 0 failed, 0 skipped (12.01s; 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=c49220b9c9329ab8d2e48664ed4a5f0630a83add -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 00:14:36 +00:00
Author
Owner

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

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

  • src/gfx1013_direct_compute.inl:3426 (same line on main): the s_cmov_b64 source guard now also accepts 106/126. This matches SOP1 decoding in tools/disasm_rdna2.py (op 0x06, :172; src0 is 64-bit for _b64 ops, :2400-2402; 106 = vcc and 126 = exec as pairs, :81-93). pair_high (:243-251) already reads the high word from 107/127, the same path s_mov_b64 uses (:3393). The destination guard is unchanged.
  • Read-before-write holds: old_lo, old_hi, new_lo and new_hi (:3433-3437) are loaded before both writes (:3438-3439). With aligned pairs the only possible overlap is s_cmov_b64 vcc, vcc.
  • On main, tests/native_salu_cmov_check.py:137 asserts the VCC-source refusal. The PR retargets it to m0, which still fails the same guard with the same message.
  • Mutants, by reading only: dropping 106 or 126 from the guard fails the _controls compile, and accepting m0, 107 or 127 changes the refusal message, so _controls catches both. A swapped select, an inverted condition or a duplicated low word survives _controls, which only checks for select i1; only _hardware catches them. The 5 "reference mutants" mutate the Python reference, not the C++.
  • CI: the pr preset filter (CMakePresets.json:51) has no native_salu_* tests, and the dev job excludes _hardware$ (.github/workflows/windows.yml:498). The _hardware evidence is therefore the author's run in the PR body (5/5 at this head).
  • This PR (@@ -3423) changes a different hunk of the same file from #3414 (@@ -3563), #3406 (@@ -3639), #3408 (@@ -3680), #3409 (@@ -3700) and #3416 (@@ -3812). git merge-tree against main (212d4b5f) is clean.

Non-blocking:

  • The vcc inplace cases (tests/native_salu_cmov64_vcc_exec_check.py:109-110, :119) have the destination and the source in the same register, so SCC=0 and SCC=1 give the same result. They show that vcc keeps its two halves, not that the select is right. The exec inplace cases are exec into vcc, not the same register.
  • Wave32 has no vcc-source SCC=0 case into an SGPR pair (:117 is SCC=1 only); one more row would cover it.
  • enable_exec for wave32 (:47) sets exec_hi to 1 (ZERO + 1), probably meant ZERO; harmless here.
  • docs/experiments/native-direct-salu-cmov.md:21 is not wrapped like the rest of the file.
**@⁠Leyukaka** on GitHub · 2026-11-29 04:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3419#pullrequestreview-6101366107) · **approved these changes** Approve `c49220b9`. Reviewed by reading the diff and the cited sources; nothing built or run here. - `src/gfx1013_direct_compute.inl:3426` (same line on `main`): the `s_cmov_b64` source guard now also accepts 106/126. This matches SOP1 decoding in `tools/disasm_rdna2.py` (op `0x06`, `:172`; src0 is 64-bit for `_b64` ops, `:2400-2402`; 106 = `vcc` and 126 = `exec` as pairs, `:81-93`). `pair_high` (`:243-251`) already reads the high word from 107/127, the same path `s_mov_b64` uses (`:3393`). The destination guard is unchanged. - Read-before-write holds: `old_lo`, `old_hi`, `new_lo` and `new_hi` (`:3433-3437`) are loaded before both writes (`:3438-3439`). With aligned pairs the only possible overlap is `s_cmov_b64 vcc, vcc`. - On `main`, `tests/native_salu_cmov_check.py:137` asserts the VCC-source refusal. The PR retargets it to `m0`, which still fails the same guard with the same message. - Mutants, by reading only: dropping 106 or 126 from the guard fails the `_controls` compile, and accepting `m0`, 107 or 127 changes the refusal message, so `_controls` catches both. A swapped select, an inverted condition or a duplicated low word survives `_controls`, which only checks for `select i1`; only `_hardware` catches them. The 5 "reference mutants" mutate the Python reference, not the C++. - CI: the `pr` preset filter (`CMakePresets.json:51`) has no `native_salu_*` tests, and the dev job excludes `_hardware$` (`.github/workflows/windows.yml:498`). The `_hardware` evidence is therefore the author's run in the PR body (5/5 at this head). - This PR (`@@ -3423`) changes a different hunk of the same file from #3414 (`@@ -3563`), #3406 (`@@ -3639`), #3408 (`@@ -3680`), #3409 (`@@ -3700`) and #3416 (`@@ -3812`). `git merge-tree` against `main` (`212d4b5f`) is clean. Non-blocking: - The `vcc inplace` cases (`tests/native_salu_cmov64_vcc_exec_check.py:109-110, :119`) have the destination and the source in the same register, so `SCC=0` and `SCC=1` give the same result. They show that `vcc` keeps its two halves, not that the select is right. The `exec inplace` cases are `exec` into `vcc`, not the same register. - Wave32 has no `vcc`-source `SCC=0` case into an SGPR pair (`:117` is `SCC=1` only); one more row would cover it. - `enable_exec` for wave32 (`:47`) sets `exec_hi` to 1 (`ZERO + 1`), probably meant `ZERO`; harmless here. - `docs/experiments/native-direct-salu-cmov.md:21` is not wrapped like the rest of the file.
github-bot changed target branch from main to gh-pr/3419/base 2026-11-29 08:33:12 +00:00
github manually merged commit c49220b9c9 into gh-pr/3419/base 2026-11-29 08:33:14 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-29 08:27 UTC · original · reviewed

Reviewed c49220b9c9329ab8d2e48664ed4a5f0630a83add:

  • src/gfx1013_direct_compute.inl: accepts s0 == 106 (vcc) and s0 == 126 (exec) as 64-bit sources in s_cmov_b64, reading old_lo/old_hi and new_lo/new_hi before writing D[0:1] so in-place vcc, vcc and vcc, exec preserve original inputs.
  • tests/native_salu_cmov64_vcc_exec_check.py + tests/cmake/native_salu_cmov64_vcc_exec.cmake + tests/native_salu_cmov_check.py: covers wave64 and wave32 dispatches, SCC = 0/1, in-place vcc, vcc and vcc, exec, 8 invalid operand refusals, and 5 reference mutants.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit c49220b9c9329ab8d2e48664ed4a5f0630a83add:

  • ctest --preset dev -R '^(native_salu_cmov64_vcc_exec_|native_salu_cmov_)' --parallel 5 --no-tests=error --output-on-failure: 5/5 passed (2.84s)
  • ctest --preset release -R '^(native_salu_cmov64_vcc_exec_|native_salu_cmov_)' --parallel 5 --no-tests=error --output-on-failure: 5/5 passed (2.11s)

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-29 08:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3419#pullrequestreview-6102080872) · **reviewed** Reviewed `c49220b9c9329ab8d2e48664ed4a5f0630a83add`: - `src/gfx1013_direct_compute.inl`: accepts `s0 == 106` (`vcc`) and `s0 == 126` (`exec`) as 64-bit sources in `s_cmov_b64`, reading `old_lo`/`old_hi` and `new_lo`/`new_hi` before writing `D[0:1]` so in-place `vcc, vcc` and `vcc, exec` preserve original inputs. - `tests/native_salu_cmov64_vcc_exec_check.py` + `tests/cmake/native_salu_cmov64_vcc_exec.cmake` + `tests/native_salu_cmov_check.py`: covers wave64 and wave32 dispatches, `SCC = 0`/`1`, in-place `vcc, vcc` and `vcc, exec`, 8 invalid operand refusals, and 5 reference mutants. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `c49220b9c9329ab8d2e48664ed4a5f0630a83add`: - `ctest --preset dev -R '^(native_salu_cmov64_vcc_exec_|native_salu_cmov_)' --parallel 5 --no-tests=error --output-on-failure`: **5/5 passed** (`2.84s`) - `ctest --preset release -R '^(native_salu_cmov64_vcc_exec_|native_salu_cmov_)' --parallel 5 --no-tests=error --output-on-failure`: **5/5 passed** (`2.11s`) AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.