Repository navigation
Conversation
|
Windows
AI-assisted. |
Leyukaka
left a comment
There was a problem hiding this comment.
Request changes on 414874b.
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 #3335, 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) asS0. A guard ofs0 == 106 || s0 == 107is caught only by thecount_program(src=107)case above, in the file this PR leaves failing. Asop1(op, 24, VCC + 1)refusal in the new controls would cover it. - The wave32
cmp_lt16/cmp_eq0cases expectvcc_hi == 0. In wave32write_ballotwrites onlyvcc_lo, so the expected value relies on the initialvcc_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 212d4b5; nothing built or run. git merge-tree of 414874b with main 212d4b5 is clean.
Change
Accept
VCC(s0 == 106) as the 64-bit source in the direct C++ compute path for the six 64-bit scalarbit-count and bit-scan instructions
s_bcnt0_i32_b64,s_bcnt1_i32_b64,s_ff0_i32_b64,s_ff1_i32_b64,s_flbit_i32_b64ands_flbit_i32_i64(src/gfx1013_direct_compute.inl, one-lines0_pairchange:s0 == 106alongside aligned SGPR pairs andEXEC).vcc_lo/vcc_hiare read viaoperand32(i, s0)andoperand32(i, s0 + 1), exactly as the existingEXECpath readsexec_lo/exec_hi.M0(124), odd SGPRsand invalid destinations (
i.dst > 105) are still refused with the exact existing error strings.Refs #3224, #2935. In #3224's refreshed census,
invalid s_bcnt1_i32_b64 sourceblocks 10 wave64 shaders(16,894 dispatches) and
invalid s_ff1_i32_b64 sourceblocks 7 wave64 shaders (8,236 dispatches). This is asingle cohesive change, independent of #3357 (which added
VCCas a destination fors_bfm_b64and isalready 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 withS0 = VCCinwave32 and wave64 (102 cases), populating VCC both with explicit
s_mov_b32 vcc_lo/vcc_hipairs (zero,all-ones, low-half-only, high-half-only, sign-bit, bit 32) and with lane comparisons (
v_cmp_lt_u32against16,
v_cmp_eq_u32against 0); exact result words andSCCare verified (counts updateSCC = (D != 0),scans preserve
SCC), plusM0/odd-SGPR/invalid-destination refusals. The two existing refusal tests thatasserted
VCCis refused as a source for these ops now useM0instead(
tests/native_wave64_exec_salu_check.pyBCNT1_B64,tests/native_salu_bitscan64_check.pyFLBIT_B64).docs/experiments/native-direct-salu-bitscan64.mddocumentsVCCasS0across all 6 ops.AI-assisted.
Verification
Commit under test:
414874b6ba1ca87852b53b42479bb85abad7ea92(branchcompute/salu-bitscan64-vcc, fromorigin/main8ecd30fe).Linux (this VM; no Windows toolchain here):
/tmp/bitscan64_vcc_harness.py, not in the repo): decodes every case program withtools/disasm_rdna2.py(all 6 ops appear ass_*_i32_b64 s24, vcc;v_cmp_lt_u32/v_cmp_eq_u32encodings 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 thehardware expected-layout build (no double-writes, in bounds, store planes at 0 and
16 * wave_sizebytes),and evaluates the
s0_pairguard expression straight from the.inl(accepts 0/2/22/104/106/126, refuses105/107/124/127/23). Result:
harness OK: 102 cases x wave32/wave64, VCC source encodings, references, layout and s0_pair guard all match.git status/git diffshow onlythe 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 == 106dropped from the C++ guard (s0=106 refused);M4
v_cmp_lt_u32opcode swapped tone(decoded asv_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_compileon all three touched/related test files — pass. The changed guard expression compiles cleanunder
g++ -std=c++20 -Wall -Wextrain a standalone check (accepts 106, refuses 124/23/127); a standalone-fsyntax-onlyof the whole.inlfails identically before and after this change (missing includecontext), so it proves nothing new either way.
Not run here — needs Windows:
cmake --build --preset dev --target compile_dxil native_store_replayandctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' -V,including
native_salu_bitscan64_vcc_hardwareon a real adapter (exit 77 is a skip, not a pass). Note thehardware test has 102 replay cases; if it approaches the 60 s timeout on Windows, split it by wave size.
Evidence and follow-up
s_mov_b32immediates or derived fromv_cmp_*lanecomparisons against
v0; no game files, dumps or distribution links are involved.v_cmpwritesVCCthrough the same ballot path the direct compute path already uses forv_cmpx/EXEC; the hardware test is the check for that on a real adapter.gfx2hlsltext translator and pixel path are untouched; whether they also acceptVCCas a source forthese ops is out of scope here.
Checklist
Windows Verification (
414874b6)26100, MSVC 19.50.35727.0, adapterNVIDIA GeForce RTX 4050 Laptop GPU(driver32.0.15.9186,XBOX2WINDOWS_ADAPTER=NVIDIA), D3D12 debug layer off, commit414874b6ba1ca87852b53b42479bb85abad7ea92.cmake --build --preset dev --target compile_dxil native_store_replay-> exit0cmake --build --preset release --target compile_dxil native_store_replay-> exit0ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure->5/5passed ( skips)ctest --preset release --no-tests=error -R '^(native_salu_bitscan64_vcc_|native_wave64_exec_salu|native_salu_bitscan64)' --output-on-failure->5/5passed ( skips).\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py->form coverage checks passed(exit0).\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py->Self-test passed. Checked 160 Markdown files and 682 links.(exit0).\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.(exit0)