rdna2spirv: redirect absent subgroup lanes before OpGroupNonUniformShuffle in ds_permute #97

Closed
github-bot wants to merge 1 commit from gh-pr/97/head into gh-pr/97/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:17 UTC · original
ubiquitarianism:old-pr/9829 → main · +38 −4 · 2 files · 1 commits · closed without merging

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

In Gen.ds_permute() (tools/rdna2spirv.py), the non-emulated subgroup path checked whether each source lane exists via OpGroupNonUniformBallotBitExtract, but still passed the raw src lane ID straight into both OpGroupNonUniformShuffle calls. In a partial wave, shuffling from an absent invocation ID is undefined behavior in Vulkan/SPIR-V even if the result is masked afterward.

Redirect absent source lanes to the current lane before both shuffles (safe_src = OpSelect %uint {ex} {src} {self_lane}), matching ds_lane_read() right above it.

Added a test in tests/semantic/test_ds_permute.py checking all 64 shuffles across wave32 compute, wave64 compute, and fragment shaders use a ballot-guarded lane ID, plus a partial-wave (7 lanes in a 32-wide subgroup) execution check.

Claimed in #9235. AI-assisted; tested on Windows 11 / Python 3.12.10 with python -I -m unittest discover -s tests/semantic -p "test_ds_permute.py" -v (7 OK), spirv_asm.assemble(), python -m compileall -q tools/rdna2spirv.py tests/semantic/test_ds_permute.py, and python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_ds_permute.py (no game files).

Reopened after mass PR cleanup (previously #9257).

**@⁠Andretuta** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/97) `ubiquitarianism:old-pr/9829` → `main` · +38 −4 · 2 files · 1 commits · closed without merging > Carried over from **old PR 9829** by `Lewandox` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9829`, 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): In `Gen.ds_permute()` (`tools/rdna2spirv.py`), the non-emulated subgroup path checked whether each source lane exists via `OpGroupNonUniformBallotBitExtract`, but still passed the raw `src` lane ID straight into both `OpGroupNonUniformShuffle` calls. In a partial wave, shuffling from an absent invocation ID is undefined behavior in Vulkan/SPIR-V even if the result is masked afterward. Redirect absent source lanes to the current lane before both shuffles (`safe_src = OpSelect %uint {ex} {src} {self_lane}`), matching `ds_lane_read()` right above it. Added a test in `tests/semantic/test_ds_permute.py` checking all 64 shuffles across wave32 compute, wave64 compute, and fragment shaders use a ballot-guarded lane ID, plus a partial-wave (`7` lanes in a 32-wide subgroup) execution check. Claimed in `#9235`. AI-assisted; tested on Windows 11 / Python 3.12.10 with `python -I -m unittest discover -s tests/semantic -p "test_ds_permute.py" -v` (7 OK), `spirv_asm.assemble()`, `python -m compileall -q tools/rdna2spirv.py tests/semantic/test_ds_permute.py`, and `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_ds_permute.py` (no game files). Reopened after mass PR cleanup (previously `#9257`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:44:18 +00:00
github-bot closed this pull request 2026-11-26 08:44:18 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 19:09 UTC · original

Closing: everything this pull request changes is already in main. Merging it into main (490f5b9ec) leaves every file as it is. The same change landed with #1118.

Thanks for the work! If something here is still missing from main, open a new pull request with what's left.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 19:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/97#issuecomment-7171902458) Closing: everything this pull request changes is already in `main`. Merging it into `main` (`490f5b9ec`) leaves every file as it is. The same change landed with #1118. Thanks for the work! If something here is still missing from `main`, open a new pull request with what's left. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.