Repository navigation
wave64_halves: a vote on a scalar compare under whole-quad EXEC is no lane vote (SHADER-W64-WQM-UVOTE) - #1091
Conversation
…r (SHADER-W64-SDST-PAIR) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… lane vote (SHADER-W64-WQM-UVOTE) A pixel shader that needs derivatives starts with s_wqm_b64 exec, exec, and LLVM branches on wave-uniform conditions inside that region as it does anywhere: v_cmp_* sN of scalars, s_and_b64 vcc, exec, s[N:N+1], s_cbranch_vccnz. SHADER-10 took that for no lane vote only while EXEC was the launch mask, so here it was unsafe-vote-branch. A compare of immediates and scalars is the same in every lane, so its mask is every lane of EXEC or none; the whole quads of the launch mask have a lane in every 32-lane half that runs (a quad never straddles the halves). The analysis carries "EXEC is the whole quads of the launch mask" as a dataflow fact, set by s_wqm_b64 exec, exec under the launch mask and dropped by every other EXEC write. VGPR sources stay refused there, and so does a path on which a scalar was read out of a uniform VGPR from a lane the launch mask may not have written. Corpus (1.0.2.1, all 26,503, on top of SHADER-W64-SDST-PAIR): 452 pixel shaders go from tier C to A, none moves the other way: C 7,741 to 7,289. Tests: tests/semantic/test_wave64_halves_wqm_uvote.py; GPU fixture ps_w64_a_wqm_uniform_vote (RTX 4070 Ti, 620.70.06). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Reviewed and verified. Precise analysis in ools/wave64_halves.py recognizing that under whole-quad EXEC (s_wqm_b64 exec, exec), scalar comparisons evaluate identically across quads without lane divergence, safely promoting 452 pixel shaders from Tier C to Tier A without false positives. Validated with ests/semantic/test_wave64_halves_wqm_uvote.py (18/18 PASS) and semantic test runner. 100% clean-room compliant.
|
Tested
AI-assisted: yes |
Brings the branch up to date with main 68d1331. No conflicts; the merged tree was tested before the push (every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since ProjectLeonida#930). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Merged. Checked locally on
For #805, which now conflicts in
#187 and #1320 get an easy AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5). |
|
Hardware follow-up on the gap this PR's row records.
I have a card that can draw the 64-lane image. Here is the measurement, on DeviceAMD Radeon RX 6900 XT — RDNA2 / GFX1030, Navi 21, PCI 1002:73bf. RADV NAVI21, Mesa 26.2.4, Vulkan 1.4.354 (conformance 1.4.5.3).
|
Item: SHADER-W64-WQM-UVOTE
Depends on: #1021 (its commit is the first one in this branch; only the second is this change)
A pixel shader that needs derivatives starts with
s_wqm_b64 exec, exec. LLVM branches on wave-uniform conditions inside that region the way it does anywhere:v_cmp_* sNof scalars,s_and_b64 vcc, exec, s[N:N+1],s_cbranch_vccnz. SHADER-10 took that for no lane vote only while EXEC was the launch mask, so under the whole quads it was tier Cunsafe-vote-branch.Why it is exact
What stays tier C
s_wqm_b64: a half can be empty.s_wqm_b64 exec, execis modelled.v_readlane_b32, orv_readfirstlane_b32while EXEC is not the launch mask).Corpus (1.0.2.1, all 26,503,
wave64_halves.analyseon every wave64 VS/PS/GS)Baseline is #1021 on
main3ed8e50b7. Without #1021 the listings' one-register destinations hide the vote behindtainted-branch.452 pixel shaders go from C to A. No shader moves from A or B to C, and no vertex or geometry shader moves.
unsafe-vote-branch7,362 -> 6,861,tainted-exec5,829 -> 5,793,stale-scalar3,287 -> 3,254.Tested
tests/semantic/test_wave64_halves_wqm_uvote.py(new, 18 tests): the accepted forms in both printed forms of the destination, ten near misses that stay tier C, and a vertex and a pixel shader run on the wave interpreter as one wave of 64 lanes and as two of 32, equal and equal to the derived words. With rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) #1021 alone 14 of them fail.ps_w64_a_wqm_uniform_votethroughruntime/test/shaders/w64_graphics.pyon an NVIDIA GeForce RTX 4070 Ti, Linux, driver 620.70.06, subgroup 32 only: the words its header derives. That device has one subgroup size, so the 64-lane image was not drawn, and the full-screen draw has no partly covered quad. It confirms the translated SPIR-V against the ISA reference, not native RDNA2 behaviour.python -I scripts/run_semantic_tests.py tests/semantic: 472 files, 6,186 tests, 0 files failed.tests/test_wave64_halves_fixtures.pyand thetest_w64_graphics*.pyfiles: 22 passed.Overlap
#805 edits the same lines of
uniform_cmpand the state dict. It handles EXEC after it is put back from whole quads; this handles the compare under them. They merge by hand; whichever lands second needs a rebase.No game data: counts and opcode names only. AI-assisted (Claude Code).
🤖 Generated with Claude Code