compute: accept VCC as source in 64-bit scalar bit-count and bit-scan #3404

Manually merged
github merged 1 commit from github-bot/gh-3402 into main 2026-11-29 13:44:35 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-28 22:05 UTC · original
Ammmae0x:compute/salu-bitscan64-vcc → main · +267 −5 · 6 files · 1 commits · merged 2026-11-29 13:41 UTC

Change

Accept VCC (s0 == 106) as the 64-bit source in the direct C++ compute path for the six 64-bit scalar
bit-count and bit-scan instructions s_bcnt0_i32_b64, s_bcnt1_i32_b64, s_ff0_i32_b64, s_ff1_i32_b64,
s_flbit_i32_b64 and s_flbit_i32_i64 (src/gfx1013_direct_compute.inl, one-line s0_pair change:
s0 == 106 alongside aligned SGPR pairs and EXEC). vcc_lo/vcc_hi are read via operand32(i, s0) and
operand32(i, s0 + 1), exactly as the existing EXEC path reads exec_lo/exec_hi. M0 (124), odd SGPRs
and invalid destinations (i.dst > 105) are still refused with the exact existing error strings.

Refs #3226, #2935. In #3226's refreshed census, invalid s_bcnt1_i32_b64 source blocks 10 wave64 shaders
(16,894 dispatches) and invalid s_ff1_i32_b64 source blocks 7 wave64 shaders (8,236 dispatches). This is a
single cohesive change, independent of #3359 (which added VCC as a destination for s_bfm_b64 and is
already merged in main).

New tests/native_salu_bitscan64_vcc_check.py + tests/cmake/native_salu_bitscan64_vcc.cmake
(native_salu_bitscan64_vcc_controls / native_salu_bitscan64_vcc_hardware): all 6 ops with S0 = VCC in
wave32 and wave64 (102 cases), populating VCC both with explicit s_mov_b32 vcc_lo/vcc_hi pairs (zero,
all-ones, low-half-only, high-half-only, sign-bit, bit 32) and with lane comparisons (v_cmp_lt_u32 against
16, v_cmp_eq_u32 against 0); exact result words and SCC are verified (counts update SCC = (D != 0),
scans preserve SCC), plus M0/odd-SGPR/invalid-destination refusals. The two existing refusal tests that
asserted VCC is refused as a source for these ops now use M0 instead
(tests/native_wave64_exec_salu_check.py BCNT1_B64, tests/native_salu_bitscan64_check.py FLBIT_B64).
docs/experiments/native-direct-salu-bitscan64.md documents VCC as S0 across all 6 ops.

AI-assisted.

Verification

Commit under test: 414874b6ba1ca87852b53b42479bb85abad7ea92 (branch compute/salu-bitscan64-vcc, from
origin/main 8ecd30fe).

Linux (this VM; no Windows toolchain here):

  • Offline harness (/tmp/bitscan64_vcc_harness.py, not in the repo): decodes every case program with
    tools/disasm_rdna2.py (all 6 ops appear as s_*_i32_b64 s24, vcc; v_cmp_lt_u32/v_cmp_eq_u32
    encodings verified; no bare-VGPR vmove() — VGPRs are stored directly, vmove() is only used for SGPRs),
    cross-checks eval_bitscan() against an independent brute-force reference for all 102 cases, verifies the
    hardware expected-layout build (no double-writes, in bounds, store planes at 0 and 16 * wave_size bytes),
    and evaluates the s0_pair guard expression straight from the .inl (accepts 0/2/22/104/106/126, refuses
    105/107/124/127/23). Result: harness OK: 102 cases x wave32/wave64, VCC source encodings, references, layout and s0_pair guard all match.
  • Spot-mutations, each killed by the harness (exit 1) and restored cleanly (git status/git diff show only
    the intended change): M1 VCC source replaced by SGPR pair (72 failures); M2 bare-VGPR vmove(2, 256 + dst)
    (102 failures — the Task 1/5 failure mode); M3 s0 == 106 dropped from the C++ guard (s0=106 refused);
    M4 v_cmp_lt_u32 opcode swapped to ne (decoded as v_cmp_ne_u32); M5 store plane stride halved
    (102 failures). The M2 check itself was fixed during the run: the disassembler prints v_mov_b32_e32,
    which the first version of the check missed.
  • /tmp/pe-env/bin/python -B tests/form_coverage_check.py — form coverage checks passed, exit 0.
  • /tmp/pe-env/bin/python -B tests/docs_links_check.py — Checked 160 Markdown files and 682 links, exit 0.
  • /tmp/pe-env/bin/python -B tests/bidi_controls_check.py — Checked 2578 tracked source, script and build/CI files: no bidirectional controls, exit 0.
  • py_compile on all three touched/related test files — pass. The changed guard expression compiles clean
    under g++ -std=c++20 -Wall -Wextra in a standalone check (accepts 106, refuses 124/23/127); a standalone
    -fsyntax-only of the whole .inl fails identically before and after this change (missing include
    context), so it proves nothing new either way.

