Repository navigation
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.
…L bit L In a wave64 program (native or --wave64-emulate) a VCC written as data (s_mov_b32 vcc_lo, K / s_mov_b32 vcc_hi, K, a load into VCC) and read as a lane mask by v_cndmask_b32, a carry-in or s_and_saveexec_b64 used the raw vcc_lo word in every lane, so any non-zero vcc_lo selected all 64 lanes and vcc_hi was ignored. Gen.mask_src now gives lanes 0-31 bit L of %vcc and lanes 32-63 bit L-32 of %vcc_hi where a new dataflow pass (vcc_hi_fresh) shows %vcc_hi holds VCC[63:32] on every path; after a whole-VCC write lanes 32-63 keep reading %vcc as before. GPU test cs_w64_vcc_data with hand-derived words, semantic fixture, docs/design.md row. AI-assisted.
|
Independent RTX 5070 / Windows check at I found a mixed-predecessor case at a scalar branch join. This is separate from the straight-line whole-VCC-write-then-low-half-write limitation in the description. With s_mov_b32 s6, 2
s_mov_b32 s7, 8
s_mov_b32 vcc_lo, 2
s_cmp_eq_u32 s4, 0
s_cbranch_scc1 2
s_mov_b64 vcc, s[6:7]
s_branch 1
s_mov_b32 vcc_hi, 4
v_mov_b32_e32 v2, 1
v_cndmask_b32_e32 v3, 0, v2, vccI stored The static merge in |
|
Tested 82b48eb 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 82b48eb on an RX 9060 XT (RDNA4, GFX1200), RADV Mesa 27.0.0-devel, Nobara Linux (Fedora 44): pass This adds native wave64 on RADV and RDNA4 to the Windows RDNA2 and RTX runs already here. Setup: llvm-mc 22.1.8 and SPIRV-Tools 2026.1. The runtime was built from the PR head with GCC and pinned with
I didn't run @duudiis's branch-join case, and didn't repeat the AI-assisted (Claude Code). |
|
Tested 82b48eb (PR head, as is) on AMD Radeon RX 7900 XTX (RDNA3), AMD driver 26.11.2 (LLPC), Vulkan 1.4.359, subgroup 32..64, Windows 11 [26300.9974]: pass.
Setup: VS 2022, Vulkan SDK 1.4.341.1, llvm-mc 21.1.8 (WSL Ubuntu), harness programs built from main 4947579, no game files. Drafted with help from an AI assistant; the commands were run by me. |
|
Tested on Windows 11 with two GPUs on one machine (MSVC 14.51, llvm-mc 23.1.6): |
|
Tested 82b48eb on NVIDIA RTX 2060 (Turing, subgroup 32..32), driver 615.71.09, Ubuntu 24.04 (Docker, llvm-mc 21.1.8): pass. Adding two things not covered above:
No regressions vs main: check.py 161/165 and run_gpu_tests 172/187 emulated. |
|
Tested 82b48eb on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
Conflicts: docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py AI-assisted.
docs/design.md tools/rdna2spirv.py AI-assisted.
runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Tested 61222ee (a re-test at the new head) on AMD Radeon RX 9070 XT (RADV GFX1201, wave32/64) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-W64-VCC-DATA, #2300 (comment)
Depends on: #2206 (this branch is #2206's commit, a merge of
main, and one new commit, 82b48eb)What and why
#2206 fixed wave32: a VCC holding data, read as a lane mask, gives lane L bit L. Wave64 (native and
--wave64-emulate) still read the raw%vccword in every lane.%vccholds thevcc_loword afters_mov_b32 vcc_lo, K, so any non-zerovcc_loselected all 64 lanes, andvcc_hi(kept in%vcc_hi) was ignored. The hardware reads VCC[L] for lane L.s_mov_b32 vcc_lo, 0xa; s_mov_b32 vcc_hi, 0x30000/v_cndmask_b32_e32 ..., vccvcc_lo = 0x80000001, vcc_hi = 1/v_add_co_ci_u32_e32carry-invcc_lo = 0, vcc_hi = 0x100/v_cndmask_b32_e32vcc_lo = 0xff0000, vcc_hi = 0xf/s_and_saveexec_b64 s[8:9], vccChange (
tools/rdna2spirv.py):Gen.mask_src, wave64, VCC not certified bylane_masks.py: lanes 0-31 take bit L of%vcc(thevcc_loword, or the 0 / ~0 a missed mask left there). Lanes 32-63 take bit L-32 of%vcc_hiwhen it holds VCC[63:32]. Otherwise they read%vccas before, because a whole-VCC write (v_cmp, a carry-out,s_mov_b64 vcc, ...) puts each lane's bit there.vcc_hi_fresh(blocks, succ): a small forward dataflow pass, run next to the lane-mask analysis. It returns the instructions before which, on every path, the last write to VCC's high half went to%vcc_hi(a write tovcc_hior a 64-bit scalar load into VCC) and not to the whole VCC.--wave64-emulate: thewave_maskcache key for VCC now includes the%vcc_histore and the flag, andOpStore %vcc_hiis tracked like%vcc.lane_masks.py,Gen.dstand the half-mask write paths are unchanged (#2221 / #2352 work there). New contract row indocs/design.md, and #2206's row now points to it.Not covered:
vcc_lowritten as data right after a whole-VCC data write (s_mov_b64 vcc, s[4:5]thens_mov_b32 vcc_lo, K).Gen.dststores the word in all 64 lanes there, so lanes 32-63 keep the old behaviour. Also not covered: a wave64 VS/PS/GS on 32-wide subgroups (SHADER-10).Tested
Windows 11, LLVM 21
llvm-mc,VK_LOADER_LAYERS_DISABLE=~implicit~, one GPU at a time. New testruntime/test/shaders/cs_w64_vcc_data.asm, with the expected words derived by hand from the ISA in its header. Its out[5] (a compare) and out[7] (s_mov_b64 vccof a data pair) are controls.run_gpu_tests.py --filter cs_w64_vcc_datatools/rdna2spirv.pyfrom #2206260 1033 3 1068 10241 40 4108 80064 64 64 32 0xffffff00 40 40 800LEONIDA_W64_EMULATE=1LEONIDA_W64_EMULATE=1vcc_hi_freshsabotaged so that a write tovcc_hino longer marks%vcc_hias current (one line), the test fails on both GPUs and in the semantic test with290 1064 34 1052 0xffffff00 40 4112 800.LaneMaskConstantsintests/semantic/test_value_semantics.pyruns the fixture over 64 lanes. It checks the words against a plain-Python reference (VCC = vcc_hi << 32 | vcc_lo, lane L reads bit L) and that they differ from the old words. It fails without the change.python -m unittest discover -s tests/semantic: 2567 tests OK.python tests/semantic/regen_fixtures.py --check: clean.python -I tests/test_shader_checks.py: 60 OK.python -I tests/test_run_gpu_tests.py: 30 OK.Checklist
docs/design.md, with how it was confirmed.AI-assisted.