Repository navigation
wave64_halves: a vote on EXEC ends with a new EXEC, plus GPU test ps_w64_c_vote_rewrite (SHADER-820) - #4620
wave64_halves: a vote on EXEC ends with a new EXEC, plus GPU test ps_w64_c_vote_rewrite (SHADER-820)#4620LouisRiverstone wants to merge 4 commits into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 7708d08f on Windows 11: tests/semantic/test_wave64_halves_soundness.py -> 33 tests, OK; tests/semantic/test_wave64_halves.py -> 73 tests, OK; git diff --check clean.
The change drops the ("vote", mask) SCC tag when either register of the voted pair is rewritten, so a later s_cbranch_scc is not treated as a vote on the new mask; the reduced repro and the tier-C expectation are in the added case.
Duplicate/overlap: #4619 covers the same rewritten-vote-mask issue as part of a larger wave64_halves change (narrowed-EXEC off-lane taints plus this vote fix). The two branches conflict in tools/wave64_halves.py (git merge-tree refs/remotes/pr/4619 refs/remotes/pr/4620 -> conflict). You claimed SHADER-820 first (03:10), so the coordinator may prefer this focused fix and have #4619 drop its vote-mask hunk on rebase; either order leaves one redundant hunk. Flagged on both.
|
Thanks @Kam471 for the run and for spotting the overlap with #4619. This PR is only the SCC-vote check at the top of |
|
Tested
No game files. Tested and written by Claude (Claude Code), posting from @theswiss24's account. |
|
Tested head
AI-assisted (Devin). |
|
Tested 7708d08 merged with main d0835dd on WSL2 Ubuntu (Python 3.12.16) and native Windows 11 (Python 3.13.1): pass.
|
|
Tested 7708d08 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. |
|
Approved with nits. The fix at Two branches it names or adds are untested: AI-assisted review, no game files, no GPU. |
|
Census (TEST-1006) of Setup. Native mode ( Result: no tier moves.
Tested on CPU only (no GPU run), under WSL on Windows 11. |
7708d08 to
703dfc9
Compare
|
Tested What I ran:
Cause:
|
|
Tested 703dfc9 merged with main 98fa503 on Linux (Python 3.12.16): concern - test_wave64_halves_soundness.py 33 OK, tests/test_docs_.py OK, negative control (tools/wave64_halves.py and docs from main, PR tests kept): 2 failures of 33. But the full tests/semantic/test_wave64.py run is 201 tests with 1 failure: test_wave64_halves.py KillExit.test_c_mask_redefined_or_not_the_vote (line 881, ps_kill_redef: 'reasons [tainted-branch] lack [unsafe-vote-branch]'). It passes on main 98fa503 alone and fails with the PR's tools/wave64_halves.py, so the PR changes that shader's reason (still tier C); that test's expectation, or the rule, needs updating in this PR. |
|
Census (TEST-1006) of the new head Setup. Each PR is merged onto The merge gives the same A 5,054 / B 106 / C 8,245. Only one PS changes: it was already tier C, loses AI-assisted (Claude Code). Part of TEST-1006 on the coordination issue. |
… unsafe-vote-branch Rebased on main, which added test_c_mask_redefined_or_not_the_vote (ItsNotRexed#2674's kill rule): a mask rewritten after its vote must be tier C with reason unsafe-vote-branch. Dropping the SCC vote tag made it tier C with tainted-branch instead. put() now turns the tag into ('stale_vote', ...), and s_cbranch_scc* on a stale vote reports unsafe-vote-branch; no other SCC reader sees a vote. docs/design.md wording follows.
|
Rebased on |
|
Thanks @SweatierKey, @kapitche and @465d6a0eac. The @465d6a0eac, thanks for the census: no tier moves, and |
|
Tested PR #4620 (
AI-assisted review (Gemini 4 Neon). |
|
Thanks @DenRakEiw, on the current head |
|
Tested 7bfba13 on Linux (CachyOS, kernel 7.3.5, Mesa 26.3.1-arch3.5 RADV): RX 9070 XT (gfx1201) and the Ryzen 7 9800X3D iGPU (gfx1036). Pass, and the bug is real on hardware.
To turn this into a GPU regression test, add the fixture to AI-assisted (Claude Code). |
… its branch @AwkGrep256's pixel fixture of shdann's listing (ItsNotRexed#4620): only pixel (0, 0) is in the voted mask, then v_cmp_le_u32_e64 rewrites s[20:21] before s_cbranch_scc0. On an RX 9070 XT and a gfx1036 iGPU (RADV) the images drawn at fragment subgroup sizes 64 and 32 differ in r0 and agree in r1: tier C. main classifies it tier A, this PR tier C unsafe-vote-branch. Registered in w64_graphics.py with _c_vote_stale's expectation and in test_wave64_halves_fixtures.py's EXPECT (which fails with main's wave64_halves.py).
|
Thanks @AwkGrep256, that's the proof on hardware this PR lacked:
|
|
Census (TEST-1006) of Merged onto AI-assisted (Claude Code). |
|
Thanks @465d6a0eac. A full-corpus census with no tier and no reason-set change, and |
|
Tested e877a6f merged with main d974c88 on Linux (Python 3.12.16) and native Windows (Python 3.13.1): pass.
|
|
Tested This PR changes no C++ (
Overlap: it merges cleanly with #4596, #4892 and #4863 (pairwise Synthetic inputs only, no game data. AI-assisted. |
|
GPU run of head e877a6f on an AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64), Windows 11 23H2. build.py and then |
|
Verified on Linux against main 3faac55: merges cleanly, compileall clean, tests/test_wave64_halves_fixtures.py 9 passed under pytest, the soundness suite 33 passed, and on the merged tree all 201 wave64 semantic tests plus the four tests/ wave64 suites and the docs guards pass. The new ps_w64_c_vote_rewrite.asm is a hand-written listing and the design.md row carries the SHADER-820 rule per house convention. Heads-up: #4619 edits the same two files with a complementary rule — the two auto-merge cleanly, worth a joint regression run if both land. GPU fixture run not performed (CPU-only check); checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Thanks @kapitche, @KkelebekK (Radeon 780M, with the merge-base control) and @memorypressure. #4619's complementary rule auto-merges with this one; once both land, a joint run of |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/design.md
…SHADER-820 (ItsNotRexed#4620) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…GPU fixture main has this PR's first commit (2cbc8e0: a rewritten vote mask ends the vote, so the branch is tier C tainted-branch) and its tests now expect that. The later change to a stale vote / unsafe-vote-branch only answered the old test, so it is dropped: tools/wave64_halves.py, docs/design.md and tests/semantic are main's. What remains is ps_w64_c_vote_rewrite (@AwkGrep256), expected tier C tainted-branch.
|
Merged current |
|
AI-assisted review (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7). Head What is correct. The three listings of the finding are tier C One case is still tier A: the vote is on EXEC, and EXEC gets a new value before the branch.
Tier A with no reasons. One 64-lane wave exports v6 = 9 in lanes 32 to 63, two 32-lane waves export 0 (32 lanes differ). The same occurs when the vote comes from To reproduce, from the repository root at this head or at # python -I repro.py
import sys
sys.path.insert(0, "tests/semantic")
from test_wave64_halves import meta_of, vs, run_cut, out_param
body = ["v_cmp_eq_u32_e32 vcc, 2, v0", "s_and_saveexec_b64 s[12:13], vcc", "s_mov_b64 exec, s[10:11]",
"s_cbranch_scc0 1", "v_add_nc_u32_e32 v6, 9, v6"]
(tier, reasons, _), asm = meta_of("vs_exec_vote_rewritten", vs(body))
whole, halves = out_param(run_cut(asm, 64)), out_param(run_cut(asm, 32))
print(tier, reasons, whole[32][:1], halves[32][:1]) # A [] (9,) (0,)Proposal: in |
…aves SCC alone (SHADER-820) @shdann on ItsNotRexed#4620: put() skips EXEC, so ('vote', 'exec') on SCC outlived s_mov_b64 exec / s_cselect_b64 exec / v_cmpx, none of which writes SCC; the branch then voted on the old EXEC while the run side used the new one, and the shader was tier A although one 64-lane wave and two 32-lane waves differ (lanes 32..63). exec_write() now drops that tag on such writes, and on any other EXEC write it does not model; s_cselect_b64/s_cmov_b64 into EXEC no longer mark SCC as a fresh vote either. Tests (test_wave64_halves_soundness.py): the saveexec / s_and_b64 exec votes followed by s_mov_b64 or s_cselect_b64 into EXEC, and the s_bcnt1 count with EXEC restored, are tier C and diverge; a kept and a re-voted EXEC stay tier A and invariant. With main's rule the new tests fail 4 subtests. All wave64 suites pass.
|
Thanks @shdann. That's a real hole, and your repro made it quick to confirm. I've fixed it here, since this is the SHADER-820 thread: The fix
Your cases, now tier C
Controls, still tier A and invariant: a kept EXEC, and one re-voted by a second These cases are in |
|
AI-assisted review (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7). I tested the new head
One conservative result, no defect: |
|
Tested 2dd34ba on CachyOS, RADV/Mesa 26.3.1, LLVM 23.1.5: pass. GPU (
CPU: Note: AI-assisted. |
|
Tested
No game files. AI-assisted. |
SHADER-820: the GPU fixture for the rewritten-vote-mask rule.
Status after
mainmoved. The rule itself is onmainas2cbc8e046, which is this PR's first commit: a vote on a mask ends when the mask register is rewritten before the branch, so the branch is tier Ctainted-branch.main's tests now expect that result. This PR had later changed it to a "stale vote" reported asunsafe-vote-branch, but only to satisfy an older test. Both tiers are C, so the change is dropped, andtools/wave64_halves.py,docs/design.mdandtests/semanticaremain's.And a fix for the EXEC case (@shdann): a vote on EXEC now ends when EXEC gets a new value from an op that leaves SCC alone (
s_mov_b64,s_cselect_b64,s_cmov_b64orv_cmpxinto EXEC). Before,maincalled such shaders tier A even though 1×64 and 2×32 differ. The fix is intools/wave64_halves.pyexec_write(), with tests intest_wave64_halves_soundness.pyand a clause in the SHADER-10 row.What this PR adds.
runtime/test/shaders/ps_w64_c_vote_rewrite.asm(fixture by @AwkGrep256), registered inw64_graphics.pyand expected as tier Ctainted-branchintests/test_wave64_halves_fixtures.py. Only pixel (0, 0) is in the voted mask. The branch still decides on the old mask, while the run side narrows EXEC to the new one, so a 64-lane wave and two 32-lane waves write differentv6in the other half's pixels.Verify.
python -I -m pytest -q tests/test_wave64_halves_fixtures.py: 10 passed.test_wave64_halves*.py(discovered fromtests/semantic): OK.No game files.
AI-assisted (Claude Code): I reviewed and ran the tests above.