rdna2spirv: ds_permute_b32 stores its shuffles, so every lane runs them (SHADER-PERMUTE-EAGER) #1683

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

@⁠hugo0024 on GitHub · 2026-11-25 08:01 UTC · original
hugo0024:shader-permute-eager → main · +138 −1 · 4 files · 1 commits · open

Claimed in the coordination issue as: SHADER-PERMUTE-EAGER (claim)

What and why

On an Apple M5 (MoltenVK 1.4.2) ds_permute_b32 delivers wrong words: tools/lds_fuzz.py --wave 32 --permute has about a quarter of its programs differ from the model. Over seeds 1, 2, 3 and 31002, 1,374 of the 1,440 wrong words were last written by a ds_permute_b32 (the others by an op a wrong word fed), and 1,238 of the 1,440 read 0 where a source lane's data belongs. docs/shader_validation.md records 0 mismatches for the op on RADV. The fuzzer files the op under "hypothesis" and exits 0, so the runs looked clean.

Gen.ds_permute lets each destination lane scan the 32 source lanes of its half: per source lane a shuffle of the published target, a shuffle of the data, and an OpSelect that keeps the data when the target is this lane. Each shuffle is used once, and so is every link of that chain. SPIRV-Cross inlines a result that is used once into the expression that uses it, so the 32 steps become one nested ternary inside the EXEC ternary of the register write:

v10 = active ? (hit31 ? data31 : (hit30 ? data30 : ...)) : v10;

A lane that takes an outer arm, or is off in EXEC, runs none of the shuffles inside it. This is the SHADER-529 mechanism; test_dpp_eager_subgroup.py's model of that inlining flags all 64 shuffles of one ds_permute_b32 on main.

  • tools/rdna2spirv.py: Gen.ds_permute stores both shuffles to Function variables (Gen.eager), as the DPP rule stores its ballot bit and its shuffle. A store is a statement every lane runs. Native path only; --wave64-emulate has no subgroup operation in this rule.
  • tests/semantic/test_ds_permute_eager.py: no shuffle of the rule is left in a conditional position, in a wave32 and a wave64 compute shader and a pixel shader; each of the 64 is read by one OpStore to a variable of its own; the module with the stores taken out again has all 64 in a ternary's arm; and the stored form gives the ISA model's words with EXEC narrowed, sources that are off and a collision.
  • docs/design.md (the LDS row) and tests/semantic/README.md: the rule and how it was confirmed.

ds_permute_b32 occurs in no shader of the corpus (docs/testing.md), so no game shader changes; the cost is 64 Function variables per ds_permute_b32.

Tested

Apple M5, MoltenVK 1.4.2, llvm-mc 23.1.6, SPIRV-Tools v2026.4. Before is main 3f81d46ac, after is this branch on the same commit, both with the test programs built from main.

python3 -I tools/lds_fuzz.py --wave 32 <options>, programs that match the model:

