rdna2spirv: guard native DPP FI=0 shuffle source (SHADER-DPP-ABSENT-SOURCE) #1400

Merged
Okachamie merged 1 commit from upstream-pr/1400 into main 2026-11-25 02:37:13 +00:00
Okachamie commented 2026-11-24 23:28:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Okachamie on 2026-11-24T23:28:46Z.


Claimed in the coordination issue as: SHADER-DPP-ABSENT-SOURCE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147210154)

What and why

Native DPP FI=0 used the source-lane ballot only to mask the shuffled value, while OpGroupNonUniformShuffle still received the raw source index. In a partial subgroup, an active lane can select an absent lane; that shuffle is undefined even when its result is masked afterwards.

The FI=0 path now redirects an absent or EXEC-off source to the current subgroup lane before the shuffle. FI=1 and --wave64-emulate are unchanged.

Tested

  • The new synthetic regression failed before the fix with %t31 not found in set() and passes afterward.
  • python -I tests/semantic/test_dpp_eager_subgroup.py -v: 8 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 12 --timeout 300: 475 files, 6221 tests, 0 files failed in 43 s.
  • python -I tests/test_docs_design_rows.py: 5 tests, OK.
  • python -I tests/test_design_contract_rows.py: 5 tests, OK.
  • python -m compileall -q make_game.py tools tests: exit 0.
  • git diff --check: clean.
  • python -I scripts/check_no_game_data.py on all changed files: clean.

No game files or GPU were used. Shader-corpus translated/spirv-val counts were not run because no game corpus is available.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on main at 3a0af1f15 and rebased cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • The translator rule is in the docs/design.md DPP contract row with its CPU-only confirmation and GPU limit.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5482093094 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1400). Originally posted by [Okachamie](https://github.com/Okachamie) on 2026-11-24T23:28:46Z. --- Claimed in the coordination issue as: SHADER-DPP-ABSENT-SOURCE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147210154) ### What and why Native DPP FI=0 used the source-lane ballot only to mask the shuffled value, while `OpGroupNonUniformShuffle` still received the raw source index. In a partial subgroup, an active lane can select an absent lane; that shuffle is undefined even when its result is masked afterwards. The FI=0 path now redirects an absent or EXEC-off source to the current subgroup lane before the shuffle. FI=1 and `--wave64-emulate` are unchanged. ### Tested - The new synthetic regression failed before the fix with `%t31 not found in set()` and passes afterward. - `python -I tests/semantic/test_dpp_eager_subgroup.py -v`: 8 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic -j 12 --timeout 300`: 475 files, 6221 tests, 0 files failed in 43 s. - `python -I tests/test_docs_design_rows.py`: 5 tests, OK. - `python -I tests/test_design_contract_rows.py`: 5 tests, OK. - `python -m compileall -q make_game.py tools tests`: exit 0. - `git diff --check`: clean. - `python -I scripts/check_no_game_data.py` on all changed files: clean. No game files or GPU were used. Shader-corpus translated/`spirv-val` counts were not run because no game corpus is available. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on `main` at `3a0af1f15` and rebased cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] The translator rule is in the `docs/design.md` DPP contract row with its CPU-only confirmation and GPU limit.
GeorgiyDemo commented 2026-11-24 23:48:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T23:48:55Z.


Tested 26fabdbba on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 364ab4eab (translator-only PR; binaries from the build at 66d4f5aa3, GPU test C++ unchanged in between):

  • python3 -I tests/semantic/test_dpp_eager_subgroup.py: 8/8 OK at this head. The same file copied onto main's tree fails 1 of 8 with AssertionError: '%t31' not found in set() — matches the regression described in the PR.
  • GPU, --filter cs_dpp: 9/10 passed, 1 skipped on both MoltenVK 1.4.2 and KosmicKrisp (Mesa 26.3.1). The skip is cs_dpp_w64 ("no 64-wide compute subgroup on this device").
  • The same cs_dpp set with main's translator gives an identical 9/10 plus the same skip — the existing fixtures do not distinguish the two revisions, and the partial-subgroup absent-lane case is covered only by the new semantic test on this device.

AI-assisted; synthetic fixtures only, no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147824823 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7147824823). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-24T23:48:55Z. --- Tested `26fabdbba` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `364ab4eab` (translator-only PR; binaries from the build at `66d4f5aa3`, GPU test C++ unchanged in between): - `python3 -I tests/semantic/test_dpp_eager_subgroup.py`: **8/8 OK** at this head. The same file copied onto `main`'s tree fails 1 of 8 with `AssertionError: '%t31' not found in set()` — matches the regression described in the PR. - GPU, `--filter cs_dpp`: **9/10 passed, 1 skipped** on both **MoltenVK 1.4.2** and **KosmicKrisp** (Mesa 26.3.1). The skip is `cs_dpp_w64` ("no 64-wide compute subgroup on this device"). - The same `cs_dpp` set with `main`'s translator gives an identical 9/10 plus the same skip — the existing fixtures do not distinguish the two revisions, and the partial-subgroup absent-lane case is covered only by the new semantic test on this device. AI-assisted; synthetic fixtures only, no game data.
Okachamie commented 2026-11-25 02:27:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Okachamie on 2026-11-25T02:27:19Z.


