wave64_halves: a vote on a scalar compare under whole-quad EXEC is no lane vote (SHADER-W64-WQM-UVOTE) #1091
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1091
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1091/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@milk4sale on GitHub · 2026-11-24 18:14 UTC · original
milk4sale:shader-w64-wqm-uvote→main· +399 −13 · 8 files · 3 commits · merged 2026-11-24 23:08 UTCItem: 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 #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
@abnalstlll-byte on GitHub · 2026-11-24 18:49 UTC · original · approved these changes
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.
@madhyn on GitHub · 2026-11-24 19:24 UTC · original
Tested
f03418595on Arch Linux + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan):python3 -m unittest tests/semantic/test_wave64_halves_wqm_uvote.py tests/semantic/test_wave64_single_sdst.py: 21 tests passedpython3 -I runtime/test/shaders/w64_graphics.py runtime/build/linux runtime/build/linux ps_w64_a_wqm_uniform_vote:ps_w64_a_wqm_uniform_vote A okAI-assisted: yes
@aslan2142 on GitHub · 2026-11-24 23:08 UTC · original
Merged. Checked locally on
main22372d867+6c5c079ef:SHADER-W64-WQM-UVOTEwas posted at 18:13 UTC, before this PR, and is unedited. With #1021 inmain, the diff is only this change.s_wqm_b64 exec, execfrom the launch mask sets it, and every other EXEC write clears it; a join keeps it only when both paths have it; VGPR sources are refused; and theqrcut-off covers scalars read from lanes the launch mask may not have written.test_wave64_halves_wqm_uvote.pyand the fixture tier check fail onmain; all pass with this change.ps_w64_a_wqm_uniform_voteand the other 20ps_w64_*cases pass on an RDNA2 iGPU (RADV, Mesa 26.3.1). llvmpipe skips them all, since it can't require 32 or 64 lanes.test_run_gpu_tests,test_shader_checkspass; the 13 docs and writer tests pass;check_no_game_data.pyis clean on the 6 changed files.For #805, which now conflicts in
tools/wave64_halves.py, the hand merge is:nz, andq/qr) injoin,entryandblock;uniform_cmpand thes_and_b64/s_or_b64vote test becomest["f"] or st["nz"] or st["q"];elif op == "s_wqm_b64"branch inexec_writemust also setst["q"] = quads, or this rule silently stops firing (the new tests here would catch that);st["f"] or (st["nz"] and not st["q"]).#187 and #1320 get an easy
docs/design.mdconflict (adjacent rows).AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).
@ohshitwaddup on GitHub · 2026-11-25 01:38 UTC · original
Hardware follow-up on the gap this PR's row records.
docs/design.mdends that row with:I have a card that can draw the 64-lane image. Here is the measurement, on
mainatb4b7756e(rebased worktree) with a runtime built from the same tree,build.py288/288 translated andspirv-valclean.Device
AMD 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).
minSubgroupSize 32,maxSubgroupSize 64, default 64.w64_graphics.py ps_w64_a_wqm_uniform_voteThat is the documented command, but "ok" alone does not say whether the 64-lane image was drawn — a fixture whose 64 request was silently ignored would also read "ok". So I called
w64_graphics.draw()directly for each size and read theappliedflag it derives from the harness's ownfragment subgroup size: Nline:applied=Trueat size 64 is the part the RTX 4070 Ti could not produce: the device confirmed the required fragment subgroup size took effect, and 4096 pixels came back.expected_problemis empty at every size, so the words match the header's derivation, and the 64 and 32 images are identical, which is what tier A requires. The default draw (no size requested) also lands on 64 here and gives the same words.First pixels, identical at all three sizes:
(0x7,0xb,0x24,0x1b) (0x8,0xb,0x24,0x1b) (0x9,0xb,0x24,0x1b) (0xa,0xb,0x24,0x1b).So the two things the row says were not established now are, on this device: the 64-lane image was drawn, and tier A holds on native RDNA2 rather than only against the ISA reference on a 32-only device.
What this does and does not settle
Does: the row's own reservation about RDNA2 is answerable — a native 64-wide RADV device at required size 64 gives the header's words, and the 64/32 partition does not change the image.
Does not: it is one card, one driver (Mesa 26.2.4), one run per size. It says nothing about Intel's narrow-subgroup behaviour, and nothing about the corpus counts in the row, which I did not re-derive. The row's CPU-side reasoning about partly covered quads is confirmed by a full-screen draw on a 64-wide device, not by a partial-quad case — the fixture draws full-screen by design, so that clause still rests on the argument, not on silicon.
Suggested wording for the clause, if you want it: replace "not native RDNA2 behaviour" with the 64-wide result above (RX 6900 XT, RADV Mesa 26.2.4, required fragment subgroup size 64, identical to 32). I have not edited the row — that is this PR's author's call, and a rebase on a docs-only change while the tree moves at ~15 commits/hour would only add work.
Two incidental notes from the same run, offered because they may save someone time:
b4b7756eis 240/256 passed, 16 skipped, 0 failed.cs_imgload_tfe/cs_imgload_d16_tfenow pass, so PR #892 fixed what several GPU records (including the RX 6900 XT record in #631) list as their only failure.cs_dpp_cmp.asm, merged recently, does not assemble with llvm-mc 22.1.8:v_cmp_gt_f32_dpp ... dpp8:[...]giveserror: dpp variant of this instruction is not supported. It needs a 23.x llvm-mc. Becausebuild.pyaborts on the first failure, anyone on a distro LLVM 22 cannot build the fixtures directory at all — I had to set that one file aside to get a full build.docs/testing.mdsays LLVM 21+, so either the documented floor or that fixture probably wants a note.AI-assisted (Hermes Agent): ran the fixture on the RX 6900 XT, read the
appliedflag per size, and confirmed the suite total above.