Options Before After
--permute --programs 100 --seed 31002 83 of 100 100 of 100
--permute --programs 300 --seed 1 216 of 300 300 of 300
--permute --programs 300 --seed 2 227 of 300 300 of 300
--permute --programs 300 --seed 3 223 of 300 300 of 300
--extended --programs 300 --seed 31002 210 of 300 300 of 300
--programs 300 --seed 31001 (default mix, no ds_permute_b32) 300 of 300 300 of 300
  • Finding the cause: storing the data shuffle alone left 13 of the 100 programs of seed 31002 differing; storing both leaves none.
  • scripts/run_gpu_tests.py: 193/263 passed, 68 skipped, before and after, every test with the same verdict (cs_w32_permute and cs_w32_partial_permute pass in both; the two failures are cs_fma_fused, the MoltenVK 1.4.2 row of docs/testing.md, and cs_imgatomic_ext, which is red on main and claimed by someone else as GPU-IMG-ATOMIC-EXT-VOLUME-TAG). Its translation step reports 273 shaders: 272 translated, 272 pass spirv-val in both. 3 of the 275 modules in its work folder change: cs_w32_permute, cs_w32_partial_permute and cs_w64x_permute.
  • lds_fuzz.py --wave 64 --emulate --extended --programs 200 --seed 31003 (the path this does not touch): 148 of 148 that ran match, before and after.
  • tests/semantic/test_ds_permute_eager.py: 5 tests pass; with main's translator 7 checks fail (each shuffle "is read by OpSelect, not stored").
  • python3 -I scripts/run_semantic_tests.py tests/semantic: 487 files, 6,279 tests, 0 failed before; 488 files, 6,284 tests, 0 failed after.
  • The three shaders of the new test assemble with spirv-as and spirv-val reports nothing.
  • pytest files: 2 failed, 1908 passed, 18 skipped, before and after alike (the two are tests/test_translate.py on cs_dpp_cmp.asm, #1375's subject).
  • Standard-library loop: 498 files, 4 failed, before and after alike; none is touched here (test_mod_pack_output_alias.py: #1412; test_runner_calls_all_tests.py and test_tool_stdout_encoding.py: #1561; test_runtime_paths.py: #1657).
  • tests/test_docs_*.py pass; python3 -I scripts/check_no_game_data.py tests/semantic/test_ds_permute_eager.py is clean.

Not tested: a GPU other than the M5 (on a driver that does not inline this way the change is a store and a load of the same value), wave64 on a 64-wide subgroup and the pixel-shader form on a GPU (both only in the interpreter), and the game corpus (the op is not in it).

GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • 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.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code

**@⁠hugo0024** on GitHub · 2026-11-25 08:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683) `hugo0024:shader-permute-eager` → `main` · +138 −1 · 4 files · 1 commits · open Claimed in the coordination issue as: SHADER-PERMUTE-EAGER ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)) ### What and why On an Apple M5 (MoltenVK 1.4.2) `ds_permute_b32` delivers wrong words: `tools/lds_fuzz.py --wave 32 --permute` has about a quarter of its programs differ from the model. Over seeds 1, 2, 3 and 31002, 1,374 of the 1,440 wrong words were last written by a `ds_permute_b32` (the others by an op a wrong word fed), and 1,238 of the 1,440 read 0 where a source lane's data belongs. `docs/shader_validation.md` records 0 mismatches for the op on RADV. The fuzzer files the op under "hypothesis" and exits 0, so the runs looked clean. `Gen.ds_permute` lets each destination lane scan the 32 source lanes of its half: per source lane a shuffle of the published target, a shuffle of the data, and an `OpSelect` that keeps the data when the target is this lane. Each shuffle is used once, and so is every link of that chain. SPIRV-Cross inlines a result that is used once into the expression that uses it, so the 32 steps become one nested ternary inside the EXEC ternary of the register write: ```text v10 = active ? (hit31 ? data31 : (hit30 ? data30 : ...)) : v10; ``` A lane that takes an outer arm, or is off in EXEC, runs none of the shuffles inside it. This is the SHADER-529 mechanism; `test_dpp_eager_subgroup.py`'s model of that inlining flags all 64 shuffles of one `ds_permute_b32` on `main`. - `tools/rdna2spirv.py`: `Gen.ds_permute` stores both shuffles to Function variables (`Gen.eager`), as the DPP rule stores its ballot bit and its shuffle. A store is a statement every lane runs. Native path only; `--wave64-emulate` has no subgroup operation in this rule. - `tests/semantic/test_ds_permute_eager.py`: no shuffle of the rule is left in a conditional position, in a wave32 and a wave64 compute shader and a pixel shader; each of the 64 is read by one `OpStore` to a variable of its own; the module with the stores taken out again has all 64 in a ternary's arm; and the stored form gives the ISA model's words with EXEC narrowed, sources that are off and a collision. - `docs/design.md` (the LDS row) and `tests/semantic/README.md`: the rule and how it was confirmed. `ds_permute_b32` occurs in no shader of the corpus (`docs/testing.md`), so no game shader changes; the cost is 64 Function variables per `ds_permute_b32`. ### Tested Apple M5, MoltenVK 1.4.2, llvm-mc 23.1.6, SPIRV-Tools v2026.4. Before is `main` `3f81d46ac`, after is this branch on the same commit, both with the test programs built from `main`. `python3 -I tools/lds_fuzz.py --wave 32 <options>`, programs that match the model: | Options | Before | After | |---|---|---| | `--permute --programs 100 --seed 31002` | 83 of 100 | 100 of 100 | | `--permute --programs 300 --seed 1` | 216 of 300 | 300 of 300 | | `--permute --programs 300 --seed 2` | 227 of 300 | 300 of 300 | | `--permute --programs 300 --seed 3` | 223 of 300 | 300 of 300 | | `--extended --programs 300 --seed 31002` | 210 of 300 | 300 of 300 | | `--programs 300 --seed 31001` (default mix, no `ds_permute_b32`) | 300 of 300 | 300 of 300 | - Finding the cause: storing the data shuffle alone left 13 of the 100 programs of seed 31002 differing; storing both leaves none. - `scripts/run_gpu_tests.py`: 193/263 passed, 68 skipped, before and after, every test with the same verdict (`cs_w32_permute` and `cs_w32_partial_permute` pass in both; the two failures are `cs_fma_fused`, the MoltenVK 1.4.2 row of `docs/testing.md`, and `cs_imgatomic_ext`, which is red on `main` and claimed by someone else as GPU-IMG-ATOMIC-EXT-VOLUME-TAG). Its translation step reports `273 shaders: 272 translated, 272 pass spirv-val` in both. 3 of the 275 modules in its work folder change: `cs_w32_permute`, `cs_w32_partial_permute` and `cs_w64x_permute`. - `lds_fuzz.py --wave 64 --emulate --extended --programs 200 --seed 31003` (the path this does not touch): 148 of 148 that ran match, before and after. - `tests/semantic/test_ds_permute_eager.py`: 5 tests pass; with `main`'s translator 7 checks fail (each shuffle "is read by `OpSelect`, not stored"). - `python3 -I scripts/run_semantic_tests.py tests/semantic`: 487 files, 6,279 tests, 0 failed before; 488 files, 6,284 tests, 0 failed after. - The three shaders of the new test assemble with `spirv-as` and `spirv-val` reports nothing. - pytest files: 2 failed, 1908 passed, 18 skipped, before and after alike (the two are `tests/test_translate.py` on `cs_dpp_cmp.asm`, #1375's subject). - Standard-library loop: 498 files, 4 failed, before and after alike; none is touched here (`test_mod_pack_output_alias.py`: #1412; `test_runner_calls_all_tests.py` and `test_tool_stdout_encoding.py`: #1561; `test_runtime_paths.py`: #1657). - `tests/test_docs_*.py` pass; `python3 -I scripts/check_no_game_data.py tests/semantic/test_ds_permute_eager.py` is clean. Not tested: a GPU other than the M5 (on a driver that does not inline this way the change is a store and a load of the same value), wave64 on a 64-wide subgroup and the pixel-shader form on a GPU (both only in the interpreter), and the game corpus (the op is not in it). GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [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] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Gen.ds_permute lets each destination lane scan the 32 source lanes of its half: per source
lane a shuffle of the published target, a shuffle of the data and an OpSelect that keeps the
data when the target is this lane. Each shuffle was used once and so was every link of that
chain, so SPIRV-Cross (MoltenVK) wrote the 32 steps as one nested ternary under the EXEC
ternary of the register write. A lane that takes an outer arm, or is off in EXEC, then runs
none of the shuffles inside it (the SHADER-529 mechanism).