Not run here — needs Windows: cmake --build --preset dev --target compile_dxil native_store_replay and
ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' -V,
including native_salu_bitscan64_vcc_hardware on a real adapter (exit 77 is a skip, not a pass). Note the
hardware test has 102 replay cases; if it approaches the 60 s timeout on Windows, split it by wave size.

Evidence and follow-up

  • Fixtures are synthetic: VCC patterns are set with s_mov_b32 immediates or derived from v_cmp_* lane
    comparisons against v0; no game files, dumps or distribution links are involved.
  • Assumption: v_cmp writes VCC through the same ballot path the direct compute path already uses for
    v_cmpx/EXEC; the hardware test is the check for that on a real adapter.
  • The gfx2hlsl text translator and pixel path are untouched; whether they also accept VCC as a source for
    these ops is out of scope here.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

Windows Verification (414874b6)

  • Environment: Windows build 26100, MSVC 19.50.35727.0, adapter NVIDIA GeForce RTX 4050 Laptop GPU (driver 32.0.15.9186, XBOX2WINDOWS_ADAPTER=NVIDIA), D3D12 debug layer off, commit 414874b6ba1ca87852b53b42479bb85abad7ea92.
  • cmake --build --preset dev --target compile_dxil native_store_replay -> exit 0
  • cmake --build --preset release --target compile_dxil native_store_replay -> exit 0
  • ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure -> 5/5 passed ( skips)
  • ctest --preset release --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure -> 5/5 passed ( skips)
  • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py -> form coverage checks passed (exit 0)
  • .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py -> Self-test passed. Checked 160 Markdown files and 682 links. (exit 0)
  • .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py -> Self-test passed. Checked 2580 tracked source, script and build/CI files: no bidirectional controls. (exit 0)
# dev preset (5/5 passed, 0 skips)
2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ
1/5 Test #2754: native_salu_bitscan64_controls .......   Passed    1.17 sec
2/5 Test #2755: native_salu_bitscan64_hardware .......   Passed   15.21 sec
2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ
3/5 Test #2756: native_salu_bitscan64_vcc_controls ...   Passed    0.62 sec
4/5 Test #2757: native_salu_bitscan64_vcc_hardware ...   Passed   28.68 sec
5/5 Test #2803: native_wave64_exec_salu_hardware .....   Passed    2.73 sec
The following tests passed:
	native_salu_bitscan64_controls
	native_salu_bitscan64_hardware
	native_salu_bitscan64_vcc_controls
	native_salu_bitscan64_vcc_hardware
	native_wave64_exec_salu_hardware
100% tests passed, 0 tests failed out of 5
Total Test time (real) =  48.57 sec

# release preset (5/5 passed, 0 skips)
2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ
1/5 Test #2754: native_salu_bitscan64_controls .......   Passed    0.46 sec
2/5 Test #2755: native_salu_bitscan64_hardware .......   Passed   11.02 sec
2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ
3/5 Test #2756: native_salu_bitscan64_vcc_controls ...   Passed    0.44 sec
4/5 Test #2757: native_salu_bitscan64_vcc_hardware ...   Passed   29.35 sec
5/5 Test #2803: native_wave64_exec_salu_hardware .....   Passed    2.43 sec
The following tests passed:
	native_salu_bitscan64_controls
	native_salu_bitscan64_hardware
	native_salu_bitscan64_vcc_controls
	native_salu_bitscan64_vcc_hardware
	native_wave64_exec_salu_hardware
