OLD-9919: wave64_halves: clear ('vote', 'exec', ...) on EXEC writes and propagate SCC uses taint (SHADER-820) #1468

Open
github-bot wants to merge 2 commits from github-bot/gh-1468 into main AGit
Owner

@⁠Tortoche on GitHub · 2026-11-25 00:50 UTC · original
Tortoche:old-9919 → main · +169 −3 · 7 files · 2 commits · open

Item ID: OLD-9919 (SHADER-820)
Carries forward Draft #187 (old-pr/9919 by Luiz Neves / LouisRiverstone, with original commit authorship preserved at ed9ea453e), rebased onto main (364ab4eab), plus follow-up soundness fix (2ab9758e0) for 3-tuple ("vote", "exec", "empty") clearing and uses SCC taint propagation in exec_write.
Claimed in #14: #14

AI-assisted: yes

Summary

  • tools/wave64_halves.py (Analysis.exec_write):
    • Clear both 2-tuple ("vote", "exec") and 3-tuple ("vote", "exec", "empty") tags on st["g"]["scc"] whenever EXEC is rewritten by an SCC-preserving instruction (v_cmpx, s_mov_b64, s_cselect_b64, s_cmov_b64, or any op without scc in defs) or on fallback EXEC writes.
    • Propagate taint and staleness from implicit uses (e.g., scc on s_cselect_b64 exec, ... / s_cmov_b64 exec, ...) into mt on the non-v_cmpx exec_write path.
  • runtime/test/shaders/ps_w64_c_vote_rewrite.asm, runtime/test/shaders/ps_w64_c_vote_exec.asm, runtime/test/shaders/w64_graphics.py, tests/test_wave64_halves_fixtures.py: add and register the two SHADER-820 GPU fixtures (Tier C, tainted-branch).
  • tests/semantic/test_wave64_halves_soundness.py: add VS soundness/divergence tests and pure-Python PS classification tests covering vote-on-EXEC reset, 3-tuple s_cmp_eq_u64 exec, 0 clearing (vs_exec_vote_cmp_eq_mov, vs_exec_vote_cmp_eq_cselect), s_cselect_b64 exec SCC taint/staleness (test_s_cselect_exec_reads_scc_taint), clean scalar-compare s_cselect_b64 exec invariant (vs_clean_cselect_exec), rewritten mask, and v_cmpx.
  • docs/design.md: document the EXEC vote reset rule in the SHADER-10 contract row.

Tests Executed (Linux x86_64 CPU, no GPU/retail corpus run)

  • python3 -I tests/semantic/test_wave64_halves_soundness.py -v: 37/37 passed
  • python3 -I tests/semantic/test_wave64_halves.py: 126/126 passed
  • python3 -I tests/semantic/test_wave64_halves_wqm_uvote.py: 18/18 passed
  • python3 -I tests/semantic/test_wave64_halves_partial_dst.py: 13/13 passed
  • python3 -I tests/semantic/test_wave64_halves_readlane_uniform.py: 2/2 passed
  • python3 -m pytest tests/test_wave64_halves_fixtures.py -v: 9 passed / 1 skipped (test_fixtures_are_classified_as_their_headers_say skipped due to llvm-mc absent on PATH)
  • python3 -I tests/test_design_contract_rows.py: 5/5 passed
  • python3 -I tests/test_docs_links.py: 16/16 passed
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed
  • python3 -m compileall -q make_game.py tools tests: OK (exit 0)
  • python3 -I scripts/check_no_game_data.py on all 7 modified/added files: OK (exit 0, zero game data)