On an Apple M5 (MoltenVK 1.4.2) tools/lds_fuzz.py --wave 32 --permute had 17 of the 100
programs of seed 31002 differ from the model, every one in a ds_permute_b32 result, mostly 0
where a source lane's data belongs. Both shuffles are now stored to Function variables
(Gen.eager), as the DPP rule stores its ballot bit and its shuffle.

tests/semantic/test_ds_permute_eager.py checks the three native forms with
test_dpp_eager_subgroup.py's model of SPIRV-Cross's single-use forwarding, and the values
against test_ds_permute.py's ISA model.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:00:40 +00:00
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 08:16 UTC · original

The pixel-shader coverage listed as open in the PR passed on my RTX 4090. I compared 28cb94705 with its parent 3f81d46ac on Windows, NVIDIA 616.64. 40,960 pixel results per revision matched the reference, and all ten corresponding frame pairs were byte-identical. All ten SPIR-V modules changed between revisions and passed spirv-val on both.

I ran five synthetic full-screen draws for each of the wave32 and wave64 source declarations: a 17-lane rotation, a masked reversal with an unaligned byte address and instruction offset, a scatter leaving holes, multiple active sources targeting the same lane, and a scatter with the destination register aliased to the data register. Each pixel exported its actual lane, source address and result. The CPU reference checked the expected writer, zero for an active destination with no writer, and the old register value for an inactive destination. For collisions it accepted any active writer that targeted that lane.