100% tests passed, 0 tests failed out of 5
Total Test time (real) =  43.83 sec
**@⁠Ammmae0x** on GitHub · 2026-11-28 22:05 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402) `Ammmae0x:compute/salu-bitscan64-vcc` → `main` · +267 −5 · 6 files · 1 commits · merged 2026-11-29 13:41 UTC ## Change Accept `VCC` (`s0 == 106`) as the 64-bit source in the direct C++ compute path for the six 64-bit scalar bit-count and bit-scan instructions `s_bcnt0_i32_b64`, `s_bcnt1_i32_b64`, `s_ff0_i32_b64`, `s_ff1_i32_b64`, `s_flbit_i32_b64` and `s_flbit_i32_i64` (`src/gfx1013_direct_compute.inl`, one-line `s0_pair` change: `s0 == 106` alongside aligned SGPR pairs and `EXEC`). `vcc_lo`/`vcc_hi` are read via `operand32(i, s0)` and `operand32(i, s0 + 1)`, exactly as the existing `EXEC` path reads `exec_lo`/`exec_hi`. `M0` (124), odd SGPRs and invalid destinations (`i.dst > 105`) are still refused with the exact existing error strings. Refs #3226, #2935. In #3226's refreshed census, `invalid s_bcnt1_i32_b64 source` blocks 10 wave64 shaders (16,894 dispatches) and `invalid s_ff1_i32_b64 source` blocks 7 wave64 shaders (8,236 dispatches). This is a single cohesive change, independent of #3359 (which added `VCC` as a destination for `s_bfm_b64` and is already merged in `main`). New `tests/native_salu_bitscan64_vcc_check.py` + `tests/cmake/native_salu_bitscan64_vcc.cmake` (`native_salu_bitscan64_vcc_controls` / `native_salu_bitscan64_vcc_hardware`): all 6 ops with `S0 = VCC` in wave32 and wave64 (102 cases), populating VCC both with explicit `s_mov_b32 vcc_lo`/`vcc_hi` pairs (zero, all-ones, low-half-only, high-half-only, sign-bit, bit 32) and with lane comparisons (`v_cmp_lt_u32` against 16, `v_cmp_eq_u32` against 0); exact result words and `SCC` are verified (counts update `SCC = (D != 0)`, scans preserve `SCC`), plus `M0`/odd-SGPR/invalid-destination refusals. The two existing refusal tests that asserted `VCC` is refused as a source for these ops now use `M0` instead (`tests/native_wave64_exec_salu_check.py` `BCNT1_B64`, `tests/native_salu_bitscan64_check.py` `FLBIT_B64`). `docs/experiments/native-direct-salu-bitscan64.md` documents `VCC` as `S0` across all 6 ops. AI-assisted. ## Verification Commit under test: `414874b6ba1ca87852b53b42479bb85abad7ea92` (branch `compute/salu-bitscan64-vcc`, from `origin/main` `8ecd30fe`). Linux (this VM; no Windows toolchain here): - Offline harness (`/tmp/bitscan64_vcc_harness.py`, not in the repo): decodes every case program with `tools/disasm_rdna2.py` (all 6 ops appear as `s_*_i32_b64 s24, vcc`; `v_cmp_lt_u32`/`v_cmp_eq_u32` encodings verified; no bare-VGPR `vmove()` — VGPRs are stored directly, `vmove()` is only used for SGPRs), cross-checks `eval_bitscan()` against an independent brute-force reference for all 102 cases, verifies the hardware expected-layout build (no double-writes, in bounds, store planes at 0 and `16 * wave_size` bytes), and evaluates the `s0_pair` guard expression straight from the `.inl` (accepts 0/2/22/104/106/126, refuses 105/107/124/127/23). Result: `harness OK: 102 cases x wave32/wave64, VCC source encodings, references, layout and s0_pair guard all match`. - Spot-mutations, each killed by the harness (exit 1) and restored cleanly (`git status`/`git diff` show only the intended change): M1 VCC source replaced by SGPR pair (72 failures); M2 bare-VGPR `vmove(2, 256 + dst)` (102 failures — the Task 1/5 failure mode); M3 `s0 == 106` dropped from the C++ guard (s0=106 refused); M4 `v_cmp_lt_u32` opcode swapped to `ne` (decoded as `v_cmp_ne_u32`); M5 store plane stride halved (102 failures). The M2 check itself was fixed during the run: the disassembler prints `v_mov_b32_e32`, which the first version of the check missed. - `/tmp/pe-env/bin/python -B tests/form_coverage_check.py` — `form coverage checks passed`, exit 0. - `/tmp/pe-env/bin/python -B tests/docs_links_check.py` — `Checked 160 Markdown files and 682 links`, exit 0. - `/tmp/pe-env/bin/python -B tests/bidi_controls_check.py` — `Checked 2578 tracked source, script and build/CI files: no bidirectional controls`, exit 0. - `py_compile` on all three touched/related test files — pass. The changed guard expression compiles clean under `g++ -std=c++20 -Wall -Wextra` in a standalone check (accepts 106, refuses 124/23/127); a standalone `-fsyntax-only` of the whole `.inl` fails identically before and after this change (missing include context), so it proves nothing new either way. Not run here — needs Windows: `cmake --build --preset dev --target compile_dxil native_store_replay` and `ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' -V`, including `native_salu_bitscan64_vcc_hardware` on a real adapter (exit 77 is a skip, not a pass). Note the hardware test has 102 replay cases; if it approaches the 60 s timeout on Windows, split it by wave size. ## Evidence and follow-up - Fixtures are synthetic: VCC patterns are set with `s_mov_b32` immediates or derived from `v_cmp_*` lane comparisons against `v0`; no game files, dumps or distribution links are involved. - Assumption: `v_cmp` writes `VCC` through the same ballot path the direct compute path already uses for `v_cmpx`/`EXEC`; the hardware test is the check for that on a real adapter. - The `gfx2hlsl` text translator and pixel path are untouched; whether they also accept `VCC` as a source for these ops is out of scope here. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. ### Windows Verification (`414874b6`) - **Environment:** Windows build `26100`, MSVC 19.50.35727.0, adapter `NVIDIA GeForce RTX 4050 Laptop GPU` (driver `32.0.15.9186`, `XBOX2WINDOWS_ADAPTER=NVIDIA`), D3D12 debug layer off, commit `414874b6ba1ca87852b53b42479bb85abad7ea92`. - `cmake --build --preset dev --target compile_dxil native_store_replay` -> exit `0` - `cmake --build --preset release --target compile_dxil native_store_replay` -> exit `0` - `ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure` -> `5/5` passed ( skips) - `ctest --preset release --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure` -> `5/5` passed ( skips) - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py` -> `form coverage checks passed` (exit `0`) - `.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py` -> `Self-test passed. Checked 160 Markdown files and 682 links.` (exit `0`) - `.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py` -> `Self-test passed. Checked 2580 tracked source, script and build/CI files: no bidirectional controls.` (exit `0`) ```text # dev preset (5/5 passed, 0 skips) 2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ 1/5 Test #2754: native_salu_bitscan64_controls ....... Passed 1.17 sec 2/5 Test #2755: native_salu_bitscan64_hardware ....... Passed 15.21 sec 2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ 3/5 Test #2756: native_salu_bitscan64_vcc_controls ... Passed 0.62 sec 4/5 Test #2757: native_salu_bitscan64_vcc_hardware ... Passed 28.68 sec 5/5 Test #2803: native_wave64_exec_salu_hardware ..... Passed 2.73 sec The following tests passed: native_salu_bitscan64_controls native_salu_bitscan64_hardware native_salu_bitscan64_vcc_controls native_salu_bitscan64_vcc_hardware native_wave64_exec_salu_hardware 100% tests passed, 0 tests failed out of 5 Total Test time (real) = 48.57 sec # release preset (5/5 passed, 0 skips) 2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ 1/5 Test #2754: native_salu_bitscan64_controls ....... Passed 0.46 sec 2/5 Test #2755: native_salu_bitscan64_hardware ....... Passed 11.02 sec 2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ 3/5 Test #2756: native_salu_bitscan64_vcc_controls ... Passed 0.44 sec 4/5 Test #2757: native_salu_bitscan64_vcc_hardware ... Passed 29.35 sec 5/5 Test #2803: native_wave64_exec_salu_hardware ..... Passed 2.43 sec The following tests passed: native_salu_bitscan64_controls native_salu_bitscan64_hardware native_salu_bitscan64_vcc_controls native_salu_bitscan64_vcc_hardware native_wave64_exec_salu_hardware 100% tests passed, 0 tests failed out of 5 Total Test time (real) = 43.83 sec ``` <!-- WIN-VERIFY: passed | sha=414874b6ba1ca87852b53b42479bb85abad7ea92 -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:11:19 +00:00
Author
Owner