Linux verification at 26fabdbba on CachyOS 7.3.5-2-cachyos, RTX 5090 Laptop GPU, NVIDIA 620.73.04. The focused scripts/run_gpu_tests.py --filter cs_dpp --require-pass run passed 9/10 natively (native wave64 skipped) and 10/10 with LEONIDA_W64_EMULATE=1. All 10 shaders passed spirv-val in both modes.

A synthetic seven-invocation workgroup returned the expected GPU readback on both the PR and parent on this driver. The CPU wave-interpreter trace distinguished them: over eight partial-wave cases, the parent attempted an absent-lane shuffle in all eight and the PR head attempted none, with expected outputs preserved. Game-free and AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7150743689 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7150743689). Originally posted by [Okachamie](https://github.com/Okachamie) on 2026-11-25T02:27:19Z. --- Linux verification at `26fabdbba` on CachyOS 7.3.5-2-cachyos, RTX 5090 Laptop GPU, NVIDIA 620.73.04. The focused `scripts/run_gpu_tests.py --filter cs_dpp --require-pass` run passed 9/10 natively (native wave64 skipped) and 10/10 with `LEONIDA_W64_EMULATE=1`. All 10 shaders passed `spirv-val` in both modes. A synthetic seven-invocation workgroup returned the expected GPU readback on both the PR and parent on this driver. The CPU wave-interpreter trace distinguished them: over eight partial-wave cases, the parent attempted an absent-lane shuffle in all eight and the PR head attempted none, with expected outputs preserved. Game-free and AI-assisted.
aslan2142 commented 2026-11-25 02:37:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T02:37:16Z.


Merged. Thanks, and thanks to GeorgiyDemo for confirming it fails on main.

  • Claim: SHADER-DPP-ABSENT-SOURCE, valid.
  • The rule: for native DPP with FI=0, the shuffle index goes to the calling lane when the source lane is absent or off, which matches the ds_swizzle / ds_bpermute rule already in main. As the row says, it is confirmed on the CPU, not yet on a GPU.
  • Tests: 1 of the 8 new checks fails on main; all 8 pass with the change.
  • On the user's own shader corpus (counts only): 2,298 shaders use the pattern; a slice of 120 still translates and validates in full, natively and with --wave64-emulate.
  • Checked again on main f6f56dfde + 26fabdbba: the semantic suite passes (485 files, 6,270 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 3 changed files.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7150960286 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7150960286). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T02:37:16Z. --- Merged. Thanks, and thanks to GeorgiyDemo for confirming it fails on `main`. - **Claim:** `SHADER-DPP-ABSENT-SOURCE`, valid. - **The rule:** for native DPP with FI=0, the shuffle index goes to the calling lane when the source lane is absent or off, which matches the `ds_swizzle` / `ds_bpermute` rule already in `main`. As the row says, it is confirmed on the CPU, not yet on a GPU. - **Tests:** 1 of the 8 new checks fails on `main`; all 8 pass with the change. - **On the user's own shader corpus (counts only):** 2,298 shaders use the pattern; a slice of 120 still translates and validates in full, natively and with `--wave64-emulate`. - **Checked again on `main` `f6f56dfde` + `26fabdbba`:** the semantic suite passes (485 files, 6,270 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1400
No description provided.