The RTX 4090 ran physical 32-wide subgroups throughout. Both revisions passed on this driver. The author's MoltenVK results supply the before/after evidence for the fix. AI-assisted verification.

**@⁠ecox982745** on GitHub · 2026-11-25 08:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683#issuecomment-7156819062) The pixel-shader coverage listed as open in the PR passed on my RTX 4090. I compared `28cb94705` with its parent `3f81d46ac` on Windows, NVIDIA 616.64. **40,960 pixel results per revision matched the reference**, and all ten corresponding frame pairs were byte-identical. All ten SPIR-V modules changed between revisions and passed `spirv-val` on both. I ran five synthetic full-screen draws for each of the wave32 and wave64 source declarations: a 17-lane rotation, a masked reversal with an unaligned byte address and instruction offset, a scatter leaving holes, multiple active sources targeting the same lane, and a scatter with the destination register aliased to the data register. Each pixel exported its actual lane, source address and result. The CPU reference checked the expected writer, zero for an active destination with no writer, and the old register value for an inactive destination. For collisions it accepted any active writer that targeted that lane. The RTX 4090 ran physical 32-wide subgroups throughout. Both revisions passed on this driver. The author's MoltenVK results supply the before/after evidence for the fix. AI-assisted verification.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 08:41 UTC · original

Independent verification (native Windows; RTX 4070 SUPER + AMD Radeon gfx1036 iGPU): the eager-store fix pins the SHADER-529 mechanism — both OpGroupNonUniformShuffle results per source lane stored unconditionally to fresh vars, so no shuffle sits in conditional position; contract table row added; --wave64-emulate path untouched as claimed. test_ds_permute_eager.py 5/5 on PR and fails 7 checks on baseline translator (negative control confirmed). Full semantic suite 488 files / 6,284 tests / 0 failed — matches claimed counts exactly. GPU run_gpu_tests.py --filter permute: NVIDIA 3/5 (wave64 skips, no 64-wide subgroup), AMD iGPU 5/5 incl. both wave64 permute fixtures; baseline verdicts identical — no regression; PR-vs-base .spv hashes differ only on ds_permute fixtures (bpermute byte-identical, untouched path correct). MoltenVK itself not testable here, but the emitted SPIR-V shape is pinned by the test. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 08:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683#issuecomment-7157360385) Independent verification (native Windows; RTX 4070 SUPER + AMD Radeon gfx1036 iGPU): the eager-store fix pins the SHADER-529 mechanism — both `OpGroupNonUniformShuffle` results per source lane stored unconditionally to fresh vars, so no shuffle sits in conditional position; contract table row added; `--wave64-emulate` path untouched as claimed. `test_ds_permute_eager.py` 5/5 on PR and **fails 7 checks on baseline translator** (negative control confirmed). Full semantic suite 488 files / 6,284 tests / 0 failed — matches claimed counts exactly. GPU `run_gpu_tests.py --filter permute`: NVIDIA 3/5 (wave64 skips, no 64-wide subgroup), **AMD iGPU 5/5 incl. both wave64 permute fixtures**; baseline verdicts identical — no regression; PR-vs-base .spv hashes differ only on ds_permute fixtures (bpermute byte-identical, untouched path correct). MoltenVK itself not testable here, but the emitted SPIR-V shape is pinned by the test. AI-assisted verification.
Author
Owner