@⁠Ammmae0x on GitHub · 2026-11-28 22:10 UTC · original · edited 2026-11-28 22:14 UTC

Windows release verification for commit 414874b6ba1ca87852b53b42479bb85abad7ea92:

  • Command: XBOX2WINDOWS_ADAPTER=NVIDIA ctest --preset release --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' -V
  • Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (driver 32.0.15.9186, D3D12 debug layer off)
2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ
1/5 Test #2754: native_salu_bitscan64_controls .......   Passed    0.46 sec
2/5 Test #2755: native_salu_bitscan64_hardware .......   Passed   11.02 sec
2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ
3/5 Test #2756: native_salu_bitscan64_vcc_controls ...   Passed    0.44 sec
4/5 Test #2757: native_salu_bitscan64_vcc_hardware ...   Passed   29.35 sec
5/5 Test #2803: native_wave64_exec_salu_hardware .....   Passed    2.43 sec
The following tests passed:
	native_salu_bitscan64_controls
	native_salu_bitscan64_hardware
	native_salu_bitscan64_vcc_controls
	native_salu_bitscan64_vcc_hardware
	native_wave64_exec_salu_hardware
100% tests passed, 0 tests failed out of 5
Total Test time (real) =  43.83 sec

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-11-28 22:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402#issuecomment-7246546362) · edited 2026-11-28 22:14 UTC Windows `release` verification for commit `414874b6ba1ca87852b53b42479bb85abad7ea92`: - **Command:** `XBOX2WINDOWS_ADAPTER=NVIDIA ctest --preset release --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' -V` - **Adapter:** `NVIDIA GeForce RTX 4050 Laptop GPU` (driver `32.0.15.9186`, D3D12 debug layer off) ```text 2754: compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ 1/5 Test #2754: native_salu_bitscan64_controls ....... Passed 0.46 sec 2/5 Test #2755: native_salu_bitscan64_hardware ....... Passed 11.02 sec 2756: compiled 6 ops with VCC source (plus lane-compare VCC); 6 invalid forms refused; 5 reference mutants differ 3/5 Test #2756: native_salu_bitscan64_vcc_controls ... Passed 0.44 sec 4/5 Test #2757: native_salu_bitscan64_vcc_hardware ... Passed 29.35 sec 5/5 Test #2803: native_wave64_exec_salu_hardware ..... Passed 2.43 sec The following tests passed: native_salu_bitscan64_controls native_salu_bitscan64_hardware native_salu_bitscan64_vcc_controls native_salu_bitscan64_vcc_hardware native_wave64_exec_salu_hardware 100% tests passed, 0 tests failed out of 5 Total Test time (real) = 43.83 sec ``` AI-assisted.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 01:59 UTC · original · requested changes

