rdna2spirv: use subgroup ballot in quad_any for non-PS stages to avoid partial-quad UB #101

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

@⁠Andretuta on GitHub · 2026-11-24 02:18 UTC · original
ubiquitarianism:old-pr/9833 → main · +183 −17 · 2 files · 1 commits · draft

Carried over from old PR 9833 by Lewandox in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9833, 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.
Lewandox: 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):

### Summary
In non-pixel shader stages (CS/VS/etc.), a 4-lane quad can be partially populated (absent/inactive subgroup lanes), where OpGroupNonUniformQuadSwap* has undefined behavior under Vulkan/SPIR-V rules.

This change updates quad_any in ools/rdna2spirv.py to use OpGroupNonUniformBallot masked to the lane's 4-lane quad for non-PS stages, while preserving OpGroupNonUniformQuadSwap* for pixel shaders where full 2x2 quads are guaranteed.

Tests

  • Added ests/semantic/test_quad_any_partial_quad.py (3 tests: CS partial quads, VS partial quads, and PS quad-swap preservation).
  • Verified with:
    • python -m unittest tests.semantic.test_quad_any_partial_quad -v (3/3 OK)
    • python scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_quad_any_partial_quad.py (OK)
  • Synthetic test inputs only; no game data.
**@⁠Andretuta** on GitHub · 2026-11-24 02:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/101) `ubiquitarianism:old-pr/9833` → `main` · +183 −17 · 2 files · 1 commits · draft > Carried over from **old PR 9833** by `Lewandox` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9833`, 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. > `Lewandox`: 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): ### Summary In non-pixel shader stages (CS/VS/etc.), a 4-lane quad can be partially populated (absent/inactive subgroup lanes), where OpGroupNonUniformQuadSwap* has undefined behavior under Vulkan/SPIR-V rules. This change updates quad_any in ools/rdna2spirv.py to use OpGroupNonUniformBallot masked to the lane's 4-lane quad for non-PS stages, while preserving OpGroupNonUniformQuadSwap* for pixel shaders where full 2x2 quads are guaranteed. ### Tests - Added ests/semantic/test_quad_any_partial_quad.py (3 tests: CS partial quads, VS partial quads, and PS quad-swap preservation). - Verified with: - python -m unittest tests.semantic.test_quad_any_partial_quad -v (3/3 OK) - python scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_quad_any_partial_quad.py (OK) - Synthetic test inputs only; no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:44:31 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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