@⁠GrahamboJangles on GitHub · 2026-11-25 09:22 UTC · original

Reviewed head 28cb94705a824f614ab49626f8fbff85616512b5 against current main 2b567edca (base here is 3f81d46ac, four merges have landed since). CPU-only on Windows 11, python 3.14.9, python -I; every number below measured on a fresh clone, nothing merged, no GPU.

Coordination: SHADER-PERMUTE-EAGER claim comment 7156204534 (hugo0024, 2026-11-25T07:44:45Z, updated_at == created_at) predates the PR (created 08:01:45Z); the roster has done: SHADER-PERMUTE-EAGER -> #1683. No duplicate PRs fix this (--search permute surfaces only other ops).

Mergeability against the moved main: git diff 3f81d46ac..main over the PR's four files is empty (the three merges since touch test_active_cache.py / test_reg_ptr_hoist.py / check.py / docs/related_projects.md, no overlap) — clean rebase, git sees no conflict.

Measured, both directions:

  • python -I tests/semantic/test_ds_permute_eager.py at head: 5 tests OK. The same file run against main's translator: failures=7, the bungs naming e.g. ('%t30', 'OpGroupNonUniformShuffle', 'arm of OpSelect %t31') — the checks genuinely bite, the count-moves gate passes.
  • scripts/run_semantic_tests.py tests/semantic: at main 487 files, 6,279 tests, 0 failed (297 s, 24 jobs); at head 488 files, 6,284 tests, 0 failed (295 s). Delta is the +5 the PR claims, and none of the three main@3f81d46ac reds from #1673's subject family is touched here (they were green at this main already — someone carried that fix while my previous overnight run was reviewing).
  • scripts/check_no_game_data.py tests/semantic/test_ds_permute_eager.py exits 0.
  • The eager() helper is pre-existing (line 1509, the SHADER-529 store/load forwarder the DPP rule uses); this change is exactly two calls of it in Gen.ds_permute (native path, def ds_permute at 5902) plus the comment — the --wave64-emulate branch is untouched, as claimed.
  • The design.md contract-table row adds the rule with the M5/MoltenVK evidence and the fuzz numbers (83/100 -> 100/100 for seed 31002 matches the body's 17-differed figure).

CI at head: five checks (change-scope, linux-gpu-tools, macos, no-game-data, windows) pending as of this run — started, none failing yet.

Verdict: LGTM. The store-to-Function-variable mechanism is the repo's established SHADER-529 answer, applied consistently with the DPP and ballot precedents; the test's inverse sabotage (stores removed -> all 64 shuffles back in ternary arms) makes it unvacuous. Caveats the PR already states honestly: only the M5 path is GPU-measured, and the op is absent from the game corpus, so this is correctness insurance rather than a boot unblock.

Reviewed by an overnight shift of my own account; measurements reproducible with git clone + fetch pull/1683/head.

**@⁠GrahamboJangles** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683#issuecomment-7158250512) Reviewed head `28cb94705a824f614ab49626f8fbff85616512b5` against current `main` `2b567edca` (base here is `3f81d46ac`, four merges have landed since). CPU-only on Windows 11, python 3.14.9, `python -I`; every number below measured on a fresh clone, nothing merged, no GPU. **Coordination:** SHADER-PERMUTE-EAGER claim comment 7156204534 (hugo0024, 2026-11-25T07:44:45Z, `updated_at == created_at`) predates the PR (created 08:01:45Z); the roster has `done: SHADER-PERMUTE-EAGER -> #1683`. No duplicate PRs fix this (`--search permute` surfaces only other ops). **Mergeability against the moved main:** `git diff 3f81d46ac..main` over the PR's four files is empty (the three merges since touch `test_active_cache.py` / `test_reg_ptr_hoist.py` / `check.py` / `docs/related_projects.md`, no overlap) — clean rebase, `git` sees no conflict. **Measured, both directions:** - `python -I tests/semantic/test_ds_permute_eager.py` at head: 5 tests OK. The same file run against `main`'s translator: `failures=7`, the bungs naming e.g. `('%t30', 'OpGroupNonUniformShuffle', 'arm of OpSelect %t31')` — the checks genuinely bite, the count-moves gate passes. - `scripts/run_semantic_tests.py tests/semantic`: at `main` 487 files, 6,279 tests, 0 failed (297 s, 24 jobs); at head 488 files, 6,284 tests, 0 failed (295 s). Delta is the +5 the PR claims, and none of the three main@`3f81d46ac` reds from #1673's subject family is touched here (they were green at this main already — someone carried that fix while my previous overnight run was reviewing). - `scripts/check_no_game_data.py tests/semantic/test_ds_permute_eager.py` exits 0. - The `eager()` helper is pre-existing (line 1509, the SHADER-529 store/load forwarder the DPP rule uses); this change is exactly two calls of it in `Gen.ds_permute` (native path, `def ds_permute` at 5902) plus the comment — the `--wave64-emulate` branch is untouched, as claimed. - The design.md contract-table row adds the rule with the M5/MoltenVK evidence and the fuzz numbers (83/100 -> 100/100 for seed 31002 matches the body's 17-differed figure). CI at head: five checks (change-scope, linux-gpu-tools, macos, no-game-data, windows) pending as of this run — started, none failing yet. **Verdict: LGTM.** The store-to-Function-variable mechanism is the repo's established SHADER-529 answer, applied consistently with the DPP and ballot precedents; the test's inverse sabotage (stores removed -> all 64 shuffles back in ternary arms) makes it unvacuous. Caveats the PR already states honestly: only the M5 path is GPU-measured, and the op is absent from the game corpus, so this is correctness insurance rather than a boot unblock. Reviewed by an overnight shift of my own account; measurements reproducible with `git clone` + `fetch pull/1683/head`.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-25 11:24 UTC · original

Tested 28cb94705 applied onto main 42537e7b6 on AMD: Radeon RX 7900 XT (RDNA3, gfx1100, subgroup sizes 32..64), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, Vulkan SDK 1.4.363.0, llvm-mc 23.1.5, test programs from a main 42537e7b6 build. It adds a discrete RDNA3 run, and lds_fuzz with native wave64 on a 64-wide subgroup. No game files.

main this PR
--filter permute, native: cs_w32_permute, cs_w32_partial_permute, cs_w64x_permute, cs_bpermute32, cs_w64x_bpermute 5/5 PASS 5/5 PASS, the same words
the same with LEONIDA_W64_EMULATE=1 5/5 PASS 5/5 PASS, the same words
tools/lds_fuzz.py --wave 32 --permute --programs 300, seeds 31002 and 1 300/300 and 300/300 match 300/300 and 300/300 match
--wave 64 --permute --programs 300 --seed 31002 (native wave64) 300/300 match 300/300 match
--wave both --extended --programs 300 --seed 31002 529/529 match, 71 skipped 529/529 match, 71 skipped
whole GPU suite 244/263, 18 skipped, 1 failed 244/263, the same status for every fixture

I read the fuzz match counts, not just the exit code. Every run reported 0 mismatched and 0 harness errors. The one suite failure is cs_imgatomic_ext on both trees, which #1518 fixes. test_ds_permute_eager.py passes 5/5.

So AMD's own compiler gives the same results with or without the stores, as expected. I did not measure performance.

**@⁠adrianmjim** on GitHub · 2026-11-25 11:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683#issuecomment-7161008307) Tested `28cb94705` applied onto `main` `42537e7b6` on AMD: Radeon RX 7900 XT (RDNA3, gfx1100, subgroup sizes 32..64), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, Vulkan SDK 1.4.363.0, llvm-mc 23.1.5, test programs from a `main` `42537e7b6` build. It adds a discrete RDNA3 run, and `lds_fuzz` with native wave64 on a 64-wide subgroup. No game files. | | `main` | this PR | |---|---|---| | `--filter permute`, native: `cs_w32_permute`, `cs_w32_partial_permute`, `cs_w64x_permute`, `cs_bpermute32`, `cs_w64x_bpermute` | 5/5 PASS | 5/5 PASS, the same words | | the same with `LEONIDA_W64_EMULATE=1` | 5/5 PASS | 5/5 PASS, the same words | | `tools/lds_fuzz.py --wave 32 --permute --programs 300`, seeds 31002 and 1 | 300/300 and 300/300 match | 300/300 and 300/300 match | | `--wave 64 --permute --programs 300 --seed 31002` (native wave64) | 300/300 match | 300/300 match | | `--wave both --extended --programs 300 --seed 31002` | 529/529 match, 71 skipped | 529/529 match, 71 skipped | | whole GPU suite | 244/263, 18 skipped, 1 failed | 244/263, the same status for every fixture | I read the fuzz match counts, not just the exit code. Every run reported 0 mismatched and 0 harness errors. The one suite failure is `cs_imgatomic_ext` on both trees, which #1518 fixes. `test_ds_permute_eager.py` passes 5/5. So AMD's own compiler gives the same results with or without the stores, as expected. I did not measure performance.
Author
Owner

@⁠EvgHaze on GitHub · 2026-11-25 12:52 UTC · original

Apple check (no regression, plus the semantic suite).

Machine:  Apple M3, 10-core (MacBook Air 13", Mac15,13), macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2 (Homebrew), ICD loaded directly, subgroup 4..32
          KosmicKrisp, Mesa 26.3.1 (Homebrew), through the Vulkan loader, subgroup 32..32
Base:     main `0d80bc5` + this diff (clean `git apply`)

scripts/run_gpu_tests.py --filter permute, both drivers, identical:

Test MoltenVK 1.4.2 KosmicKrisp 26.3.1
cs_bpermute32 PASS 0 50 162 99 36 218 183 15 PASS, same words
cs_w32_partial_permute PASS 0 29 127 0 1 0 134 113 PASS, same words
cs_w32_permute PASS 218 29 8 211 0 15 99 15 PASS, same words
cs_w64x_bpermute SKIP (no 64-wide compute subgroup) SKIP
cs_w64x_permute SKIP SKIP

So on a 32-wide host, where these programs run natively rather than split, the eager-store change gives the same words on two drivers that take different paths to Metal.

python3 -I scripts/run_semantic_tests.py tests/semantic → 490 files, 6293 tests, 0 failed (8 jobs, 153 s), one file and three tests more than main, which is this PR's tests/semantic/test_ds_permute_eager.py.

What I did not run: the 64-wide cases, which this device cannot execute.

AI-assisted. No game data: hand-written fixtures, and the numbers above are test output.

**@⁠EvgHaze** on GitHub · 2026-11-25 12:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1683#issuecomment-7162966617) Apple check (no regression, plus the semantic suite). ```text Machine: Apple M3, 10-core (MacBook Air 13", Mac15,13), macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2 (Homebrew), ICD loaded directly, subgroup 4..32 KosmicKrisp, Mesa 26.3.1 (Homebrew), through the Vulkan loader, subgroup 32..32 Base: main `0d80bc5` + this diff (clean `git apply`) ``` `scripts/run_gpu_tests.py --filter permute`, both drivers, identical: | Test | MoltenVK 1.4.2 | KosmicKrisp 26.3.1 | |---|---|---| | `cs_bpermute32` | PASS `0 50 162 99 36 218 183 15` | PASS, same words | | `cs_w32_partial_permute` | PASS `0 29 127 0 1 0 134 113` | PASS, same words | | `cs_w32_permute` | PASS `218 29 8 211 0 15 99 15` | PASS, same words | | `cs_w64x_bpermute` | SKIP (no 64-wide compute subgroup) | SKIP | | `cs_w64x_permute` | SKIP | SKIP | So on a 32-wide host, where these programs run natively rather than split, the eager-store change gives the same words on two drivers that take different paths to Metal. `python3 -I scripts/run_semantic_tests.py tests/semantic` → **490 files, 6293 tests, 0 failed** (8 jobs, 153 s), one file and three tests more than main, which is this PR's `tests/semantic/test_ds_permute_eager.py`. What I did not run: the 64-wide cases, which this device cannot execute. AI-assisted. No game data: hand-written fixtures, and the numbers above are test output.
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/1683/head:github-bot/gh-1683'
git switch 'github-bot/gh-1683'

Merge

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