Request changes on 414874b6.

The guard change itself is correct. Outside the graphics path operand32 already reads 106/107 as VCC (src/gfx1013_direct_compute.inl:175-191 on main), the handler is gated on compute, and the existing count/scan lowering does not depend on which pair is the source.

Blocking: tests/native_scalar_mask64_check.py:90-92 (added in #3337, not touched by this PR) still asserts the old refusal:

        # VCC stays refused as a 64-bit count source.
        (count_program(), 64, "invalid s_bcnt1_i32_b64 source"),
        (count_program(), 32, "invalid s_bcnt1_i32_b64 source"),

count_program() defaults to src=106 and sets vcc_lo/vcc_hi with s_mov_b32 literals. With s0 == 106 accepted, the guard no longer refuses these two programs, and it is the only place that emits this diagnostic for s_bcnt1_i32_b64, so compile_case (lines 46-47) and native_scalar_mask64_controls fail. Your ctest regex ^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64) does not select that test. CI does not either: the pull_request Windows job runs ctest --preset pr (.github/workflows/windows.yml:493), and its filter (CMakePresets.json:51) matches none of native_salu_bitscan64*, native_wave64_exec_salu* or native_scalar_mask64*.

Fix: remove lines 90-92 (or switch the two entries to count_program(src=124), M0, which stays refused) and keep count_program(src=107) on line 89.

