Repository navigation
rdna2spirv: wave32 VCC holding data, read as a lane mask, gives lane L bit L - #2206
evilclanker9000 wants to merge 5 commits into
Conversation
…L bit L s_mov_b32 vcc_lo, 0xa (or a copy of a data SGPR, or a load into VCC) followed by v_cndmask_b32 / a carry-in / s_and_saveexec_b32 on vcc_lo selected every lane: Gen.mask_src returned the raw %vcc word, so any non-zero value meant all lanes. In a wave32 program where lane_masks.py does not certify VCC as a mask, lane L now takes bit L of it, as for a data SGPR or an immediate. A real mask (0 or ~0 per lane) is unchanged. GPU test cs_w32_vcc_data (RTX 5080 and Radeon RDNA2 iGPU), semantic fixture and assertions, docs/design.md contract row. AI-assisted.
|
Tested llvm-mc 21.1.8, Vulkan SDK 1.4.363.0. Test programs built with
No game data involved. AI-assisted (Claude Code): it ran everything above on this machine. |
|
Tested 06f3e41 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested
AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine. |
docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py AI-assisted.
|
Retested the rebased head llvm-mc 21.1.8, Vulkan SDK 1.4.363.0. Test programs built with
No game data involved. AI-assisted (Claude Code): it ran everything above on this machine. |
…U under random EXEC Seeded integer VALU programs run on every lane of a wave32 or wave64 wave with EXEC rewritten between instructions: compares into SGPR masks and VCC, v_cmpx, v_cndmask on the masks, carry-out/carry-in forms, v_mad_u64/i64 with a mask carry-out, 16-bit op_sel half writes and 32-bit ops. A per-lane ISA model is compared with rdna2spirv run in tests/semantic/spirv_wave_interp.py, optionally with the hardware through tools/hw_oracle. Known divergences (VCC data read as a mask, ItsNotRexed#2206; a mask read as data, ItsNotRexed#293) only with --known. AI-assisted.
docs/design.md AI-assisted.
runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Tested Runtime and test programs built from this head (MSVC 14.51, Ninja, RelWithDebInfo), native Windows
This PR's shaders:
First RDNA4 run: AI-assisted (Claude Code); I checked the results. |
|
Tested
No game files. AI-assisted (Claude Code). |
docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Tested Verified For the carry-in case I cleared bit 0 of VCC, changing AI-assisted verification. AI-assisted verification. |
|
Tested 66c412c merged onto main 561b65a (clean merge) on Apple M4, macOS 27.2.1, MoltenVK 1.4.2, Python 3.15.2 and 3.12.16: pass
AI-assisted. |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-VCC-DATA-MASK, #1902 (comment)
What and why
In a wave32 program, VCC that holds plain data (
s_mov_b32 vcc_lo, 0xa,s_mov_b32 vcc_lo, s5from a data SGPR, a load into VCC) and is then read as a lane mask selected every lane.Gen.mask_srcalready takes bit L of a data SGPR and of an immediate, but its VCC branch returned the raw%vccword, so any non-zero value meant "all lanes on". The hardware reads VCC[L] for lane L.mains_mov_b32 vcc_lo, 0xa/v_cndmask_b32_e32 v8, 0, v21, vcc_los_mov_b32 vcc_lo, 0x80000001/v_add_co_ci_u32_e32carry-ins_mov_b32 vcc_lo, 0xff0000/s_and_saveexec_b32 s7, vcc_loChange (
tools/rdna2spirv.py,Gen.mask_src): in a wave32 program, whenlane_masks.pydoes not certify VCC as a mask, lane L takes bit L of%vcc. A real mask is unchanged: it holds 0 or ~0 per lane, and bit L of that is the same 0 or 1. Wave64 is left as it was (lanes 32-63 would need%vcc_hiand a SHADER-10 tier); VCC read as data is #293's direction and not touched. This does not touch the SGPR / SOP2 parts of #1792.Found by a scratch whole-wave differential checker (integer VALU, carry ops, compares and
v_cndmaskunder random EXEC, translator +tests/semantic/spirv_wave_interp.pyagainst an ISA model).New contract row in
docs/design.md.Tested
Windows 11, LLVM 21
llvm-mc,VK_LOADER_LAYERS_DISABLE=~implicit~, one GPU at a time:run_gpu_tests.py --filter cs_w32_vcc_data258 1032 2 1052 0xffffff00 5 4104 78132 32 32 32 0xffffff00 5 32 32runtime/test/shaders/cs_w32_vcc_data.asm(wave32 dump, expected words derived from the ISA in its header), registered incheck.pyandrun_gpu_tests.py, and as atests/semanticfixture:LaneMaskConstantsintest_value_semantics.pychecks the words and a plain-Python derivation of them; it fails onmainwith the old words.tools/rdna2spirv.pyfrommain(table above).python -m unittest discover -s tests/semantic: 1671 tests OK (2 skipped).python tests/semantic/regen_fixtures.py --check: clean.python -I tests/test_shader_checks.py: 60 tests OK.Checklist
docs/design.md, with how it was confirmed.AI-assisted.