Conflict in docs/design.md: this branch rewords the "Wave64 graphics: partition invariance
(SHADER-10)" row; main left that row as it was and added the SHADER-W64-WQM-UVOTE row after it.
Kept this branch's SHADER-10 row and main's new row below it. runtime/test/shaders/w64_graphics.py
merged without conflicts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Check partition-invariant words against the fixture expectation even when both widths or the saved reference share the same wrong value. Reject an invalid single-width draw before it can replace a reference.
Reproduced with synthetic fragment readbacks on Windows on an RTX 3070 and Intel Arc Graphics. Codex-assisted.
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>
Combines old upstream PR 7354 into this change: the wave64 and wave32 VS
waves start at vertices 0, 64, 126, 190 ... and 0, 32, 64, 96, 126 ...,
and on an RX 9070 XT (GFX1201, RDNA4, RADV Mesa 26.2.6) every wave32 wave
lies inside one half of a wave64 wave, measured on GFX1201 by sperm in
old upstream PR 7354. Both "GFX12 not measured" clauses now cite that
measurement.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vs_w64_c_lane_id over 960 vertices on RADV Mesa 26.3.1 gives the same
packing on a gfx1036 iGPU (Raphael) and an RX 7900 XTX (NAVI31, RDNA3):
waves of 64, 62, 64, 62 ... at wave64 and 32, 32, 32, 30 ... with
gewave32, a period of 126 vertices both ways, and every vertex's wave32
lane equal to its wave64 lane & 31. So the 32-lane run is the cut into
halves, not "a repacking ... a stricter test". Say what was measured,
on which devices, and note the lane ^ 2 trap for new VS fixtures.
Found by sskver. w64_graphics.py: 29/29 ok on both GPUs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A draw that hung past subprocess.run's 120 s timeout raised TimeoutExpired out
of main(), so a multi-fixture run ended in a traceback and never reported the
fixtures after it. main() now reports "vk_harness timed out after 120 s" for
that fixture, goes on, and still exits 1. The test drives main() and check()
with a vk_harness that times out on its first call.
Fixes old #9764
A wave64 pixel shader that kills pixels with `s_andn2_b64 live, live, exec/vcc` and branches with
`s_cbranch_scc0` to a block that only empties EXEC from that mask, exports and ends was tier C
unsafe-vote-branch. It is exact on 32-wide subgroups: a half whose live mask is empty writes nothing in
the exit and discards its pixels, and in the wave its lanes stay off to the end.
The rule accepts it only when:
- the branch tests the mask's own "not empty": the last SCC writer is a 64-bit logic op into that mask
(or s_cmp_lg_u64 mask, 0) and nothing rewrites the mask before the branch (or vccz/vccnz);
- the exit only sets EXEC from that mask (or 0), exports and ends: no other code, store or successor;
- the run side narrows EXEC into the mask's whole quads before anything but mask arithmetic runs and
keeps it inside on every path, loops included (a must-dataflow over narrowings and copies, unions and
s_wqm of registers known to be inside);
- no `exp ... vm` can run before the vote (a latched vm export would keep the pixels alive in the wave).
Also: s_mov_b64 / s_cselect_b64 of a lane mask no longer tag SCC as a vote on their destination (they
do not write SCC); the branch could take a lane-count compare for a vote and come out tier A.
Tests: classification of the kill (wqm + s_and, v_cmpx + s_mov, direct s_and / s_mov / s_wqm exec,
exit through exec 0, an if/endif after it) and near misses (exit with code, a store, an SGPR write,
another mask, a jump back; a run side that does not narrow or widens again; the mask rewritten after
the vote; SCC = mask == 0; a vm export before the vote; a shared exit), and 64 vs 2x32 vertex runs.
GPU fixture ps_w64_a_discard: RX 580 (RADV, required size 64) and RTX 5070 (32, against the 580
reference) equal the derived words.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured by kapitche: Intel UHD 770 reports gl_SubgroupSize 32 in the fragment stage but runs 16 live invocations, so tiers A and B (32 or 64 live lanes) cannot hold. The skip keeps its condition (minimum subgroup below 32); deriving it from a measured live width is a follow-up.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reporter corrected the probe: Intel UHD 770 reports a subgroup size of 32, so its tier A failures have an unknown cause and must not be skipped; only a device whose largest subgroup is below 32 (llvmpipe) is.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Intel UHD 770 reports fragment subgroup 8..32 but runs pixel shaders 16 wide and cannot be held to 32, so reads
across 16 lanes (permlane, swizzle, bpermute) fail there. Tiers A and B mean exact on 32- or 64-lane subgroups.
The SHADER-10 row also loses the stale text the merge of #2260 left in it: the pre-TEST-319 A list (bpermute and
permlane "not GPU-tested here"), "Corpus coverage is not measured here", "the corpus ones are wave32", "geometry
shaders are not tested" and a repeated sentence, which the census and the GS fixtures (TEST-251) now contradict.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rdna2spirv maps a legacy GS's LDS write to an output slot from its
offset alone and drops the VGPR address (the lane's GSVS area), but
wave64_halves read that address as the store's data, so a GS whose lane
id only forms its GSVS base was tier C lane-id. It now checks only the
data operands of a GS ds_write.
w64_graphics.py draws gs_w64_a_ring and gs_w64_c_lane_id at wave64 and
wave32 (RADV_PERFTEST=gewave32), build.py builds gs_* fixtures with
gs_tri's signatures, docs/testing.md explains how to run and extend the
wave64 graphics checks, and docs/design.md records the rule and that the
corpus GS are written for wave64. Checked on an RX 9070 XT (GFX1201) and
a Ryzen 9800X3D iGPU (GFX1036), RADV Mesa 26.3.1: 23/23.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ps_w64_a_permlane, ps_w64_a_swizzle and ps_w64_a_bpermute check v_permlane16/x16, ds_swizzle
(quad-permute, swap, broadcast) and ds_bpermute in a wave64 pixel shader with words that only
depend on the 2x2 quad layout of fragment lanes. They give the derived words on an RTX 5070.
wave64_halves.py called a ds_bpermute/ds_permute whose address comes from the lane id tier C
(lane-id). The id is 0..63 in the wave and 0..31 in a half, equal modulo 32 lanes, and a wave64
permute uses address bits 2..6 of its half only, so an address that is the same modulo 128
bytes reads the same lane. The classifier now tracks that modulus through sums, differences,
bitwise ops with invariant values and left shifts; shifts by less than 2, right shifts and the
low count alone stay tier C. Classification and wave-interpreter tests (64 lanes against two
waves of 32) cover the rule and its near misses.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RADV runs the VS stage as wave64 by default and as wave32 with
RADV_PERFTEST=gewave32, so w64_graphics.py now draws seven vs_w64_*
fixtures (tiers A, B and C) both ways and compares the words each vertex
stores to the heap. vs_w64_c_lane_id is the probe that the wave size
changed. vk_harness gets VKH_VERTICES to draw enough vertices to fill
waves. Checked on an RX 9070 XT (GFX1201) and a Ryzen 9800X3D iGPU
(GFX1036), RADV Mesa 26.3.1: 21/21.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/wave64_halves.py classifies each wave64 VS/PS/GS by partition
invariance: A exact as translated, B exact by construction (waterfall loops,
wave-aggregated atomics up to slot order, readfirstlane/readlane of values
that are the same in every lane), C not exact (lane counts/ranks/ids,
readlane of varying data, stale scalars behind votes, masks as data, ...).
index.json gets wave64_graphics, wave64_graphics_reasons and
wave64_graphics_idioms; --wave64-graphics warn|error|off (error refuses
tier C). One rewrite: readlane of a proven-uniform VGPR reads the own copy.
--census prints tier counts from an index.json. ps_w64_* fixtures,
w64_graphics.py (fragment subgroup size required 64 vs 32) and semantic
tests; vk_harness gets VKH_HEAP_DUMP and a subgroup-size report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>