Smaller points:

  • No test in this PR refuses vcc_hi (107) as S0. A guard of s0 == 106 || s0 == 107 is caught only by the count_program(src=107) case above, in the file this PR leaves failing. A sop1(op, 24, VCC + 1) refusal in the new controls would cover it.
  • The wave32 cmp_lt16/cmp_eq0 cases expect vcc_hi == 0. In wave32 write_ballot writes only vcc_lo, so the expected value relies on the initial vcc_hi, which those cases do not set.
  • The "5 reference mutants" only mutate the Python reference, not the translator.

Basis: diff read in full against main 212d4b5f; nothing built or run. git merge-tree of 414874b6 with main 212d4b5f is clean.

**@⁠Leyukaka** on GitHub · 2026-11-29 01:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402#pullrequestreview-6100994348) · **requested changes** Request changes on 414874b6. The guard change itself is correct. Outside the graphics path `operand32` already reads 106/107 as VCC (`src/gfx1013_direct_compute.inl:175-191` on main), the handler is gated on `compute`, and the existing count/scan lowering does not depend on which pair is the source. Blocking: `tests/native_scalar_mask64_check.py:90-92` (added in #3337, not touched by this PR) still asserts the old refusal: ``` # VCC stays refused as a 64-bit count source. (count_program(), 64, "invalid s_bcnt1_i32_b64 source"), (count_program(), 32, "invalid s_bcnt1_i32_b64 source"), ``` `count_program()` defaults to `src=106` and sets `vcc_lo`/`vcc_hi` with `s_mov_b32` literals. With `s0 == 106` accepted, the guard no longer refuses these two programs, and it is the only place that emits this diagnostic for `s_bcnt1_i32_b64`, so `compile_case` (lines 46-47) and `native_scalar_mask64_controls` fail. Your ctest regex `^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)` does not select that test. CI does not either: the `pull_request` Windows job runs `ctest --preset pr` (`.github/workflows/windows.yml:493`), and its filter (`CMakePresets.json:51`) matches none of `native_salu_bitscan64*`, `native_wave64_exec_salu*` or `native_scalar_mask64*`. Fix: remove lines 90-92 (or switch the two entries to `count_program(src=124)`, M0, which stays refused) and keep `count_program(src=107)` on line 89. Smaller points: - No test in this PR refuses `vcc_hi` (107) as `S0`. A guard of `s0 == 106 || s0 == 107` is caught only by the `count_program(src=107)` case above, in the file this PR leaves failing. A `sop1(op, 24, VCC + 1)` refusal in the new controls would cover it. - The wave32 `cmp_lt16`/`cmp_eq0` cases expect `vcc_hi == 0`. In wave32 `write_ballot` writes only `vcc_lo`, so the expected value relies on the initial `vcc_hi`, which those cases do not set. - The "5 reference mutants" only mutate the Python reference, not the translator. Basis: diff read in full against main 212d4b5f; nothing built or run. `git merge-tree` of 414874b6 with main 212d4b5f is clean.
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-29 12:55 UTC · original

Review of head 414874b6. Its merge-base is 8ecd30fe. git merge-tree --write-tree --name-only origin/main 414874b6 against main af1cab5c exits 0. Read only, nothing built or run.

Checked: the only source edit is the guard (|| s0 == 106 ||). operand32(i, s0) and operand32(i, s0 + 1) read vcc_lo/vcc_hi. The count and scan lowering after the guard is unchanged, and it uses unaryBits 31/32/33 = Countbits/FirstbitLo/FirstbitHi, which matches the DXIL opcode table. Default path: since #3451, these ops are lowered in default runs once VCC is accepted, the same as for the other scalar lowerings.

MUST

  1. The blocking point from the review at this head still stands on current main. git grep -n 'VCC stays refused' origin/main -- tests → tests/native_scalar_mask64_check.py:90: # VCC stays refused as a 64-bit count source., followed by the two count_program() cases at :91-92 that expect invalid s_bcnt1_i32_b64 source. This PR does not touch that file: git diff --stat 8ecd30fe 414874b6 lists 6 files, and it is not one of them. Adding native_scalar_mask64_ to the posted ctest regex would show the failure. Nothing else from me blocks.