**@⁠Tortoche** on GitHub · 2026-11-25 00:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1468) `Tortoche:old-9919` → `main` · +169 −3 · 7 files · 2 commits · open Item ID: `OLD-9919` (`SHADER-820`) Carries forward Draft `#187` (`old-pr/9919` by `Luiz Neves` / `LouisRiverstone`, with original commit authorship preserved at `ed9ea453e`), rebased onto `main` (`364ab4eab`), plus follow-up soundness fix (`2ab9758e0`) for 3-tuple `("vote", "exec", "empty")` clearing and `uses` SCC taint propagation in `exec_write`. Claimed in `#14`: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 AI-assisted: yes ### Summary - `tools/wave64_halves.py` (`Analysis.exec_write`): - Clear both 2-tuple `("vote", "exec")` and 3-tuple `("vote", "exec", "empty")` tags on `st["g"]["scc"]` whenever `EXEC` is rewritten by an `SCC`-preserving instruction (`v_cmpx`, `s_mov_b64`, `s_cselect_b64`, `s_cmov_b64`, or any op without `scc` in `defs`) or on fallback `EXEC` writes. - Propagate taint and staleness from implicit `uses` (e.g., `scc` on `s_cselect_b64 exec, ...` / `s_cmov_b64 exec, ...`) into `mt` on the non-`v_cmpx` `exec_write` path. - `runtime/test/shaders/ps_w64_c_vote_rewrite.asm`, `runtime/test/shaders/ps_w64_c_vote_exec.asm`, `runtime/test/shaders/w64_graphics.py`, `tests/test_wave64_halves_fixtures.py`: add and register the two `SHADER-820` GPU fixtures (Tier `C`, `tainted-branch`). - `tests/semantic/test_wave64_halves_soundness.py`: add VS soundness/divergence tests and pure-Python PS classification tests covering vote-on-`EXEC` reset, 3-tuple `s_cmp_eq_u64 exec, 0` clearing (`vs_exec_vote_cmp_eq_mov`, `vs_exec_vote_cmp_eq_cselect`), `s_cselect_b64 exec` SCC taint/staleness (`test_s_cselect_exec_reads_scc_taint`), clean scalar-compare `s_cselect_b64 exec` invariant (`vs_clean_cselect_exec`), rewritten mask, and `v_cmpx`. - `docs/design.md`: document the `EXEC` vote reset rule in the `SHADER-10` contract row. ### Tests Executed (Linux x86_64 CPU, no GPU/retail corpus run) - `python3 -I tests/semantic/test_wave64_halves_soundness.py -v`: **37/37 passed** - `python3 -I tests/semantic/test_wave64_halves.py`: **126/126 passed** - `python3 -I tests/semantic/test_wave64_halves_wqm_uvote.py`: **18/18 passed** - `python3 -I tests/semantic/test_wave64_halves_partial_dst.py`: **13/13 passed** - `python3 -I tests/semantic/test_wave64_halves_readlane_uniform.py`: **2/2 passed** - `python3 -m pytest tests/test_wave64_halves_fixtures.py -v`: **9 passed / 1 skipped** (`test_fixtures_are_classified_as_their_headers_say` skipped due to `llvm-mc` absent on `PATH`) - `python3 -I tests/test_design_contract_rows.py`: **5/5 passed** - `python3 -I tests/test_docs_links.py`: **16/16 passed** - `python3 -I tests/test_text_write_line_endings.py`: **3/3 passed** - `python3 -m compileall -q make_game.py tools tests`: **OK** (exit 0) - `python3 -I scripts/check_no_game_data.py` on all 7 modified/added files: **OK** (exit 0, zero game data)
Carry forward old-pr/9919 (Draft #187) by Luiz Neves (LouisRiverstone), with fixtures by @AwkGrep256 and @sennecools (@shdann's case on #4620):
- tools/wave64_halves.py (exec_write): clear ('vote', 'exec') when EXEC changes via an instruction that keeps SCC (v_cmpx, s_mov_b64, s_cselect_b64, s_cmov_b64, or any op without scc in defs) and on fallback EXEC writes.
- runtime/test/shaders/ps_w64_c_vote_rewrite.asm & ps_w64_c_vote_exec.asm, w64_graphics.py, tests/test_wave64_halves_fixtures.py: add and register the two SHADER-820 GPU fixtures (tier C, tainted-branch).
- tests/semantic/test_wave64_halves_soundness.py: add VS soundness/divergence tests and pure-Python PS classification tests for vote-on-EXEC reset, rewritten mask, and v_cmpx.
- docs/design.md: document the EXEC vote reset rule in the SHADER-10 row.

AI-assisted: yes (rebased/verified on Linux).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:52:33 +00:00
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 01:16 UTC · original

I assembled the two new pixel fixtures and compared their identical input listings at the branch point 364ab4ea and PR head 2ab9758e. Strict mode now catches the EXEC vote that the baseline accepted.

Fixture Branch point PR head
ps_w64_c_vote_exec Tier A, accepted Tier C (tainted-branch), refused
ps_w64_c_vote_rewrite Tier C (tainted-branch), refused Same
ps_w64_a_skip control Tier A, accepted Same

CPU. I also tried two synthetic vertex shaders that select EXEC with s_cselect_b64 exec, 0, s[10:11] after an empty/nonempty VCC vote. In each case, 32 of 64 lane outputs differed between the interpreter's one 64-lane wave and two 32-lane waves. Both cases were labelled A at the branch point and C (tainted-exec) at the PR head. The soundness suite passed 37/37. The fixture suite passed 10/10 with LLVM available, including the previously skipped classification test.

GPU. On an RTX 4090 (Windows 11, NVIDIA 616.64), I rendered both pixel fixtures in default mode with the PR head's Vulkan harness and subgroup size 32. All four 64×64 frames were byte-identical across fixtures and revisions. The vote channel was 1 for 32 pixels and 0 for 4,064; the origin marker was set only at (0,0). This GPU supports only 32-wide subgroups, so the 64-lane comparison above is CPU evidence. AI-assisted verification; synthetic inputs throughout.

**@⁠ecox982745** on GitHub · 2026-11-25 01:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1468#issuecomment-7149372881) I assembled the two new pixel fixtures and compared their identical input listings at the branch point `364ab4ea` and PR head `2ab9758e`. Strict mode now catches the EXEC vote that the baseline accepted. | Fixture | Branch point | PR head | | --- | --- | --- | | `ps_w64_c_vote_exec` | Tier A, accepted | Tier C (`tainted-branch`), refused | | `ps_w64_c_vote_rewrite` | Tier C (`tainted-branch`), refused | Same | | `ps_w64_a_skip` control | Tier A, accepted | Same | **CPU.** I also tried two synthetic vertex shaders that select EXEC with `s_cselect_b64 exec, 0, s[10:11]` after an empty/nonempty VCC vote. In each case, 32 of 64 lane outputs differed between the interpreter's one 64-lane wave and two 32-lane waves. Both cases were labelled A at the branch point and C (`tainted-exec`) at the PR head. The soundness suite passed 37/37. The fixture suite passed 10/10 with LLVM available, including the previously skipped classification test. **GPU.** On an RTX 4090 (Windows 11, NVIDIA 616.64), I rendered both pixel fixtures in default mode with the PR head's Vulkan harness and subgroup size 32. All four 64×64 frames were byte-identical across fixtures and revisions. The vote channel was 1 for 32 pixels and 0 for 4,064; the origin marker was set only at (0,0). This GPU supports only 32-wide subgroups, so the 64-lane comparison above is CPU evidence. AI-assisted verification; synthetic inputs throughout.
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 10:12 UTC · original

Tested head 284cbfacf on NVIDIA GeForce RTX 4060 (Ada, subgroup 32 only), driver 621.14, Windows 11 Pro 26300, VS 2022, Vulkan SDK 1.4.363.0. It merges cleanly onto main 57ba40bd6 despite the needs rebase label; results are from that merge.

  • pytest: test_wave64_halves_soundness.py 37 passed, test_wave64_halves_fixtures.py 10 passed.
  • build.py on the 34 wave64 graphics fixtures: 34 translated, 34 pass spirv-val; tier C count 12 -> 14 (the two new fixtures).
  • w64_graphics.py: 18 ok, 14 tier C SKIP, 0 failed. ps_w64_c_vote_exec and ps_w64_c_vote_rewrite SKIP as expected on a 32-only device, so this run doesn't confirm their tier C outputs; that needs a device that can require 64 (or W64G_REF).

No game files. AI-assisted (Claude Code), run for a non-developer tester.

**@⁠potatoe0100** on GitHub · 2026-11-25 10:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1468#issuecomment-7159387653) Tested head `284cbfacf` on NVIDIA GeForce RTX 4060 (Ada, subgroup 32 only), driver 621.14, Windows 11 Pro 26300, VS 2022, Vulkan SDK 1.4.363.0. It merges cleanly onto `main` `57ba40bd6` despite the `needs rebase` label; results are from that merge. - pytest: `test_wave64_halves_soundness.py` 37 passed, `test_wave64_halves_fixtures.py` 10 passed. - `build.py` on the 34 wave64 graphics fixtures: 34 translated, 34 pass spirv-val; tier C count 12 -> 14 (the two new fixtures). - `w64_graphics.py`: 18 ok, 14 tier C SKIP, 0 failed. `ps_w64_c_vote_exec` and `ps_w64_c_vote_rewrite` SKIP as expected on a 32-only device, so this run doesn't confirm their tier C outputs; that needs a device that can require 64 (or `W64G_REF`). No game files. AI-assisted (Claude Code), run for a non-developer tester.
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/1468/head:github-bot/gh-1468'
git switch 'github-bot/gh-1468'

Merge

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