Repository navigation
Conversation
… values (SHADER-1264) When a computed non-mask scalar value was written to exec_lo or exec_hi (such as via s_add_u32, s_lshl_b32, or scalar loads through Gen.dst), exec_half_write tested (val != 0) which evaluated to true across all lanes of that wave half, turning on lanes that should have remained inactive. Extract each lane's corresponding bit (val >> (rel & 31)) & 1, matching the immediate constant path. Add regression test covering computed scalar writes to exec_lo and exec_hi in wave64 mode.
leoleahy
left a comment
There was a problem hiding this comment.
AI-assisted.
Independently verified on Windows 11 (Python 3.14.8, CPU-only) at 5fcb226f:
- Merge cleanliness against
upstream/main(dde82f27):git merge-tree --write-treeclean,git diff --checkclean,python -I -m compileall -qclean. - Added semantic suite (
python -I -m unittest discover -s tests/semantic -p test_wave64_exec_half_computed.py): 3/3 OK on HEAD; negative control ondde82f27fails all 3/3 (producing4294967295instead of5,10, and0x10). - Adjacent wave64 semantic suites on HEAD:
test_wave64_vcc_half_write.py7/7 OK,test_wave64_subgroup_ops.py6/6 OK. - Audited all 5
exec_half_writecall sites intools/rdna2spirv.py: per-lane mask callers pass0/0xFFFFFFFF(where(val >> (rel & 31)) & 1 != 0matchesval != 0identically), while computed scalar bitmask callers now extract each lane's own bit properly.
Looks solid and ready to merge.
|
Tested 5fcb226 on Arch Linux, Python 3.14.10, CPU only: pass — new tests/semantic/test_wave64_exec_half_computed.py 3/3 OK. Negative control: base translator → all 3 fail; restored, green again. No game files, no GPU. AI-assisted. |
|
GPU and silicon check of 5fcb226 (up to date with I used a wave64 compute shader (group 64,1,1,
The CPU interpreter gives the same words as the Radeon GPU for both translators. The other three writes to a mask still go through Tests:
A pitfall in case anyone turns this into a GPU fixture: read the marks back per lane, or through Windows 10 22H2, AMD Radeon iGPU (gfx1036, driver 32.0.13036.4), NVIDIA RTX 5070 Ti (driver 621.35), Vulkan SDK 1.4.363. Synthetic values only, no game files. AI-assisted (Claude Code). |
tupacfan04
left a comment
There was a problem hiding this comment.
The new wave64 bit extraction is correct: exec_half_write() takes (word >> (rel & 31)) & 1, half 0/1 preserves the other 32 lanes, the register-mask representation still works, the constant path keeps the Intel workaround, and the wave64 tests cover s_add_u32 into both halves and s_lshl_b32 into exec_lo (they fail on the old val != 0). The wave32 path is still broken:
tools/rdna2spirv.py:1548-1552 only sends wave64 EXEC writes to exec_half_write():
if self.wave64 and a["k"] == "special" and a["t"] in ("exec_lo", "exec_hi"):
self.exec_half_write(1 if a["t"] == "exec_hi" else 0, val)
return
if a["k"] == "special" and a["t"] in ("exec_lo", "exec"):
self.set_exec(val)
returnIn wave32, a computed scalar from s_add_u32, s_lshl_b32, etc. goes to set_exec(), whose tmp_bool_nz() is OpINotEqual %bool val 0 (:5578-5581), so a uniform value 5 activates every lane instead of lanes 0 and 2. The paths hit this (s_add_u32 → dst() at :9485; s_lshl_b32 → _store_b32_mask_dst/dst() at :11372/:5642). A wave32 shader with s_mov_b32 exec_lo, 0, s_mov_b32 s4, 5, s_add_u32 exec_lo, s4, 0 should leave exec_lo = 5, but still leaves 0xFFFFFFFF; s_lshl_b32 exec_lo, s4, 4 is the same.
Test gap: tests/semantic/test_wave64_exec_half_computed.py is wave64-only (FSSM_64, run_workgroup(..., 64, 64), all cases use wave64 halves); there is no wave32 FSSM_32/32-thread case for s_add_u32 exec_lo/s_lshl_b32 exec_lo, so the wave32 path is unpinned. The body's “scalar memory loads through Gen.dst” is not in the committed test, and the values 5/10/0x10 only exercise bits 0-4 (no bit 31).
Fix: use the bit extraction for wave32 exec_lo too (shared helper with exec_half_write), and add wave32 s_add/s_lshl cases plus a bit-31 case. Synthetic only; no game files. AI-assisted (OpenCode).
|
Coordinator note: SHADER-1264 already has an open PR, #8353 by @HDFreitas (opened 18:32 UTC), so this looks like a duplicate. Please compare the two and either close this one or say here what it adds. The maintainer decides which one is merged. |
|
Tested 5fcb226 merged onto
No GPU fixture writes a computed (non-mask) scalar to AI-assisted (Claude Code). |
|
Thanks for the review @tupacfan04 and @leoleahy! I have updated the PR to address your suggestion:
All 7 test cases pass cleanly. |
|
Tested
The PR is based on The cause looks like Everything else matches main: AI-assisted (Claude Code). |
|
Tested 1d93673 on AMD Radeon RX 6900 XT (RADV Navi 21, Mesa 26.2.5, Linux 7.3.1 CachyOS): pass
AI-assisted: yes |
|
Tested 1d93673 on Windows 11, Python 3.14.4, no GPU or LLVM: pass. |
|
Tested 1d93673 on AMD Radeon Graphics (Ryzen 5 7600X iGPU, RDNA2), AMD 32.0.21042.62 / AMDVLK 2.0.353, Vulkan 1.4.315, Windows 11, MSVC 14.51: pass PR head is on main dde82f2; the PR does not touch runtime/, so the runtime was the existing main build.
Note: this head (1d93673) is newer than the one the earlier GPU checks covered (5fcb226). AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested
|
|
Checked
Every fixture has the same result with and without the change. The one Intel failure is No game files. AI-assisted. |
|
Independent confirmation of the regression @jacob-rowlands reported, on the PR head as filed (no merge onto newer
The failure is deterministic: So the regression is between AI-assisted (OpenCode). |
|
AMD RDNA2 GPU-suite check of Same per-fixture results as main: every fixture all translated and pass spirv-val; main: 222/241 passed, 17 skipped, 2 FAIL ( |
|
Tested Standalone tools built with llvm-mingw 20261117 (clang, Ninja, Release,
Both non-passing results are on main too, not caused by this PR: AI-assisted (Claude Code). |
|
GPU test for this fix: #8995 adds |
…active SSA in wave64 In wave32 mode (subgroupSize 32), all lanes are in half 0, so there is no other half to preserve. Emitting OpLoad %bool %active and OpSelect with inh is unnecessary and caused an extra load caught by test_active_cache.py (test_divergent_loop_loads_active_once_per_block). Directly store on in wave32, and reuse active_b() in wave64. AI-assisted.
|
Thanks @jacob-rowlands and @lordra9-svg for catching and isolating this! Fixed in
Verified:
|
|
GPU check with #8995's fixtures: |
|
Tested Environment notes: pre-built Semantic tests:
RTX 3050 GPU verification (
|
|
Tested
Build: MSVC (VS 2022 Build Tools) RelWithDebInfo, llvm-mc 21.1.8, Vulkan SDK 1.4.363.0, |
|
Tested The new part here is #8995's fixtures on a native 64-wide subgroup. The earlier fixture runs used #8995's
The PR's words match the expected values in #8995's Full GPU suite (
PASS/FAIL/SKIP is identical fixture by fixture in all three configurations, and 247/247 translate and pass Semantic tests:
Tools: llvm-mc 23.1.6 (AMDGPU), Vulkan SDK 1.4.363.0, MSVC 19.52, Python 3.12.10. Synthetic inputs only, no game files. AI-assisted: yes (Claude Code); results reviewed by me. |
|
Tested 0e24e3b on AMD Radeon 8060S (Strix Halo, gfx1151, subgroup 32..64), RADV Mesa 26.3.1, Arch Linux container on Ubuntu 24.04.5 / kernel 7.0.0-38; LLVM 23.1.5, SPIRV-Tools v2026.4: pass.
Synthetic fixtures only, no game files. AI-assisted (Claude Code). |
|
Tested
On AI-assisted: Codex GPT-6.2 Sol ran the tests, Claude Opus 5.5 reviewed the report. Python 3.12.16, llvm-mc 21.1.8, Vulkan SDK 1.4.363.0, CMake/MSVC RelWithDebInfo. No game files used. |
|
GPU check of the new head Full
Earlier I ran Synthetic shaders only, no game files. AI-assisted (Claude Code). |
|
Tested 0e24e3b on AMD Radeon RX 5700 XT (RDNA1), Mesa RADV 26.2.5, Linux (CachyOS 7.3), i7-7700K: pass (AMD half only)
AI-assisted (Claude Code), run by a person; built and run in a sandbox without network. |
|
checked: #84240e24e3b applied onto main 867d922 (clean) | on: RX 7900 XT (RDNA3), AMD Windows 26.11.2, Windows 11 26300, Python 3.14, llvm-mc 23.1.5 | result: pass
No game files. AI-assisted (Claude Code). |
|
Tested Scope: CPU-only semantic interpreter check ( Command (via Results:
No failures at head. No game files. AI-assisted. |
What this does
When a computed non-mask scalar value was written to
exec_loorexec_hi(such as vias_add_u32,s_lshl_b32, or scalar memory loads throughGen.dst),exec_half_writetested(val != 0)which evaluated to true across all lanes of that wave half, turning on lanes that should have remained inactive.Extract each lane's corresponding bit
(val >> (rel & 31)) & 1, unifying it with the immediate constant path.Testing
tests/semantic/test_wave64_exec_half_computed.pycovering computed scalar writes toexec_loandexec_hiin wave64 mode.AssertionError: 4294967295 != 5), passes cleanly with this fix.tests/semantic/pass.scripts/check_no_game_data.py: pass.