Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 9eee64d8 on Windows 11:
tests/semantic/test_wave64_halves_readlane_uniform.py-> 2 tests, OK: a uniform VGPR (v_mov_b32_e32 v5, s4) with a tainted selector (s_ff1_i32_b64 s6, exec) is tier B with thereadlane-uniformidiom and no reasons; a varying VGPR keeps tier C withfirst-lane.tests/test_wave64_halves_fixtures.py-> 6 passed, 1 skipped; the newps_w64_b_readlane_uniform_lane.asmis registered inw64_graphics.pyand the fixture list.tests/semantic/test_wave64_halves.py-> 57 tests, OK.git diff --checkclean.
The reasoning holds: the check already requires the source VGPR to be in the uniform set, so every lane holds the same value and the selector — even one derived from first-lane/lane-count/lane-id — cannot make the two 32-lane halves differ. Dropping not tl only affects that uniform case, and the varying case stays tier C. No blocking issue.
whattheflop
left a comment
There was a problem hiding this comment.
AI-assisted Windows CPU check at 9eee64d8 against direct parent 6a6704df and GitHub base d0835dd9, uv CPython 3.12.13. Eight synthetic fragment and vertex cases used valid selectors 0, 31, 32, and 63. They changed from Tier C with a shuffle on both comparison commits to Tier B without a shuffle. For each validated module, all 64 outputs matched the hand-derived result in a CPU-modeled wave64 and two wave32 halves. A separate selector probe confirmed the split really changed the selector to 32, 63, 0, and 31 respectively.
The vertex tests also left the uniform source untouched while EXEC narrowed and restored it before the read. An otherwise comparable branch that overwrote the source under narrowed EXEC stayed Tier C with the shuffle. A separate tainted-source control also stayed Tier C. Three stock fixture modules translated and validated with LLVM 21.1.8 and SPIRV-Tools. CPU interpretation only for the independent cases.
ligmaSec
left a comment
There was a problem hiding this comment.
I found two regressions from widening the rewrite at 9eee64d8. Both also reproduce with this change applied to main d0835dd9. The selector can be irrelevant when the source is truly uniform. These cases expose two ways the current analysis can incorrectly mark the source uniform.
Masked write after v_cmpx. In a wave64 vertex shader, seed v4 to 99 and then put 42 in the first 32 lanes.
s_mov_b64 s[10:11], exec
v_mov_b32_e32 v4, 99
v_mbcnt_lo_u32_b32 v10, -1, 0
v_mbcnt_hi_u32_b32 v10, -1, v10
v_cmpx_gt_u32_e32 32, v10
v_mov_b32_e32 v4, 42
s_mov_b64 exec, s[10:11]
s_ff1_i32_b64 s8, exec
v_readlane_b32 s9, v4, s8Export s9 through a VGPR. On the 64-lane interpreter, the correct result is 42 on every lane. Main gives that result. This head marks the shader tier B, replaces the shuffle, and gives 99 on lanes 32–63. The same regression occurs with e64 v_cmpx and with s_bcnt1_i32_b64 as the selector on a full 64-lane wave. Applying #4585 restores all four cases.
Partial destination write. Replace the write sequence with v_lshlrev_b32_e32 v4, 8, v0, s_mov_b32 s4, 7, then v_mov_b32_sdwa v4, s4 dst_sel:BYTE_0 dst_unused:UNUSED_PRESERVE src0_sel:DWORD. With vertex index in v0, the upper bits still vary. The same first-set selector should read lane zero's 7 on the full 64-lane wave. This head returns 263 on lane 1 and 8199 on lane 32. An analogous WORD_0 case fails too. #4585 alone leaves these two failures. Applying #4373's destination tracking restores both.
I applied both fixes plus this change to main. All six cases retained the shuffle, returned the correct native wave64 words, and passed spirv-val. The PR's two new tests and all 73 existing wave64-halves tests passed with that stack, including the intended uniform-source case.
I also drew a 64×64 fragment variant of the first case on llvmpipe (LLVM 19.1.7, subgroup size 8). Applying this change alone altered 2,000 red-channel values from 2.0 to 1.0. With both fixes, the entire framebuffer matched main byte for byte.
Please stack this change on #4585 and #4373 or add equivalent source-uniformity guards before merging. Synthetic programs only. AI-assisted.
|
PASS. The reasoning is sound: Three docs/body fixes: Approve with those. AI-assisted review, no game files, no GPU. |
|
Tested
llvm-mc 20.1.2. No game files. Tested and written by Claude (Claude Code), posting from @theswiss24's account. |
|
Tested head
AI-assisted (Devin). |
Summary
Bounded SHADER-314 case in
tools/wave64_halves.py:v_readlane_b32 d, v_src, lane, whenv_srcis proven uniform across all lanes (vr in st["u"]), the read result is identical across 32-lane halves even if thelaneselector is tainted (for example, derived froms_ff1_i32_b64,s_bcnt1_i32_b64, or lane-id arithmetic), because every lane holds the same value inv[vr]andtools/rdna2spirv.pyrewritesuniform_readlaneto read the lane's own copy (OpCopyObject).tools/wave64_halves.pyto classifyv_readlane_b32of a uniform VGPR asreadlane-uniform(preserving any taint onv_srcitself) regardless oflanetaint.ps_readlane_uniform_tainted_lane-> TierB,readlane-uniform) and negative-control (ps_readlane_varying_tainted_lane-> TierC,first-lane) regression tests intests/semantic/test_wave64_halves_soundness.py.runtime/test/shaders/ps_w64_b_readlane_uniform_lane.asm(registered inruntime/test/shaders/w64_graphics.pyandtests/test_wave64_halves_fixtures.py).Verification
Tested on NVIDIA GeForce RTX 3070 (driver
621.24/32.0.16.2124, Windows 11, subgroup32..32,llvm-mc 23.1.6,SPIRV-Tools v2026.4):python -I tests/semantic/test_wave64_halves.py: 73/73 OKpython -I tests/semantic/test_wave64_halves_soundness.py: 30/30 OKpython -I runtime/test/shaders/build.py <work> vs_ids ps_w64_b_readlane_uniform ps_w64_b_readlane_uniform_lane:3 shaders: 3 translated, 3 pass spirv-val(wave64 VS/PS/GS on 32-wide subgroups: tier B: 2)python -I runtime/test/shaders/w64_graphics.py <work> runtime/build/vulkan ps_w64_b_readlane_uniform ps_w64_b_readlane_uniform_lane: both B okLEONIDA_W64_EMULATE=1 LEONIDA_TEXOFF_FALLBACK=1 python -I scripts/run_gpu_tests.py --build runtime/build/vulkan --require-pass: 195/210 passed, 15 skipped, 0 failedNo game data. AI-assisted.