Repository navigation
wave64_halves: a vote on a mask ends when the mask register is rewritten (SHADER-820) - #4620
LouisRiverstone wants to merge 2 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. |
…ten (SHADER-820) @shdann: put() dropped the destination's own tag but not a ('vote', r) tag on SCC naming it. v_cmp into the pair or VCC, s_mov_b64 and s_cselect_b64 don't write SCC, so s_cbranch_scc0 voted on the old mask while the run side narrowed EXEC to the new one: false tier A (one 64-lane wave writes v6 in 32 lanes two 32-lane waves skip). put() now drops the SCC vote when it writes the voted register (or the pair's second SGPR); ops that vote on their own destination set the new tag after it. Tests in test_wave64_halves_soundness.py: shdann's three listings are tier C and diverge 1x64 vs 2x32; an unchanged and a re-voted mask stay tier A and invariant. docs/design.md SHADER-10 row extended.
7708d08 to
703dfc9
Compare
|
Tested What I ran:
Cause:
|
SHADER-820, from @shdann's finding on #4571.
Bug. In
tools/wave64_halves.py,put()dropped the destination's own tag but kept a("vote", r)tag on SCC that names it.v_cmpinto an SGPR pair or into VCC,s_mov_b64ands_cselect_b64don't write SCC. So after one of them rewrites the voted mask,s_cbranch_scc0is a vote on the old mask, while the run side narrows EXEC to the new one.Analysis.narrowscompares register names only, so the shader came out tier A.On
mainthis is tier A. Run as one 64-lane wave it writes v6 in lanes 20…63; as two 32-lane waves, the upper half votes no and skips, so 32 lanes differ. The same happens withs_mov_b64 s[20:21], execas the rewrite, and with VCC as the voted register.Fix. When
put()writes the voted register, or the second SGPR of a voted pair, it drops the SCC vote. The branch is then judged as a plain SCC branch: here, tier Ctainted-branch. An op that votes on its own destination (s_and_b64 s[20:21], exec, vcc) is unaffected, because it sets the new tag after itsput(). EXEC writes are left alone;put()already skips them.Tests, in
tests/semantic/test_wave64_halves_soundness.py:v_cmpinto the pair,s_mov_b64into the pair, VCC) are tier C, and their 1×64 and 2×32 runs onspirv_wave_interpreally diverges_and_b64on the new mask, stay tier A and invarianttest_wave64_halves_soundness.pypasses 33/33; onmainthe two regression tests fail and the controls pass.tests/test_wave64_halves_fixtures.pypasses 9/9.python -I -m unittest discover -s tests/semantic: onlymain's known failures.docs/design.md: the SHADER-10 row's vote rule now says a rewrite of the voted register ends the vote. That text appears twice in the row, and both copies are updated.Neighbours on the same file: SHADER-819 (
put()under a narrowed EXEC, @vibryxcx) and SHADER-821 (stale_uses, unclaimed) are separate. This PR only adds the SCC check at the top ofput().CPU only. No game files. Claimed on #4571 before starting.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.