mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1133] rdna2spirv: use subgroup ballot in quad_any for non-PS stages to avoid partial-quad UB (OLD-9833) #1165
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1165
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1133
Author: @ambroseautomation
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:carry/old-9833-quad-any-ballot📝 Commits (1)
ed4a77crdna2spirv: use subgroup ballot in quad_any for non-PS stages to avoid partial-quad UB📊 Changes
2 files changed (+183 additions, -17 deletions)
View changed files
➕
tests/semantic/test_quad_any_partial_quad.py(+154 -0)📝
tools/rdna2spirv.py(+29 -17)📄 Description
Claimed in the coordination issue as: OLD-9833 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141272211)
What and why
Carries forward
old-pr/9833(draft #101, original commit authorLewandoxpreserved; indexed in #17), rebased cleanly onto currentmain.Fixes partial-quad undefined behavior in
Gen.quad_any(tools/rdna2spirv.py):ps), keepsOpGroupNonUniformQuadSwap(2x2 fragment quads always have 4 invocations).cs,vs,gs,ms), replacesOpGroupNonUniformQuadSwap/OpGroupNonUniformShufflewithOpGroupNonUniformBallot+OpGroupNonUniformBallotBitExtractacross the quad's four lanes (combined with bitwise OR to avoid short-circuiting in MSL), so absent invocations in partial quads (workgroups or draws whose size is not a multiple of 4) read as 0 instead of triggering undefined behavior.tests/semantic/test_quad_any_partial_quad.pyverifying compute partial quads, vertex partial quads, and fragment quad-swap preservation.Tested
python -m unittest discover -s tests/semantic -p test_quad_any_partial_quad.py -v: 3 tests, OK.python -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6,171 tests, 0 files failed.python -m compileall -q make_game.py tools tests: exit 0.python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_quad_any_partial_quad.py: exit 0 (no game data).GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — partial-quad UB fix for existingquad_anylowering)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.