wave64_halves: a vote on EXEC ends with a new EXEC, plus GPU test ps_w64_c_vote_rewrite (SHADER-820) #187

Open
github-bot wants to merge 6 commits from github-bot/gh-187 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:38 UTC · original
ubiquitarianism:old-pr/9919 → main · +109 −2 · 7 files · 6 commits · draft

Carried over from old PR 9919 by LouisRiverstone in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9919, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
LouisRiverstone: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

SHADER-820: the GPU fixture for the rewritten-vote-mask rule.

Status after main moved. The rule itself is on main as 2cbc8e046, 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 C tainted-branch. main's tests now expect that result. This PR had later changed it to a "stale vote" reported as unsafe-vote-branch, but only to satisfy an older test. Both tiers are C, so the change is dropped, and tools/wave64_halves.py, docs/design.md and tests/semantic are main's.

Re-submission of #4620. #4620 was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current main.

Checked on #4620 by: theswiss24 (two GPUs in a Dell Latitude 5501), Atomic258 (3.15.2), kapitche (WSL2 Ubuntu), sperm (RX 9070 XT), SweatierKey (Linux), AwkGrep256 (Linux), KkelebekK (780M), sennecools (main 561b65a8) on Windows 11 with AM), lunarminus (760M).

No game files.

AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with main.

**@⁠Andretuta** on GitHub · 2026-11-24 02:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/187) `ubiquitarianism:old-pr/9919` → `main` · +109 −2 · 7 files · 6 commits · draft > Carried over from **old PR 9919** by `LouisRiverstone` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9919`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `LouisRiverstone`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): SHADER-820: the GPU fixture for the rewritten-vote-mask rule. **Status after `main` moved.** The rule itself is on `main` as `2cbc8e046`, 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 C `tainted-branch`. `main`'s tests now expect that result. This PR had later changed it to a "stale vote" reported as `unsafe-vote-branch`, but only to satisfy an older test. Both tiers are C, so the change is dropped, and `tools/wave64_halves.py`, `docs/design.md` and `tests/semantic` are `main`'s. Re-submission of `#4620`. `#4620` was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current `main`. Checked on `#4620` by: theswiss24 (two GPUs in a Dell Latitude 5501), Atomic258 (3.15.2), kapitche (WSL2 Ubuntu), sperm (RX 9070 XT), SweatierKey (Linux), AwkGrep256 (Linux), KkelebekK (780M), sennecools (main 561b65a8) on Windows 11 with AM), lunarminus (760M). No game files. AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with `main`.
Rebased on main, which added test_c_mask_redefined_or_not_the_vote (#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.
@AwkGrep256's pixel fixture of shdann's listing (#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).
main has this PR's first commit (2cbc8e046: 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.
@shdann on #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.
@sennecools on #4620: the EXEC rule of 2dd34ba5 had no GPU fixture. This is
@shdann's case in ps_w64_c_vote_rewrite's layout: only pixel (0, 0) passes the
compare, s_and_saveexec_b64 votes on the narrowed EXEC, s_mov_b64 exec restores
the launch mask without touching SCC, and s_cbranch_scc0 still decides on the
old EXEC. sennecools measured this body on an RX 9070 XT (RADV): r0 differs
between required subgroup sizes 64 and 32. Registered in w64_graphics.py
(_c_vote_stale's layout) and expected tier C tainted-branch in
test_wave64_halves_fixtures.py; with main's wave64_halves.py that test fails
(tier A). Translates and passes spirv-val; build summary tier C.
# Conflicts:
#	docs/design.md
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:48:03 +00:00
This pull request has changes conflicting with the target branch.
  • docs/design.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/187/head:github-bot/gh-187'
git switch 'github-bot/gh-187'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-187'
git switch 'github-bot/gh-187'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-187'
git switch 'github-bot/gh-187'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-187'
git switch 'main'
git merge --squash 'github-bot/gh-187'
git switch 'main'
git merge --ff-only 'github-bot/gh-187'
git switch 'main'
git merge 'github-bot/gh-187'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.