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

Manually merged
github merged 1 commit from gh-pr/1400/head into gh-pr/1400/base 2026-11-26 09:50:05 +00:00
Owner

@⁠Okachamie on GitHub · 2026-11-24 23:28 UTC · original
Okachamie:fix/dpp-absent-source → main · +21 −2 · 3 files · 1 commits · merged 2026-11-25 02:37 UTC

Claimed in the coordination issue as: SHADER-DPP-ABSENT-SOURCE (#14)

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.
**@⁠Okachamie** on GitHub · 2026-11-24 23:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1400) `Okachamie:fix/dpp-absent-source` → `main` · +21 −2 · 3 files · 1 commits · merged 2026-11-25 02:37 UTC Claimed in the coordination issue as: SHADER-DPP-ABSENT-SOURCE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:04 +00:00
github manually merged commit 26fabdbba8 into gh-pr/1400/base 2026-11-26 09:50:05 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 23:48 UTC · original

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.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 23:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7147824823) 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.
Author
Owner

@⁠Okachamie on GitHub · 2026-11-25 02:27 UTC · original

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.

**@⁠Okachamie** on GitHub · 2026-11-25 02:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7150743689) 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.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 02:37 UTC · original

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).

**@⁠aslan2142** on GitHub · 2026-11-25 02:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1400#issuecomment-7150960286) 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.