NIT

  1. The Windows block in the body reads 5/5 passed ( skips), so a count is missing. The quoted log shows 0 skips.

AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-29 12:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402#issuecomment-7256160655) Review of head `414874b6`. Its merge-base is `8ecd30fe`. `git merge-tree --write-tree --name-only origin/main 414874b6` against `main` `af1cab5c` exits 0. Read only, nothing built or run. Checked: the only source edit is the guard (`|| s0 == 106 ||`). `operand32(i, s0)` and `operand32(i, s0 + 1)` read `vcc_lo`/`vcc_hi`. The count and scan lowering after the guard is unchanged, and it uses `unaryBits` 31/32/33 = Countbits/FirstbitLo/FirstbitHi, which matches the DXIL opcode table. Default path: since #3451, these ops are lowered in default runs once VCC is accepted, the same as for the other scalar lowerings. **MUST** 1. The blocking point from the review at this head still stands on current `main`. `git grep -n 'VCC stays refused' origin/main -- tests` → `tests/native_scalar_mask64_check.py:90: # VCC stays refused as a 64-bit count source.`, followed by the two `count_program()` cases at `:91-92` that expect `invalid s_bcnt1_i32_b64 source`. This PR does not touch that file: `git diff --stat 8ecd30fe 414874b6` lists 6 files, and it is not one of them. Adding `native_scalar_mask64_` to the posted ctest regex would show the failure. Nothing else from me blocks. **NIT** 2. The Windows block in the body reads `5/5 passed ( skips)`, so a count is missing. The quoted log shows 0 skips. AI-assisted.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 13:22 UTC · original

Taking this over since there has been no activity for 2 h; will hand back if you resume.

Plan:

  • Keep 414874b6 unchanged and merge it with main c04e0dd6 (git merge-tree is clean). main still refuses VCC at src/gfx1013_direct_compute.inl:4158; your one-line guard change is the only source edit.
  • One added commit: remove tests/native_scalar_mask64_check.py:90-92 (the comment and the two count_program() cases that expect invalid s_bcnt1_i32_b64 source for source 106), keeping count_program(src=107) at :89.
  • Same commit: add a vcc_hi (107) source refusal next to the existing ones in tests/native_salu_bitscan64_vcc_check.py:172-177.
  • Run ctest -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)' in an isolated environment and post the result.
  • Open a new PR that credits you as the author of 414874b6.
**@⁠Leyukaka** on GitHub · 2026-11-29 13:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402#issuecomment-7256491946) Taking this over since there has been no activity for 2 h; will hand back if you resume. Plan: - Keep `414874b6` unchanged and merge it with `main` `c04e0dd6` (`git merge-tree` is clean). `main` still refuses VCC at `src/gfx1013_direct_compute.inl:4158`; your one-line guard change is the only source edit. - One added commit: remove `tests/native_scalar_mask64_check.py:90-92` (the comment and the two `count_program()` cases that expect `invalid s_bcnt1_i32_b64 source` for source 106), keeping `count_program(src=107)` at `:89`. - Same commit: add a `vcc_hi` (107) source refusal next to the existing ones in `tests/native_salu_bitscan64_vcc_check.py:172-177`. - Run `ctest -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)'` in an isolated environment and post the result. - Open a new PR that credits you as the author of `414874b6`.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 13:32 UTC · original

Continued in #3458: 414874b6 unchanged (you remain its author), merged with main c04e0dd6, plus one test commit ee117c4f that removes the two count_program() VCC refusals in tests/native_scalar_mask64_check.py and adds a vcc_hi (107) source refusal to the new controls. 7/7 pass with ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)' on a hardware adapter.

You can take it back at any time: say so here or push to this branch, and #3458 gets closed.

**@⁠Leyukaka** on GitHub · 2026-11-29 13:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3402#issuecomment-7256616958) Continued in #3458: `414874b6` unchanged (you remain its author), merged with `main` `c04e0dd6`, plus one test commit `ee117c4f` that removes the two `count_program()` VCC refusals in `tests/native_scalar_mask64_check.py` and adds a `vcc_hi` (107) source refusal to the new controls. 7/7 pass with `ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)'` on a hardware adapter. You can take it back at any time: say so here or push to this branch, and #3458 gets closed.
github manually merged commit 863e9549c5 into main 2026-11-29 13:44:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.