shader: omit native subgroup votes for dead scalar conditions #1272

Open
github-bot wants to merge 1 commit from github-bot/gh-1272 into main AGit
Owner

@⁠Kadamitas on GitHub · 2026-11-24 21:08 UTC · original
Kadamitas:perf/native-dead-scc-votes → main · +33 −9 · 6 files · 1 commits · open

Claimed in the coordination issue as: dead scalar condition votes

What and why

Use the existing scalar condition liveness analysis for native wave32 and wave64. When the shader overwrites the condition before another instruction reads it, omit the vote that would compute that condition. Preserve the mask result and keep the vote at control-flow joins where it remains live.

Tested

  • A hand-written control reduced one subgroup vote to zero. Lane outputs matched before and after. Both votes remained in a separate live branch-join control.
  • 675 translator tests passed before the latest-main rebase. On the final branch, 135 focused semantic and SPIR-V checks passed with one platform skip.
  • The WREXEC positive control explicitly consumes SCC so that it continues to verify vote emission when the value is live.
  • The broader run on the earlier base covered 6,169 tests in 470 files. WREXEC was the only failing file. Its two vote-emission assertions used a dead result. The updated WREXEC case passed on the final branch.
  • The design contract records the rule. Verification uses synthetic inputs and SPIR-V validation.

GPUs tested: n/a (translator and semantic tests)

AI-assisted: yes

  • One topic with synthetic inputs and no game data.
**@⁠Kadamitas** on GitHub · 2026-11-24 21:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1272) `Kadamitas:perf/native-dead-scc-votes` → `main` · +33 −9 · 6 files · 1 commits · open Claimed in the coordination issue as: [dead scalar condition votes](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Use the existing scalar condition liveness analysis for native wave32 and wave64. When the shader overwrites the condition before another instruction reads it, omit the vote that would compute that condition. Preserve the mask result and keep the vote at control-flow joins where it remains live. ### Tested - A hand-written control reduced one subgroup vote to zero. Lane outputs matched before and after. Both votes remained in a separate live branch-join control. - 675 translator tests passed before the latest-main rebase. On the final branch, 135 focused semantic and SPIR-V checks passed with one platform skip. - The WREXEC positive control explicitly consumes SCC so that it continues to verify vote emission when the value is live. - The broader run on the earlier base covered 6,169 tests in 470 files. WREXEC was the only failing file. Its two vote-emission assertions used a dead result. The updated WREXEC case passed on the final branch. - The design contract records the rule. Verification uses synthetic inputs and SPIR-V validation. GPUs tested: n/a (translator and semantic tests) AI-assisted: yes - [x] One topic with synthetic inputs and no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:45:14 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 14:45 UTC · original

Reviewed e7e359fa: ran the touched semantic test files on the PR tree and its merge base (the new and the flipped tests fail without the fix, the rest pass) and the whole translator suite on the PR tree: 471 files, 6178 tests, 0 failures. Probed the gate with hand-built shaders: loop back-edge carries the SCC, s_cbranch_scc joins, dead+live pairs and wave64 native joins give identical values to main, with votes dropped only for provably dead SCC writes. test_translate skips on this host (llvm-mc/spirv-tools), so the WQM_MASK edit is unverified. No findings; heads-up that the docs/design.md contract row conflicts on merge with current main. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 14:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1272#issuecomment-7165768319) Reviewed e7e359fa: ran the touched semantic test files on the PR tree and its merge base (the new and the flipped tests fail without the fix, the rest pass) and the whole translator suite on the PR tree: 471 files, 6178 tests, 0 failures. Probed the gate with hand-built shaders: loop back-edge carries the SCC, s_cbranch_scc joins, dead+live pairs and wave64 native joins give identical values to main, with votes dropped only for provably dead SCC writes. test_translate skips on this host (llvm-mc/spirv-tools), so the WQM_MASK edit is unverified. No findings; heads-up that the docs/design.md contract row conflicts on merge with current main. AI-assisted review. **Recommendation:** Merge
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/1272/head:github-bot/gh-1272'
git switch 'github-bot/gh-1272'

Merge

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