rdna2spirv: a VALU data read of a lane-mask operand yields the wave's mask word #1397

Merged
whoalin1 merged 6 commits from upstream-pr/1397 into main 2026-12-01 11:53:36 +00:00
whoalin1 commented 2026-11-24 23:23:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T23:23:33Z.


Claimed in the coordination issue: https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7147335368

Depends on: #953

What

A lane mask (EXEC/VCC or a mask-tracked SGPR) that an instruction reads as a 32-bit value — for example v_mov_b32 of it into a plain VGPR, or a scalar number reader such as s_add_u32 s20, s10, K — must produce the wave's mask word. Hardware SGPRs hold that wave-wide word; the translator previously produced each lane's own 0/~0 bit in the VALU path.

This pull request now:

  • materializes the wave mask word for lane-mask data reads (src_u / lane_mask_word), while mask consumers keep extracting the lane bit through mask_src;
  • keeps word-materializing readers out of lane-local if (active) runs, since the gather is a cross-lane operation;
  • handles scalar mask number readers and mask-holding VGPR copies/reads;
  • gathers the word even when EXEC is narrowed. EXEC narrowing is data in the translator's model, not SPIR-V control flow. The earlier EXEC-coverage gate could not prove independent-SGPR restore idioms and still produced the wrong per-lane bit for the narrowed-EXEC fuzz family, so the gate and its CFG provenance analysis are removed;
  • includes the eager wave-mask store from #953 (authorship preserved) because it is the mechanism that keeps lowering from moving the subgroup gather into an EXEC-selected arm on MoltenVK/SPIRV-Cross.

docs/design.md records the contract. Semantic coverage includes narrowed SGPR/VCC reads, independent all-ones SGPR EXEC restore, EXEC round trips, scalar readers, vector-bitwise mask composition, native/emulated wave64 structure, and the eager-gather shape.

Tested

  • python -I scripts/run_semantic_tests.py tests/semantic — 488 files, 6298 tests, 0 files failed; compileall clean; tests/test_lane_masks.py passed.
  • GPU, NVIDIA RTX 4070 SUPER, Windows 11 (VK_LOADER_DRIVERS_SELECT=*nv-vk*): tools/crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --modes native — 199 match / 1 mismatch / 0 hypothesis-only versus 186 / 9 / 5 at ba315fbf1. The remaining cs_xl32_700032 minimizes to an inactive-EXEC write-predication case (v_cmpx + maskdata v_mov + v_xor), distinct from the narrowed-EXEC mask-word family and already present before this change.
  • NVIDIA seed 102 (--programs 106) � 105 match / 1 mismatch / 0 hypothesis-only versus 100 / 3 / 3 at ba315fbf1. The remaining cs_xl32_10200411 is an EXEC-zero/readfirstlane control-flow case. AMD evidence is reported in the pull-request comments; no game files were used.

AI-assisted (SWE-2.1 Max).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5482031924 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-24T23:23:33Z. --- Claimed in the coordination issue: https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7147335368 Depends on: #953 ## What A lane mask (EXEC/VCC or a mask-tracked SGPR) that an instruction reads **as a 32-bit value** — for example `v_mov_b32` of it into a plain VGPR, or a scalar number reader such as `s_add_u32 s20, s10, K` — must produce the wave's mask word. Hardware SGPRs hold that wave-wide word; the translator previously produced each lane's own `0`/`~0` bit in the VALU path. This pull request now: - materializes the wave mask word for lane-mask data reads (`src_u` / `lane_mask_word`), while mask consumers keep extracting the lane bit through `mask_src`; - keeps word-materializing readers out of lane-local `if (active)` runs, since the gather is a cross-lane operation; - handles scalar mask number readers and mask-holding VGPR copies/reads; - gathers the word even when EXEC is narrowed. EXEC narrowing is data in the translator's model, not SPIR-V control flow. The earlier EXEC-coverage gate could not prove independent-SGPR restore idioms and still produced the wrong per-lane bit for the narrowed-EXEC fuzz family, so the gate and its CFG provenance analysis are removed; - includes the eager wave-mask store from #953 (authorship preserved) because it is the mechanism that keeps lowering from moving the subgroup gather into an EXEC-selected arm on MoltenVK/SPIRV-Cross. `docs/design.md` records the contract. Semantic coverage includes narrowed SGPR/VCC reads, independent all-ones SGPR EXEC restore, EXEC round trips, scalar readers, vector-bitwise mask composition, native/emulated wave64 structure, and the eager-gather shape. ## Tested - `python -I scripts/run_semantic_tests.py tests/semantic` — **488 files, 6298 tests, 0 files failed**; `compileall` clean; `tests/test_lane_masks.py` passed. - GPU, NVIDIA RTX 4070 SUPER, Windows 11 (`VK_LOADER_DRIVERS_SELECT=*nv-vk*`): `tools/crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --modes native` — **199 match / 1 mismatch / 0 hypothesis-only** versus 186 / 9 / 5 at `ba315fbf1`. The remaining `cs_xl32_700032` minimizes to an inactive-EXEC write-predication case (`v_cmpx` + maskdata `v_mov` + `v_xor`), distinct from the narrowed-EXEC mask-word family and already present before this change. - NVIDIA seed 102 (`--programs 106`) � **105 match / 1 mismatch / 0 hypothesis-only** versus 100 / 3 / 3 at `ba315fbf1`. The remaining `cs_xl32_10200411` is an EXEC-zero/readfirstlane control-flow case. AMD evidence is reported in the pull-request comments; no game files were used. AI-assisted (SWE-2.1 Max).
GeorgiyDemo commented 2026-11-24 23:55:58 +00:00 (Migrated from github.com)

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


Tested 3ec97f53e 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):

  • The four updated semantic files pass at this head; copied onto main they fail: test_lane_masks_vector_bitwise 4, test_salu64_bitwise_data 9, test_salu_movrels_lane_mask 32, test_scselect_b64_data 2 failures — the coverage claim holds.
  • GPU regression, MoltenVK 1.4.2: --filter mask 6/12 passed, 5 skipped, 1 failed; --filter exec 4/8, 3 skipped, 1 failed. The failure is cs_mask_vgpr_exec: 15 15 15 15 3735928559 … where the fixture expects 4294967295 4294967295 … (SHADER-21 part 2 fixture from 72d7e52df). With main's tools/rdna2spirv.py in the same worktree and the same binary it PASSes; reproduced 3/3 runs.
  • KosmicKrisp (Mesa 26.3.1): cs_mask_vgpr_exec PASSes with both this head and main's translator — the same SPIR-V yields 0xFFFFFFFF there and 0xF on MoltenVK.
  • Root cause of the split: the new src_u data-read path calls lane_mask_word → wave_mask, which rebuilds the mask with an OpGroupNonUniformBallot of this lane's bit. The fixture does v_cmp_lt_u32 vcc_lo … (VCC = 0xFFFFFFFF), s_mov_b32 exec_lo, 0xF, then v_mov_b32 v2, vcc_lo; on MoltenVK the ballot only covers the four invocations active under that EXEC and returns 0xF, while the hardware VCC word is 0xFFFFFFFF. KosmicKrisp returns the full subgroup mask and hides it.

So at least on MoltenVK this is a regression against an existing GPU test: a mask word read as data cannot be reconstructed by a ballot that the current EXEC restricts.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147953042 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7147953042). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-24T23:55:58Z. --- Tested `3ec97f53e` 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): - The four updated semantic files pass at this head; copied onto `main` they fail: `test_lane_masks_vector_bitwise` 4, `test_salu64_bitwise_data` 9, `test_salu_movrels_lane_mask` 32, `test_scselect_b64_data` 2 failures — the coverage claim holds. - GPU regression, **MoltenVK 1.4.2**: `--filter mask` **6/12 passed, 5 skipped, 1 failed**; `--filter exec` **4/8, 3 skipped, 1 failed**. The failure is `cs_mask_vgpr_exec`: `15 15 15 15 3735928559 …` where the fixture expects `4294967295 4294967295 …` (SHADER-21 part 2 fixture from `72d7e52df`). With `main`'s `tools/rdna2spirv.py` in the same worktree and the same binary it PASSes; reproduced 3/3 runs. - **KosmicKrisp** (Mesa 26.3.1): `cs_mask_vgpr_exec` PASSes with both this head and `main`'s translator — the same SPIR-V yields `0xFFFFFFFF` there and `0xF` on MoltenVK. - Root cause of the split: the new `src_u` data-read path calls `lane_mask_word` → `wave_mask`, which rebuilds the mask with an `OpGroupNonUniformBallot` of this lane's bit. The fixture does `v_cmp_lt_u32 vcc_lo …` (VCC = `0xFFFFFFFF`), `s_mov_b32 exec_lo, 0xF`, then `v_mov_b32 v2, vcc_lo`; on MoltenVK the ballot only covers the four invocations active under that EXEC and returns `0xF`, while the hardware VCC word is `0xFFFFFFFF`. KosmicKrisp returns the full subgroup mask and hides it. So at least on MoltenVK this is a regression against an existing GPU test: a mask word read as data cannot be reconstructed by a ballot that the current EXEC restricts. AI-assisted; synthetic fixtures only, no game data.
ecox982745 commented 2026-11-25 00:46:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T00:46:21Z.


I tested the mask word and the EXEC write mask independently on an RTX 4090, Windows 11, NVIDIA 616.64, with a 32-lane compute subgroup. At head b9cea5af, 25/25 dispatches matched every lane; the same inputs matched in 9/25 at parent 1154976d.

The existing cs_mask_vgpr_exec fixture passed on both revisions here. I added four local synthetic probes, each run with six pairs of masks supplied at dispatch. They read either vcc_lo or a compare-written SGPR, through either v_mov_b32 or v_xor_b32. A distinguishing case was a comparison setting the odd lanes (0xaaaaaaaa) followed by EXEC selecting the even lanes (0x55555555). On the head every even lane received the full mask word on the move, and the odd lanes kept their sentinel. On the parent every even lane received zero.

For comparison with the MoltenVK report, the original fixture produced byte-identical SPIR-V from 3ec97f53 and b9cea5af with my default build (SHA-256 b675f09a98b92c423c6706e5a864dbcd555afe0ae43ad7606aab33a609d899be). My module materializes the mask with two OpGroupNonUniformBitwiseOr … Reduce instructions and has no OpGroupNonUniformBallot. The fixture also passed with LEONIDA_PC_TAIL_UBO=1. Comparing the subgroup operations in the failing MoltenVK module would help narrow down the driver difference; this NVIDIA run leaves that failure open.

Both revisions' five modules passed Vulkan 1.2 SPIR-V validation. I built the compute harness from the PR head. Separately, all 33 tests in the four changed CPU semantic test files passed on the head. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7148859256 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7148859256). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T00:46:21Z. --- I tested the mask word and the EXEC write mask independently on an RTX 4090, Windows 11, NVIDIA 616.64, with a 32-lane compute subgroup. At head `b9cea5af`, **25/25 dispatches** matched every lane; the same inputs matched in **9/25** at parent `1154976d`. The existing `cs_mask_vgpr_exec` fixture passed on both revisions here. I added four local synthetic probes, each run with six pairs of masks supplied at dispatch. They read either `vcc_lo` or a compare-written SGPR, through either `v_mov_b32` or `v_xor_b32`. A distinguishing case was a comparison setting the odd lanes (`0xaaaaaaaa`) followed by EXEC selecting the even lanes (`0x55555555`). On the head every even lane received the full mask word on the move, and the odd lanes kept their sentinel. On the parent every even lane received zero. For comparison with the MoltenVK report, the original fixture produced byte-identical SPIR-V from `3ec97f53` and `b9cea5af` with my default build (SHA-256 `b675f09a98b92c423c6706e5a864dbcd555afe0ae43ad7606aab33a609d899be`). My module materializes the mask with two `OpGroupNonUniformBitwiseOr … Reduce` instructions and has no `OpGroupNonUniformBallot`. The fixture also passed with `LEONIDA_PC_TAIL_UBO=1`. Comparing the subgroup operations in the failing MoltenVK module would help narrow down the driver difference; this NVIDIA run leaves that failure open. Both revisions' five modules passed Vulkan 1.2 SPIR-V validation. I built the compute harness from the PR head. Separately, all 33 tests in the four changed CPU semantic test files passed on the head. AI-assisted verification.
tiguan26 commented 2026-11-25 03:40:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T03:40:27Z.


Merged b9cea5a into current main (bfef489cb): no conflicts. The four test files this PR touches pass, and the changed expectations look right to me: a mask SGPR read by a VALU op is the 32-bit word on hardware, not the lane's 0 / ~0.

The full translator suite (Linux, Python 3.13) has one new failure, and it's a good one: tests/semantic/test_slot67_operand_forms.py::test_wave32_compare_high_word_preserves_low_and_clears_inactive_bits is an unexpected success. That test is marked @unittest.expectedFailure with a comment saying hardware copies the packed word (s_mov_b32 s8, vcc_hi -> 0x80000004) while main gives each lane its own mask value, which is what this PR fixes. With the marker left in, the suite reports FAILED (unexpected successes=1). Dropping @unittest.expectedFailure and that comment's "fails there" sentence should make it green. Otherwise only test_int32_to_f64 fails, as on main here (a spirv-opt crash in my environment).

AI-assisted (Claude).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152137032 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7152137032). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-25T03:40:27Z. --- Merged b9cea5a into current main (bfef489cb): no conflicts. The four test files this PR touches pass, and the changed expectations look right to me: a mask SGPR read by a VALU op is the 32-bit word on hardware, not the lane's 0 / ~0. The full translator suite (Linux, Python 3.13) has one new failure, and it's a good one: `tests/semantic/test_slot67_operand_forms.py::test_wave32_compare_high_word_preserves_low_and_clears_inactive_bits` is an **unexpected success**. That test is marked `@unittest.expectedFailure` with a comment saying hardware copies the packed word (`s_mov_b32 s8, vcc_hi` -> `0x80000004`) while main gives each lane its own mask value, which is what this PR fixes. With the marker left in, the suite reports `FAILED (unexpected successes=1)`. Dropping `@unittest.expectedFailure` and that comment's "fails there" sentence should make it green. Otherwise only `test_int32_to_f64` fails, as on main here (a `spirv-opt` crash in my environment). AI-assisted (Claude).
thesubtleties commented 2026-11-25 04:03:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-25T04:03:08Z.


I'm the author of #1043 (SHADER-MASK-AS-DATA), which overlaps. I ran both on main bfef489c, RTX 3080 and gfx1036.

Your branch (b9cea5afb) handles the copy-then-v_readfirstlane idiom that mine leaves out, and flags fewer fuzz programs: 12 here, 22 with #1043, 97 on main (five crosslane_fuzz runs).

Two gaps:

  1. 6 of those 12 are programs main translates but this branch doesn't under --wave64-emulate, e.g. cs_xl64_2026173083558 (seed 20261123, plain): "OpControlBarrier inside a folded lane-local region". The planner in wave64_emulate_opt.py needs to count these reads as exchanges; #1043 does it at three sites, feel free to reuse it.
  2. Scalar readers (s_add_u32, s_mul_i32, shifts...) still see one lane's bit; test_mask_as_data.py in #1043 covers them.

test_slot67_operand_forms also needs its expectedFailure removed, for both of us. They look complementary; whichever merges first, I'm happy to rebase. AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152483683 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7152483683). Originally posted by [thesubtleties](https://github.com/thesubtleties) on 2026-11-25T04:03:08Z. --- I'm the author of #1043 (SHADER-MASK-AS-DATA), which overlaps. I ran both on main `bfef489c`, RTX 3080 and gfx1036. Your branch (`b9cea5afb`) handles the copy-then-`v_readfirstlane` idiom that mine leaves out, and flags fewer fuzz programs: 12 here, 22 with #1043, 97 on main (five `crosslane_fuzz` runs). Two gaps: 1. 6 of those 12 are programs main translates but this branch doesn't under `--wave64-emulate`, e.g. `cs_xl64_2026173083558` (seed 20261123, plain): "OpControlBarrier inside a folded lane-local region". The planner in `wave64_emulate_opt.py` needs to count these reads as exchanges; #1043 does it at three sites, feel free to reuse it. 2. Scalar readers (`s_add_u32`, `s_mul_i32`, shifts...) still see one lane's bit; `test_mask_as_data.py` in #1043 covers them. `test_slot67_operand_forms` also needs its `expectedFailure` removed, for both of us. They look complementary; whichever merges first, I'm happy to rebase. AI-assisted (Claude Code)
levi2m commented 2026-11-25 04:27:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by levi2m on 2026-11-25T04:27:13Z.


Another card, native Windows: NVIDIA RTX 4050 Laptop (Ada, 10de:28a1), driver 621.01, Windows 11 build 26200, subgroup 32..32. No game files, nothing online.

tools/crosslane_fuzz.py, 200 programs per run, seeds 101, 102 and 103, on main 3ff2a2ad with vk_compute_test built from it. The "this PR" runs use only the tools/ part of this diff (head b9cea5af) through --translator.

main main + this PR
wave32 native, 600 programs 49 mismatch, 20 hypothesis-only 1 mismatch, 0 hypothesis-only
wave64 --wave64-emulate, 600 programs 27 mismatch, 20 hypothesis-only 0 mismatch, 0 hypothesis-only, 21 not translated

Every mismatching program on main includes the maskdata op. The fix is confirmed on this card, and no harness errors on either side.

Two things this PR leaves, for the record:

  1. 21 of 600 wave64-emulate programs no longer translate (9, 8 and 4 for the three seeds; main translated all of them). I translated one by hand, seed 101 index 316 (cs_xl64_10100316, ops bcnt, branch, cmp, exec, mask_salu, maskdata, mbcnt, mbcnt_data, permlane, readfirstlane, readlane, valu, writelane): AssertionError: wave64 emulation: x_split inside a folded lane-local region, from emit_folded_region. This is the same class as the OpControlBarrier inside a folded lane-local region case in @thesubtleties' comment above, with a different assertion text.
  2. One wave32 mismatch remains, seed 102 index 411 (cs_xl32_10200411, also a mismatch on main): s13 is expected to be the same mask word in every lane (0xb945de14) and comes out per lane (0 / 0xffffffff). It reads a mask held in a scalar register, which may be the scalar follow-up mentioned in the PR notes; I did not trace it.

The other fuzzers on main, same card, three seeds each, show nothing: lds_fuzz (400 native and 300 emulated programs per seed) and valu_fuzz f16 and mem (300 each) have 0 mismatches, and image_fuzz matches 300 of 300 per seed.

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152856009 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7152856009). Originally posted by [levi2m](https://github.com/levi2m) on 2026-11-25T04:27:13Z. --- Another card, native Windows: NVIDIA RTX 4050 Laptop (Ada, 10de:28a1), driver 621.01, Windows 11 build 26200, subgroup 32..32. No game files, nothing online. `tools/crosslane_fuzz.py`, 200 programs per run, seeds 101, 102 and 103, on main `3ff2a2ad` with `vk_compute_test` built from it. The "this PR" runs use only the `tools/` part of this diff (head `b9cea5af`) through `--translator`. | | main | main + this PR | |---|---|---| | wave32 native, 600 programs | 49 mismatch, 20 hypothesis-only | 1 mismatch, 0 hypothesis-only | | wave64 `--wave64-emulate`, 600 programs | 27 mismatch, 20 hypothesis-only | 0 mismatch, 0 hypothesis-only, **21 not translated** | Every mismatching program on main includes the `maskdata` op. The fix is confirmed on this card, and no harness errors on either side. Two things this PR leaves, for the record: 1. **21 of 600 wave64-emulate programs no longer translate** (9, 8 and 4 for the three seeds; main translated all of them). I translated one by hand, seed 101 index 316 (`cs_xl64_10100316`, ops `bcnt, branch, cmp, exec, mask_salu, maskdata, mbcnt, mbcnt_data, permlane, readfirstlane, readlane, valu, writelane`): `AssertionError: wave64 emulation: x_split inside a folded lane-local region`, from `emit_folded_region`. This is the same class as the `OpControlBarrier inside a folded lane-local region` case in @thesubtleties' comment above, with a different assertion text. 2. **One wave32 mismatch remains**, seed 102 index 411 (`cs_xl32_10200411`, also a mismatch on main): s13 is expected to be the same mask word in every lane (`0xb945de14`) and comes out per lane (`0` / `0xffffffff`). It reads a mask held in a scalar register, which may be the scalar follow-up mentioned in the PR notes; I did not trace it. The other fuzzers on main, same card, three seeds each, show nothing: `lds_fuzz` (400 native and 300 emulated programs per seed) and `valu_fuzz` f16 and mem (300 each) have 0 mismatches, and `image_fuzz` matches 300 of 300 per seed. AI-assisted: yes
whoalin1 commented 2026-11-25 08:15:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:15:59Z.


Pushed 8ece74e2a addressing the review findings (EXEC-coverage gating for mask-word gathers incl. the MoltenVK cs_mask_vgpr_exec ballot-under-EXEC case, scalar mask-number reads, and the wave64-emulate folded-region gaps).

Independent GPU verification on this head (RTX 4070 SUPER + AMD Radeon gfx1036 iGPU, LEONIDA_VK_VALIDATION=1):

  • cs_mask_vgpr_exec passes on both GPUs; --filter mask/exec curated shaders: AMD 12/12 + 8/8, NVIDIA same modulo wave64 skips; with LEONIDA_W64_EMULATE=1 on NVIDIA all 20 pass.
  • crosslane_fuzz seeds 101-103, 100 programs/seed, wave 64, modes plain / --ext / --ext --dpp: 0 mismatches, 0 rejected on both GPUs (baseline main had ~6-11 mismatches per 100-program run).
  • Semantic suite: 487 files, 6,289 tests, 0 failures.

AI-assisted work.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7156814373 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7156814373). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T08:15:59Z. --- Pushed `8ece74e2a` addressing the review findings (EXEC-coverage gating for mask-word gathers incl. the MoltenVK `cs_mask_vgpr_exec` ballot-under-EXEC case, scalar mask-number reads, and the wave64-emulate folded-region gaps). Independent GPU verification on this head (RTX 4070 SUPER + AMD Radeon gfx1036 iGPU, `LEONIDA_VK_VALIDATION=1`): - `cs_mask_vgpr_exec` passes on both GPUs; `--filter mask`/`exec` curated shaders: AMD 12/12 + 8/8, NVIDIA same modulo wave64 skips; with `LEONIDA_W64_EMULATE=1` on NVIDIA all 20 pass. - `crosslane_fuzz` seeds 101-103, 100 programs/seed, wave 64, modes plain / `--ext` / `--ext --dpp`: **0 mismatches, 0 rejected** on both GPUs (baseline main had ~6-11 mismatches per 100-program run). - Semantic suite: 487 files, 6,289 tests, 0 failures. AI-assisted work.
ecox982745 commented 2026-11-25 08:48:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T08:48:23Z.


8ece74e2a fixes the reported wave64 translation failure on my RTX 4090. I also found a wave32 regression relative to its immediate parent 142293b30: when EXEC comes from a register, a vector read of a previously computed mask can return just the current lane’s bit.

With all 32 lanes active, v_cmp_ne_u32_e64 s8, v5, 0 sets s8 to 0x05010204 (v5 contains the corresponding bit in each lane). Then set EXEC and run v_mov_b32_e32 v2, s8. Both variants below have identical runtime EXEC and use the same input and harness.

EXEC write on 8ece74e2a Lanes returning 0x05010204 Values read
s_mov_b32 exec_lo, -1 32/32 0x05010204
s_mov_b32 exec_lo, s4, with s4 = 0xffffffff 0/32 0 or 0xffffffff

Across the previous 25-dispatch test, the parent matched 800/800 lane results. The new head had 224 wrong lane results across 16 dispatches. This includes VCC and compare-written s8, with both move and XOR consumers. The unchanged cs_mask_vgpr_exec fixture passed. The literal/register pair above would make a regression test for the fallback in mask_word_read_ok.

I also replayed the two exact programs from the RTX 4050 report against the fuzzer’s CPU reference:

  • cs_xl64_10100316, emulated wave64: parent refused translation. Head translated, passed spirv-val, and matched all 896 checked words.
  • cs_xl32_10200411, native wave32: 64/896 words still differ on both revisions. The first expected 0xb945de14 and read zero. This is program 106 for seed 102 with a single wave size and the default 24 operations, beyond the reported 100-program sweep.

Windows, NVIDIA 616.64, LLVM 23.1.6. I rebuilt vk_compute_test at 8ece74e2a and reran both revisions with it. The 16 tests in the two changed semantic test files passed on CPU. AI-assisted verification using synthetic inputs.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157493595 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7157493595). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T08:48:23Z. --- `8ece74e2a` fixes the reported wave64 translation failure on my RTX 4090. I also found a wave32 regression relative to its immediate parent `142293b30`: when EXEC comes from a register, a vector read of a previously computed mask can return just the current lane’s bit. With all 32 lanes active, `v_cmp_ne_u32_e64 s8, v5, 0` sets `s8` to `0x05010204` (`v5` contains the corresponding bit in each lane). Then set EXEC and run `v_mov_b32_e32 v2, s8`. Both variants below have identical runtime EXEC and use the same input and harness. | EXEC write on `8ece74e2a` | Lanes returning `0x05010204` | Values read | | --- | ---: | --- | | `s_mov_b32 exec_lo, -1` | 32/32 | `0x05010204` | | `s_mov_b32 exec_lo, s4`, with `s4 = 0xffffffff` | 0/32 | `0` or `0xffffffff` | Across the [previous 25-dispatch test](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7148859256), the parent matched 800/800 lane results. The new head had 224 wrong lane results across 16 dispatches. This includes VCC and compare-written `s8`, with both move and XOR consumers. The unchanged `cs_mask_vgpr_exec` fixture passed. The literal/register pair above would make a regression test for the fallback in `mask_word_read_ok`. I also replayed the two exact programs from the RTX 4050 report against the fuzzer’s CPU reference: - `cs_xl64_10100316`, emulated wave64: parent refused translation. Head translated, passed `spirv-val`, and matched all 896 checked words. - `cs_xl32_10200411`, native wave32: 64/896 words still differ on both revisions. The first expected `0xb945de14` and read zero. This is program 106 for seed 102 with a single wave size and the default 24 operations, beyond the reported 100-program sweep. Windows, NVIDIA 616.64, LLVM 23.1.6. I rebuilt `vk_compute_test` at `8ece74e2a` and reran both revisions with it. The 16 tests in the two changed semantic test files passed on CPU. AI-assisted verification using synthetic inputs.
whoalin1 commented 2026-11-25 08:59:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:59:28Z.


Thanks ecox982745 — confirmed reading. The s_mov_b32 exec_lo, s4 (register-sourced EXEC) vs literal -1 divergence points at the mask_word_read_ok fallback treating a register-written EXEC mask as lane-local; a literal-vs-register EXEC pair is exactly the regression test we'll add. We're reproducing on the RTX 4070 SUPER + AMD gfx1036 iGPU, will fix on this branch, and re-verify both revisions' 16-dispatch sweep. Noted on cs_xl32_10200411 (seed 102 prog 106, native wave32, 64/896 words on both revisions) — tracking separately as it predates this fix. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157729437 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7157729437). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T08:59:28Z. --- Thanks ecox982745 — confirmed reading. The `s_mov_b32 exec_lo, s4` (register-sourced EXEC) vs literal `-1` divergence points at the `mask_word_read_ok` fallback treating a register-written EXEC mask as lane-local; a literal-vs-register EXEC pair is exactly the regression test we'll add. We're reproducing on the RTX 4070 SUPER + AMD gfx1036 iGPU, will fix on this branch, and re-verify both revisions' 16-dispatch sweep. Noted on `cs_xl32_10200411` (seed 102 prog 106, native wave32, 64/896 words on both revisions) — tracking separately as it predates this fix. AI-assisted.
Gefik23 commented 2026-11-25 09:19:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Gefik23 on 2026-11-25T09:19:10Z.


Tested 8ece74e2a with tools/crosslane_fuzz.py on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows. llvm-mc 21.1.8 (scripts\build_llvm_mc.ps1), vk_compute_test from main 3f81d46ac, --translator pointed at this PR's tools/rdna2spirv.py.

run main 3f81d46ac this PR
--programs 50 --seed 1 45 match, 4 mismatch, 1 hyp_only 49 match, 0 mismatch, 1 hyp_only
--programs 200 --seed 7, wave32 native 89 match, 9 mismatch, 2 hyp_only 91 match, 7 mismatch, 2 hyp_only
--programs 200 --seed 7, wave64 emulate 92 match, 6 mismatch, 2 hyp_only 100 match, 0 mismatch
--programs 50 --seed 1 --no-maskdata (main only) 50 match

So every wave64 mismatch on these seeds is gone. The 7 wave32 mismatches left (cs_xl32_7000{87,135,151,153,185,197,205}) also fail on main, so they are not regressions. With --minimize they all come down to a mask computed under one EXEC and read as data under a narrower one, which looks like the same family as the register-EXEC case above. The two shortest:

; cs_xl32_700087, group 20 (one partial wave32)
v_cmp_le_u32_e64 s18, v5, v7
s_mov_b32 exec_lo, 0x7ec2b
v_mov_b32_e32 v5, s18          ; expected 0x000fffff, got 0xffffffff
; cs_xl32_700152, group 20
v_cmp_ne_u32_e32 vcc_lo, 53, v3
v_cmpx_lt_u32_e32 9, v3
v_mov_b32_e32 v7, vcc_lo       ; expected 0x000fffff, got 0xffffffff

In both cases the bits of lanes 20..31, which are not in the group, read back as set. Full-wave groups fail the same way, for example cs_xl32_700032 (group 64): v_cmp_gt_u32_e64 s16, v2, v4 / v_cmpx_gt_u32_e32 31, v3 / v_mov_b32_e32 v7, s16. To reproduce: python -I tools/crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --translator <this PR>/tools/rdna2spirv.py --minimize.

AI-assisted (Claude Code ran the fuzzer and the reductions). No game files.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7158170424 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7158170424). Originally posted by [Gefik23](https://github.com/Gefik23) on 2026-11-25T09:19:10Z. --- Tested 8ece74e2a with `tools/crosslane_fuzz.py` on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows. llvm-mc 21.1.8 (`scripts\build_llvm_mc.ps1`), `vk_compute_test` from main 3f81d46ac, `--translator` pointed at this PR's `tools/rdna2spirv.py`. | run | main 3f81d46ac | this PR | |---|---|---| | `--programs 50 --seed 1` | 45 match, 4 mismatch, 1 hyp_only | 49 match, 0 mismatch, 1 hyp_only | | `--programs 200 --seed 7`, wave32 native | 89 match, 9 mismatch, 2 hyp_only | 91 match, 7 mismatch, 2 hyp_only | | `--programs 200 --seed 7`, wave64 emulate | 92 match, 6 mismatch, 2 hyp_only | 100 match, 0 mismatch | | `--programs 50 --seed 1 --no-maskdata` (main only) | 50 match | | So every wave64 mismatch on these seeds is gone. The 7 wave32 mismatches left (`cs_xl32_7000{87,135,151,153,185,197,205}`) also fail on main, so they are not regressions. With `--minimize` they all come down to a mask computed under one EXEC and read as data under a narrower one, which looks like the same family as the register-EXEC case above. The two shortest: ``` ; cs_xl32_700087, group 20 (one partial wave32) v_cmp_le_u32_e64 s18, v5, v7 s_mov_b32 exec_lo, 0x7ec2b v_mov_b32_e32 v5, s18 ; expected 0x000fffff, got 0xffffffff ``` ``` ; cs_xl32_700152, group 20 v_cmp_ne_u32_e32 vcc_lo, 53, v3 v_cmpx_lt_u32_e32 9, v3 v_mov_b32_e32 v7, vcc_lo ; expected 0x000fffff, got 0xffffffff ``` In both cases the bits of lanes 20..31, which are not in the group, read back as set. Full-wave groups fail the same way, for example `cs_xl32_700032` (group 64): `v_cmp_gt_u32_e64 s16, v2, v4` / `v_cmpx_gt_u32_e32 31, v3` / `v_mov_b32_e32 v7, s16`. To reproduce: `python -I tools/crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --translator <this PR>/tools/rdna2spirv.py --minimize`. AI-assisted (Claude Code ran the fuzzer and the reductions). No game files.
whoalin1 commented 2026-11-25 11:13:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T11:13:10Z.


Pushed ba315fbf1 fixing the wave32 register-EXEC regression @ecox982745 reported.

Root cause: Gen._mov_sgpr_vals handled exec/exec_lo/exec_hi sources only under clean/constant EXEC half-state — under an unknown narrowing (("n", tag)) it recorded nothing, so s_mov_b32 exec_lo, s4 minted a fresh tag and mask_word_read_ok denied the mask-word gather (per-lane 0/0xffffffff). The fix aliases the SGPR to the narrowing tag using the same ("al", ...) scheme s_*_saveexec already uses, which _exec_src_ex resolves — literal and register EXEC restores now behave identically.

New coverage: 2 semantic tests (wave32 + wave64 EXEC round-trip asserting the OpGroupNonUniformBitwiseOr gather) + cs_exec_copy GPU fixture storing mask word / exec_lo word / literal-restore word side by side.

Verification (RTX 4070 SUPER + AMD gfx1036 iGPU, LEONIDA_VK_VALIDATION=1): semantic suite 487 files / 6,291 tests / 0 failed; exec+mask filters and cs_exec_copy PASS on both GPUs with identical words; literal-vs-register now agree (out[0]==out[2]). Independent review APPROVEd (tests confirmed to fail on the parent translator). Re-running the narrowed-EXEC fuzz repros (cs_xl32_700087/700152/700032 family) to confirm coverage — will follow up. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160753383 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7160753383). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T11:13:10Z. --- Pushed `ba315fbf1` fixing the wave32 register-EXEC regression @ecox982745 reported. Root cause: `Gen._mov_sgpr_vals` handled `exec`/`exec_lo`/`exec_hi` *sources* only under clean/constant EXEC half-state — under an unknown narrowing (`("n", tag)`) it recorded nothing, so `s_mov_b32 exec_lo, s4` minted a fresh tag and `mask_word_read_ok` denied the mask-word gather (per-lane 0/0xffffffff). The fix aliases the SGPR to the narrowing tag using the same `("al", ...)` scheme `s_*_saveexec` already uses, which `_exec_src_ex` resolves — literal and register EXEC restores now behave identically. New coverage: 2 semantic tests (wave32 + wave64 EXEC round-trip asserting the `OpGroupNonUniformBitwiseOr` gather) + `cs_exec_copy` GPU fixture storing mask word / exec_lo word / literal-restore word side by side. Verification (RTX 4070 SUPER + AMD gfx1036 iGPU, `LEONIDA_VK_VALIDATION=1`): semantic suite 487 files / 6,291 tests / 0 failed; exec+mask filters and `cs_exec_copy` PASS on both GPUs with identical words; literal-vs-register now agree (`out[0]==out[2]`). Independent review APPROVEd (tests confirmed to fail on the parent translator). Re-running the narrowed-EXEC fuzz repros (cs_xl32_700087/700152/700032 family) to confirm coverage — will follow up. AI-assisted.
ecox982745 commented 2026-11-25 11:15:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T11:15:50Z.


I verified ba315fbf1 against its parent 8ece74e2a on the RTX 4090. The saved-EXEC round trip is fixed: the new cs_exec_copy fixture went from 32 wrong output words on the parent to 128/128 correct on the head. The original case from my earlier report still fails when EXEC is set from an independent SGPR after the comparison.

Here's a small way to reproduce that distinction using the PR's own cs_exec_copy.asm. Keep the expected outputs and the rest of the fixture as written:

 v_mov_b32_e32 v7, -1
 v_readfirstlane_b32 s7, v7
-s_mov_b32 exec_lo, s7
 v_and_b32 v1, 1, v0
 v_cmp_ne_u32_e64 s8, v1, 0
-s_mov_b32 s4, exec_lo
-s_mov_b32 exec_lo, s4
+s_mov_b32 exec_lo, s7
 v_mov_b32_e32 v2, s8

EXEC is full when the comparison defines s8 and is full again when the move reads it. With the edit, all 32 lanes get the first output word wrong: even lanes return zero, odd lanes return 0xffffffff, and all should return 0xaaaaaaaa. The other three fields match in every lane, including the EXEC word and the mask read after the literal restore.

The original five synthetic modules are byte-identical across these two commits. Re-running their 25 dispatches gave the same 224/800 wrong lane results across 16 dispatches. A diagnostic that reads the complete mask into a VGPR immediately after the compare, before changing EXEC, matched all 96 lane results across three full and partial EXEC patterns. This gives a passing control for investigating where the complete mask word can be preserved.

Native wave32, Windows 11, NVIDIA 616.64, LLVM 23.1.6. The edited fixture passed Vulkan 1.2 SPIR-V validation. All 16 CPU tests in test_lane_masks_vector_bitwise.py passed on the head. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160813725 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7160813725). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T11:15:50Z. --- I verified `ba315fbf1` against its parent `8ece74e2a` on the RTX 4090. The saved-EXEC round trip is fixed: the new `cs_exec_copy` fixture went from 32 wrong output words on the parent to **128/128 correct** on the head. The original case from [my earlier report](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7157493595) still fails when EXEC is set from an **independent** SGPR after the comparison. Here's a small way to reproduce that distinction using the PR's own `cs_exec_copy.asm`. Keep the expected outputs and the rest of the fixture as written: ```diff v_mov_b32_e32 v7, -1 v_readfirstlane_b32 s7, v7 -s_mov_b32 exec_lo, s7 v_and_b32 v1, 1, v0 v_cmp_ne_u32_e64 s8, v1, 0 -s_mov_b32 s4, exec_lo -s_mov_b32 exec_lo, s4 +s_mov_b32 exec_lo, s7 v_mov_b32_e32 v2, s8 ``` EXEC is full when the comparison defines `s8` and is full again when the move reads it. With the edit, **all 32 lanes get the first output word wrong**: even lanes return zero, odd lanes return `0xffffffff`, and all should return `0xaaaaaaaa`. The other three fields match in every lane, including the EXEC word and the mask read after the literal restore. The original five synthetic modules are byte-identical across these two commits. Re-running their 25 dispatches gave the same **224/800 wrong lane results across 16 dispatches**. A diagnostic that reads the complete mask into a VGPR immediately after the compare, before changing EXEC, matched all 96 lane results across three full and partial EXEC patterns. This gives a passing control for investigating where the complete mask word can be preserved. Native wave32, Windows 11, NVIDIA 616.64, LLVM 23.1.6. The edited fixture passed Vulkan 1.2 SPIR-V validation. All 16 CPU tests in `test_lane_masks_vector_bitwise.py` passed on the head. AI-assisted verification.
hugo0024 commented 2026-11-25 11:57:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hugo0024 on 2026-11-25T11:57:12Z.


Tested ba315fbf1 merged onto main bcaa13dad on an Apple M5 (MoltenVK 1.4.2, macOS 27.2.1), with the test programs built from that main. AI-assisted.

The fixtures on MoltenVK

run_gpu_tests.py --filter mask: 7/12 passed, 5 skipped. --filter exec: 6/9 passed, 3 skipped. cs_mask_vgpr_exec and the new cs_exec_copy pass; every skip is "no 64-wide compute subgroup on this device".

crosslane_fuzz.py --programs 200 --seed 31008 --wave 32 --dpp --ext (match / mismatch / hypothesis only)

Translator as it is with #953
main 168 / 25 / 7 175 / 20 / 5
b9cea5afb 200 / 0 / 0
8ece74e2a 180 / 16 / 4 188 / 10 / 2
ba315fbf1 180 / 16 / 4 188 / 10 / 2

#953 is the whole-wave mask gather that MoltenVK needs stored, so the right-hand column is the one to read on this driver. The b9cea5afb row was measured earlier today on main 3f81d46ac; the translator on main changed once since then (#1493).

The 12 programs left at ba315fbf1 are the same 12 as at 8ece74e2a, and all are the family @Gefik23 and @ecox982745 describe, a mask read by a VALU op after EXEC changed:

; group 50
v_cmp_ne_u32_e64 s20, v2, v4
s_mov_b32 exec_lo, 0x40f8
v_mov_b32_e32 v3, s20        ; active lanes of wave 1: expected 0x0003ffff, got 0xffffffff

What this run adds: all 12 matched at the first head, b9cea5afb. For the three I looked at (cs_xl32_3100893037, ..125, ..134), b9cea5afb emits two OpGroupNonUniformBitwiseOr and the two later heads emit no subgroup operation at all, as main does. So this family is not a MoltenVK effect, and the first head had it right.

wave64 emulate, --programs 150 --seed 31009 --wave 64 --modes emulate --dpp --ext: main 144 / 5 / 1, ba315fbf1 149 / 1 / 0, nothing rejected. The one left fails on main too, cs_xl64_3100993145 (group 40), minimised:

s_mov_b64 exec, s[20:21]     ; s[20:21] = 0: every lane is off
v_mov_b32_e32 v2, vcc_lo
v_xor_b32_e32 v2, v2, v2     ; v2 expected unchanged, got 0 in all 40 lanes

Not tested: any other GPU, and the game corpus.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7161724336 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7161724336). Originally posted by [hugo0024](https://github.com/hugo0024) on 2026-11-25T11:57:12Z. --- Tested `ba315fbf1` merged onto main `bcaa13dad` on an Apple M5 (MoltenVK 1.4.2, macOS 27.2.1), with the test programs built from that main. AI-assisted. **The fixtures on MoltenVK** `run_gpu_tests.py --filter mask`: 7/12 passed, 5 skipped. `--filter exec`: 6/9 passed, 3 skipped. `cs_mask_vgpr_exec` and the new `cs_exec_copy` pass; every skip is "no 64-wide compute subgroup on this device". **`crosslane_fuzz.py --programs 200 --seed 31008 --wave 32 --dpp --ext`** (match / mismatch / hypothesis only) | Translator | as it is | with #953 | |---|---|---| | main | 168 / 25 / 7 | 175 / 20 / 5 | | `b9cea5afb` | | 200 / 0 / 0 | | `8ece74e2a` | 180 / 16 / 4 | 188 / 10 / 2 | | `ba315fbf1` | 180 / 16 / 4 | 188 / 10 / 2 | #953 is the whole-wave mask gather that MoltenVK needs stored, so the right-hand column is the one to read on this driver. The `b9cea5afb` row was measured earlier today on main `3f81d46ac`; the translator on main changed once since then (#1493). The 12 programs left at `ba315fbf1` are the same 12 as at `8ece74e2a`, and all are the family @Gefik23 and @ecox982745 describe, a mask read by a VALU op after EXEC changed: ```text ; group 50 v_cmp_ne_u32_e64 s20, v2, v4 s_mov_b32 exec_lo, 0x40f8 v_mov_b32_e32 v3, s20 ; active lanes of wave 1: expected 0x0003ffff, got 0xffffffff ``` What this run adds: all 12 matched at the first head, `b9cea5afb`. For the three I looked at (`cs_xl32_3100893037`, `..125`, `..134`), `b9cea5afb` emits two `OpGroupNonUniformBitwiseOr` and the two later heads emit no subgroup operation at all, as main does. So this family is not a MoltenVK effect, and the first head had it right. **wave64 emulate**, `--programs 150 --seed 31009 --wave 64 --modes emulate --dpp --ext`: main 144 / 5 / 1, `ba315fbf1` 149 / 1 / 0, nothing rejected. The one left fails on main too, `cs_xl64_3100993145` (group 40), minimised: ```text s_mov_b64 exec, s[20:21] ; s[20:21] = 0: every lane is off v_mov_b32_e32 v2, vcc_lo v_xor_b32_e32 v2, v2, v2 ; v2 expected unchanged, got 0 in all 40 lanes ``` Not tested: any other GPU, and the game corpus.
EvgHaze commented 2026-11-25 13:11:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-25T13:11:39Z.


Apple check of the new cs_exec_copy fixture, on both drivers.

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 cs_exec — identical words on both drivers, 3/3 passed:

Test Words
cs_exec64 0 0 0 0 0 0 0 0
cs_exec_const 16 8 2 16 0 16
cs_exec_copy (new) 2863311530 4294967295 2863311530 0 2863311530 4294967295 2863311530 1

python3 -I scripts/run_semantic_tests.py tests/semantic → 489 files, 6300 tests, 0 failed (main is 6288, so this diff adds twelve), 143 s.

Both Apple drivers run these at subgroup size 32 natively, so the lane-mask-as-data read is not being emulated in either run. MoltenVK's SPIRV-Cross path and KosmicKrisp's nir_to_msl path agree word for word.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7163424028 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7163424028). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-25T13:11:39Z. --- Apple check of the new `cs_exec_copy` fixture, on both drivers. ```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 cs_exec` — **identical words on both drivers**, 3/3 passed: | Test | Words | |---|---| | `cs_exec64` | `0 0 0 0 0 0 0 0` | | `cs_exec_const` | `16 8 2 16 0 16` | | **`cs_exec_copy`** (new) | `2863311530 4294967295 2863311530 0 2863311530 4294967295 2863311530 1` | `python3 -I scripts/run_semantic_tests.py tests/semantic` → **489 files, 6300 tests, 0 failed** (main is 6288, so this diff adds twelve), 143 s. Both Apple drivers run these at subgroup size 32 natively, so the lane-mask-as-data read is not being emulated in either run. MoltenVK's SPIRV-Cross path and KosmicKrisp's `nir_to_msl` path agree word for word. AI-assisted. No game data: hand-written fixtures, and the numbers above are test output.
GeorgiyDemo commented 2026-11-25 14:14:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T14:14:18Z.


Follow-up: the regression I reported at 3ec97f53e (cs_mask_vgpr_exec: 15 15 15 15 … on MoltenVK) is gone at ba315fbf1 on the same machine where it reproduced — Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), MoltenVK 1.4.2, binaries from the build at 66d4f5aa3:

  • cs_mask_vgpr_exec PASS: 4294967295 4294967295 4294967295 4294967295 3735928559 3735928559 3735928559 3735928559 on MoltenVK and the same on KosmicKrisp (Mesa 26.3.1).
  • --filter mask: 7/12 passed, 5 skipped, 0 failed (all skips are "no 64-wide compute subgroup on this device").
  • --filter cs_exec: 3/3 PASS, including the new cs_exec_copy (2863311530 4294967295 2863311530 0 …), same words as the M3 run.
  • The four semantic files (test_lane_masks_vector_bitwise, test_salu64_bitwise_data, test_salu_movrels_lane_mask, test_scselect_b64_data): OK.

So this is fixed on macOS 26.7.3 as well, not just on the 27.x runs above.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7164969152 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7164969152). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T14:14:18Z. --- Follow-up: the regression I reported at `3ec97f53e` (`cs_mask_vgpr_exec`: `15 15 15 15 …` on MoltenVK) is **gone at `ba315fbf1`** on the same machine where it reproduced — Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), MoltenVK 1.4.2, binaries from the build at `66d4f5aa3`: - `cs_mask_vgpr_exec` **PASS**: `4294967295 4294967295 4294967295 4294967295 3735928559 3735928559 3735928559 3735928559` on **MoltenVK** and the same on **KosmicKrisp** (Mesa 26.3.1). - `--filter mask`: **7/12 passed, 5 skipped, 0 failed** (all skips are "no 64-wide compute subgroup on this device"). - `--filter cs_exec`: **3/3 PASS**, including the new `cs_exec_copy` (`2863311530 4294967295 2863311530 0 …`), same words as the M3 run. - The four semantic files (`test_lane_masks_vector_bitwise`, `test_salu64_bitwise_data`, `test_salu_movrels_lane_mask`, `test_scselect_b64_data`): **OK**. So this is fixed on macOS 26.7.3 as well, not just on the 27.x runs above. AI-assisted; synthetic fixtures only, no game data.
aslan2142 commented 2026-11-25 16:37:40 +00:00 (Migrated from github.com)

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


Thanks, @whoalin1. The saved-EXEC round trip is fixed. Open points:

  • The independent-SGPR EXEC case from ecox982745 still gives each lane its own bit: 0/32 on the CPU interpreter, the same as main.
  • hugo0024 found 12 fuzz programs that matched at b9cea5afb and mismatch now.
  • This overlaps #1043 (SHADER-MASK-AS-DATA), which was claimed first. Please compare the two, or coordinate with its author.
  • Please name the model in the AI note.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7168282146 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7168282146). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T16:37:40Z. --- Thanks, @whoalin1. The saved-EXEC round trip is fixed. Open points: - The independent-SGPR EXEC case from ecox982745 still gives each lane its own bit: 0/32 on the CPU interpreter, the same as `main`. - hugo0024 found 12 fuzz programs that matched at `b9cea5afb` and mismatch now. - This overlaps #1043 (SHADER-MASK-AS-DATA), which was claimed first. Please compare the two, or coordinate with its author. - Please name the model in the AI note. AI-assisted (Claude Code, Claude Opus 5.5).
ecox982745 commented 2026-11-25 16:47:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T16:47:11Z.


I compared #1043 (4d58a05d6) and #1397 (ba315fbf1) for the independent-EXEC case in the review above. I merged each PR separately onto main at 9e7720c9e locally and ran the same synthetic wave32 shaders on an RTX 4090, Windows 11, NVIDIA 616.64. Both merges were clean. This is GPU readback using the same executable for all three builds.

GPU check main main + #1043 main + #1397
Saved EXEC, original cs_exec_copy (correct output words / 128) 64 128 128
Independent SGPR, edited fixture (correct first mask word / 32 lanes) 0 32 0
Independent EXEC, v_mov_b32 (dispatches passing / 12) 4 12 4
Independent EXEC, v_xor_b32 (dispatches passing / 12) 4 4 4

The move and XOR rows each cover six runtime mask pairs for each of two sources, VCC and compare-written s8. Adding the stock cs_mask_vgpr_exec control gives 9/25, 17/25 and 9/25 passing dispatches respectively. Across those 25 dispatches, #1043 reduced incorrect lane values from 224 to 112, all in XOR. Every module passed Vulkan 1.2 SPIR-V validation, and every readback guard was intact.

For the overlapping fixes, #1043's handling of v_mov_b32 already covers both EXEC fixtures here. The XOR row gives a separate regression target for the remaining arithmetic use of a mask. This comparison covers native wave32 on this GPU. AI-assisted verification with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7168529355 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7168529355). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T16:47:11Z. --- I compared #1043 (`4d58a05d6`) and #1397 (`ba315fbf1`) for the independent-EXEC case in [the review above](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7168282146). I merged each PR separately onto `main` at `9e7720c9e` locally and ran the same synthetic wave32 shaders on an RTX 4090, Windows 11, NVIDIA 616.64. Both merges were clean. This is GPU readback using the same executable for all three builds. | GPU check | main | main + #1043 | main + #1397 | | --- | ---: | ---: | ---: | | Saved EXEC, original `cs_exec_copy` (correct output words / 128) | 64 | 128 | 128 | | Independent SGPR, [edited fixture](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7160813725) (correct first mask word / 32 lanes) | 0 | 32 | 0 | | Independent EXEC, `v_mov_b32` (dispatches passing / 12) | 4 | 12 | 4 | | Independent EXEC, `v_xor_b32` (dispatches passing / 12) | 4 | 4 | 4 | The move and XOR rows each cover six runtime mask pairs for each of two sources, VCC and compare-written `s8`. Adding the stock `cs_mask_vgpr_exec` control gives **9/25, 17/25 and 9/25** passing dispatches respectively. Across those 25 dispatches, #1043 reduced incorrect lane values from 224 to 112, all in XOR. Every module passed Vulkan 1.2 SPIR-V validation, and every readback guard was intact. For the overlapping fixes, #1043's handling of `v_mov_b32` already covers both EXEC fixtures here. The XOR row gives a separate regression target for the remaining arithmetic use of a mask. This comparison covers native wave32 on this GPU. AI-assisted verification with OpenAI Codex.
whoalin1 commented 2026-11-25 17:07:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T17:07:24Z.


Pushed 52fb23042. This reworks the narrowed-EXEC side rather than extending the coverage proof:

  • includes #953's eager wave-mask gather (hugo0024's authorship preserved), because the gather must not be hidden inside an EXEC-selected arm by lowering;
  • removes the EXEC-coverage gate and its CFG provenance analysis. EXEC narrowing is per-lane data in this model, not SPIR-V control flow; lanes off in EXEC still hold bits of the wave-wide mask register and must contribute them;
  • adds semantic coverage for narrowed SGPR/VCC reads, an independent all-ones SGPR EXEC restore, and vector-bitwise mask composition.

Verified here (no game files):

  • run_semantic_tests.py tests/semantic: 488 files, 6298 tests, 0 files failed; compileall, tests/test_lane_masks.py, and check_no_game_data passed.
  • NVIDIA RTX 4070 SUPER, Windows 11: crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --modes native 199 match / 1 mismatch / 0 hyp-only (was 186 / 9 / 5 at ba315fbf1); seed 102, 106 programs 105 / 1 / 0 (was 100 / 3 / 3).
  • AMD Ryzen 5 7600 RDNA2 iGPU gfx1036, driver 24.10.24, Windows 11, pc-tail UBO harness: seed 7 199 / 1 / 0, exactly the same single residual program as NVIDIA.

The residual is cs_xl32_700032, minimized to v_cmp + v_cmpx + maskdata v_mov + v_xor; it is an inactive-EXEC write-predication case that already mismatched before this work, not the narrowed-but-nonzero EXEC mask-word family. cs_xl32_10200411 also remains in the seed-102 stream and starts with exec_lo = 0, a separate no-active-lane/readfirstlane control-flow case.

On overlap: #1043 currently fixes the independent-EXEC v_mov cases but not arithmetic v_xor in ecox982745's comparison. This head is intended to cover mask data reads uniformly; I have not merged or duplicated #1043's follow-forward VGPR-copy analysis.

AI-assisted (SWE-2.1 Max).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169038429 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7169038429). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T17:07:24Z. --- Pushed `52fb23042`. This reworks the narrowed-EXEC side rather than extending the coverage proof: - includes #953's eager wave-mask gather (hugo0024's authorship preserved), because the gather must not be hidden inside an EXEC-selected arm by lowering; - removes the EXEC-coverage gate and its CFG provenance analysis. EXEC narrowing is per-lane data in this model, not SPIR-V control flow; lanes off in EXEC still hold bits of the wave-wide mask register and must contribute them; - adds semantic coverage for narrowed SGPR/VCC reads, an independent all-ones SGPR EXEC restore, and vector-bitwise mask composition. Verified here (no game files): - `run_semantic_tests.py tests/semantic`: **488 files, 6298 tests, 0 files failed**; `compileall`, `tests/test_lane_masks.py`, and `check_no_game_data` passed. - NVIDIA RTX 4070 SUPER, Windows 11: `crosslane_fuzz.py --programs 200 --seed 7 --wave 32 --modes native` **199 match / 1 mismatch / 0 hyp-only** (was 186 / 9 / 5 at `ba315fbf1`); seed 102, 106 programs **105 / 1 / 0** (was 100 / 3 / 3). - AMD Ryzen 5 7600 RDNA2 iGPU gfx1036, driver 24.10.24, Windows 11, pc-tail UBO harness: seed 7 **199 / 1 / 0**, exactly the same single residual program as NVIDIA. The residual is `cs_xl32_700032`, minimized to `v_cmp` + `v_cmpx` + maskdata `v_mov` + `v_xor`; it is an inactive-EXEC write-predication case that already mismatched before this work, not the narrowed-but-nonzero EXEC mask-word family. `cs_xl32_10200411` also remains in the seed-102 stream and starts with `exec_lo = 0`, a separate no-active-lane/readfirstlane control-flow case. On overlap: #1043 currently fixes the independent-EXEC `v_mov` cases but not arithmetic `v_xor` in ecox982745's comparison. This head is intended to cover mask data reads uniformly; I have not merged or duplicated #1043's follow-forward VGPR-copy analysis. AI-assisted (SWE-2.1 Max).
EvgHaze commented 2026-11-25 17:11:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-25T17:11:03Z.


Apple run of the new head 52fb23042, on both drivers.

Machine:  Apple M3, 10-core, macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2 (driver id 14, subgroup 4..32)
          KosmicKrisp, Mesa 26.3.1 (driver id 28, subgroup 32..32)
Base:     main `0d80bc5` + this head, clean `git apply`
Check MoltenVK KosmicKrisp
--filter cs_exec 3/3 PASS 3/3 PASS
cs_exec_copy words 2863311530 4294967295 2863311530 0 2863311530 4294967295 2863311530 1 identical
--filter mask (non-64-wide) all PASS —
cs_mask_vgpr_exec 4294967295 4294967295 4294967295 4294967295 3735928559 3735928559 3735928559 3735928559 —
semantic suite 490 files, 6307 tests, 0 failed —

Two things worth stating plainly:

  1. The rework did not move the saved-EXEC words on Apple — they are the same eight that @ecox982745 used as the correct row in the #1043 comparison, so this head still passes that case on a 32-wide host.
  2. The independent-SGPR and independent-EXEC cases in that table are not repo fixtures — they come from an edited cs_exec_copy, so my run does not cover them and I am not claiming it does. If you paste that fixture or point at a branch with it, I will run it on this machine in the same two drivers and add the row.

AI-assisted. No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169130400 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7169130400). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-25T17:11:03Z. --- Apple run of the new head `52fb23042`, on both drivers. ```text Machine: Apple M3, 10-core, macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2 (driver id 14, subgroup 4..32) KosmicKrisp, Mesa 26.3.1 (driver id 28, subgroup 32..32) Base: main `0d80bc5` + this head, clean `git apply` ``` | Check | MoltenVK | KosmicKrisp | |---|---|---| | `--filter cs_exec` | **3/3 PASS** | **3/3 PASS** | | `cs_exec_copy` words | `2863311530 4294967295 2863311530 0 2863311530 4294967295 2863311530 1` | identical | | `--filter mask` (non-64-wide) | all PASS | — | | `cs_mask_vgpr_exec` | `4294967295 4294967295 4294967295 4294967295 3735928559 3735928559 3735928559 3735928559` | — | | semantic suite | `490 files, 6307 tests, 0 failed` | — | Two things worth stating plainly: 1. The rework did not move the saved-EXEC words on Apple — they are the same eight that @ecox982745 used as the correct row in the #1043 comparison, so this head still passes that case on a 32-wide host. 2. The **independent-SGPR and independent-EXEC cases in that table are not repo fixtures** — they come from an edited `cs_exec_copy`, so my run does not cover them and I am not claiming it does. If you paste that fixture or point at a branch with it, I will run it on this machine in the same two drivers and add the row. AI-assisted. No game data.
ecox982745 commented 2026-11-25 17:15:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T17:15:31Z.


@EvgHaze, here are the synthetic fixtures for the Apple run. On the RTX 4090, 52fb23042 passes 25/25 dispatches (800/800 lane results), up from 9/25 on ba315fbf1. The independent-EXEC move and XOR rows both pass 12/12. The separate saved-EXEC and independent-SGPR fixtures each pass 128/128 output words. All readback guards were intact. This closes the two failing rows from my earlier comparison on this GPU.

I ran the PR head directly with native wave32 on Windows 11, NVIDIA 616.64. I also translated all seven programs after merging this head onto the same main (9e7720c9e) used in the comparison. All seven SPIR-V modules matched the ones dispatched byte for byte and passed Vulkan 1.2 validation.

Independent SGPR fixture and all-lane check

Save as runtime/test/shaders/cs_exec_copy_independent.asm.

; group: 32,1,1
; mattr: +wavefrontsize32,-wavefrontsize64
v_mov_b32_e32 v7, -1
v_readfirstlane_b32 s7, v7
v_and_b32 v1, 1, v0
v_cmp_ne_u32_e64 s8, v1, 0
s_mov_b32 exec_lo, s7
v_mov_b32_e32 v2, s8
v_mov_b32_e32 v4, exec_lo
s_mov_b32 exec_lo, -1
v_mov_b32_e32 v5, s8
v_lshlrev_b32_e32 v3, 4, v0
v_mov_b32_e32 v20, v2
v_mov_b32_e32 v21, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v4
v_add_nc_u32_e32 v21, 4, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v5
v_add_nc_u32_e32 v21, 8, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v0
v_add_nc_u32_e32 v21, 12, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
s_endpgm

From the repo root, with your usual driver and push-constant settings and vk_compute_test on PATH, run the following for each driver. The last command checks the full result, including 16 guard words.

mask_dir=$(mktemp -d)
python3 -I runtime/test/shaders/build.py "$mask_dir" cs_exec_copy_independent &&
VKC_SUBGROUP_SIZE=32 VKC_OUT_WORDS=144 VKC_DUMP="$mask_dir/independent.raw" vk_compute_test "$mask_dir/spirv/cs_exec_copy_independent.spv" 1 dump &&
python3 - "$mask_dir/independent.raw" <<'PY'
from pathlib import Path
import struct
import sys
actual = struct.unpack("<144I", Path(sys.argv[1]).read_bytes())
expected = tuple(w for lane in range(32) for w in (0xaaaaaaaa, 0xffffffff, 0xaaaaaaaa, lane))
assert actual == expected + (0xeeeeeeee,) * 16
print("128/128 output words and all guard words match")
PY
Independent-EXEC move and XOR rows

This is the exact s8 XOR shader. For the move variant, replace only v_xor_b32_e32 v2, s8, v7 with v_mov_b32_e32 v2, s8. For the VCC pair, replace s8 with vcc_lo in the compare and the consumer. Build each name with the same build.py command as above.

; group: 32,1,1
; rsrc2: 0x8090
v_mbcnt_lo_u32_b32 v1, -1, 0
v_mov_b32_e32 v2, 0xdeadbeef
v_mov_b32_e32 v5, s5
v_lshrrev_b32_e32 v5, v1, v5
v_and_b32_e32 v5, 1, v5
v_mov_b32_e32 v7, 0x12345678
v_cmp_ne_u32_e64 s8, v5, 0
s_mov_b32 exec_lo, s4
v_xor_b32_e32 v2, s8, v7
s_mov_b32 exec_lo, -1
v_lshlrev_b32_e32 v3, 2, v1
buffer_store_dword v2, v3, s[0:3], 0 offen
s_endpgm

Run each variant once per pair below, setting VKC_SGPRS=s4,s5 to the two literal hex values, VKC_SUBGROUP_SIZE=32 and VKC_OUT_WORDS=64. For lane i, when bit i of s4 is set, expect s5 for the move or s5 ^ 0x12345678 for XOR. Otherwise expect 0xdeadbeef. Words 32–63 keep the harness fill 0xeeeeeeee.

s4           s5
0x0000000f   0xffffffff
0x0000000f   0xaaaaaaaa
0xf0000000   0x80000001
0x55555555   0xaaaaaaaa
0xffffffff   0x05010204
0x00000000   0x05010204

AI-assisted verification with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169238536 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7169238536). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T17:15:31Z. --- @EvgHaze, here are the synthetic fixtures for the Apple run. On the RTX 4090, `52fb23042` passes **25/25 dispatches (800/800 lane results)**, up from 9/25 on `ba315fbf1`. The independent-EXEC move and XOR rows both pass 12/12. The separate saved-EXEC and independent-SGPR fixtures each pass 128/128 output words. All readback guards were intact. This closes the two failing rows from my [earlier comparison](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7168529355) on this GPU. I ran the PR head directly with native wave32 on Windows 11, NVIDIA 616.64. I also translated all seven programs after merging this head onto the same `main` (`9e7720c9e`) used in the comparison. All seven SPIR-V modules matched the ones dispatched byte for byte and passed Vulkan 1.2 validation. <details><summary>Independent SGPR fixture and all-lane check</summary> Save as `runtime/test/shaders/cs_exec_copy_independent.asm`. ```asm ; group: 32,1,1 ; mattr: +wavefrontsize32,-wavefrontsize64 v_mov_b32_e32 v7, -1 v_readfirstlane_b32 s7, v7 v_and_b32 v1, 1, v0 v_cmp_ne_u32_e64 s8, v1, 0 s_mov_b32 exec_lo, s7 v_mov_b32_e32 v2, s8 v_mov_b32_e32 v4, exec_lo s_mov_b32 exec_lo, -1 v_mov_b32_e32 v5, s8 v_lshlrev_b32_e32 v3, 4, v0 v_mov_b32_e32 v20, v2 v_mov_b32_e32 v21, v3 buffer_store_dword v20, v21, s[0:3], 0 offen v_mov_b32_e32 v20, v4 v_add_nc_u32_e32 v21, 4, v3 buffer_store_dword v20, v21, s[0:3], 0 offen v_mov_b32_e32 v20, v5 v_add_nc_u32_e32 v21, 8, v3 buffer_store_dword v20, v21, s[0:3], 0 offen v_mov_b32_e32 v20, v0 v_add_nc_u32_e32 v21, 12, v3 buffer_store_dword v20, v21, s[0:3], 0 offen s_endpgm ``` From the repo root, with your usual driver and push-constant settings and `vk_compute_test` on PATH, run the following for each driver. The last command checks the full result, including 16 guard words. ```sh mask_dir=$(mktemp -d) python3 -I runtime/test/shaders/build.py "$mask_dir" cs_exec_copy_independent && VKC_SUBGROUP_SIZE=32 VKC_OUT_WORDS=144 VKC_DUMP="$mask_dir/independent.raw" vk_compute_test "$mask_dir/spirv/cs_exec_copy_independent.spv" 1 dump && python3 - "$mask_dir/independent.raw" <<'PY' from pathlib import Path import struct import sys actual = struct.unpack("<144I", Path(sys.argv[1]).read_bytes()) expected = tuple(w for lane in range(32) for w in (0xaaaaaaaa, 0xffffffff, 0xaaaaaaaa, lane)) assert actual == expected + (0xeeeeeeee,) * 16 print("128/128 output words and all guard words match") PY ``` </details> <details><summary>Independent-EXEC move and XOR rows</summary> This is the exact `s8` XOR shader. For the move variant, replace only `v_xor_b32_e32 v2, s8, v7` with `v_mov_b32_e32 v2, s8`. For the VCC pair, replace `s8` with `vcc_lo` in the compare and the consumer. Build each name with the same `build.py` command as above. ```asm ; group: 32,1,1 ; rsrc2: 0x8090 v_mbcnt_lo_u32_b32 v1, -1, 0 v_mov_b32_e32 v2, 0xdeadbeef v_mov_b32_e32 v5, s5 v_lshrrev_b32_e32 v5, v1, v5 v_and_b32_e32 v5, 1, v5 v_mov_b32_e32 v7, 0x12345678 v_cmp_ne_u32_e64 s8, v5, 0 s_mov_b32 exec_lo, s4 v_xor_b32_e32 v2, s8, v7 s_mov_b32 exec_lo, -1 v_lshlrev_b32_e32 v3, 2, v1 buffer_store_dword v2, v3, s[0:3], 0 offen s_endpgm ``` Run each variant once per pair below, setting `VKC_SGPRS=s4,s5` to the two literal hex values, `VKC_SUBGROUP_SIZE=32` and `VKC_OUT_WORDS=64`. For lane `i`, when bit `i` of `s4` is set, expect `s5` for the move or `s5 ^ 0x12345678` for XOR. Otherwise expect `0xdeadbeef`. Words 32–63 keep the harness fill `0xeeeeeeee`. ```text s4 s5 0x0000000f 0xffffffff 0x0000000f 0xaaaaaaaa 0xf0000000 0x80000001 0x55555555 0xaaaaaaaa 0xffffffff 0x05010204 0x00000000 0x05010204 ``` </details> AI-assisted verification with OpenAI Codex.
mrgenty commented 2026-11-25 18:03:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-25T18:03:11Z.


Tested 52fb23042 with crosslane_fuzz.py on an NVIDIA GeForce RTX 3060 (NVIDIA 621.24, Windows 11 build 26300, subgroup 32..32). One program is left, reduced to four instructions below.

Setup: vk_compute_test and the fuzzer (with its model) from main b0f3d399, --translator pointed at each tree's tools/rdna2spirv.py, llvm-mc 21.1.8 (scripts\build_llvm_mc.ps1), Vulkan SDK 1.4.363.0. No game files.

python -I tools/crosslane_fuzz.py --programs 200 --seed 25112501 --wave both --dpp --ext --translator <tree>/tools/rdna2spirv.py
tree wave32 native (100) wave64 emulate (100)
main b0f3d399 8 mismatches, 3 hyp_only 2 mismatches, 4 hyp_only
#1043 4d58a05d6 3 mismatches 1 mismatch
this PR 52fb23042 1 mismatch 0

With --no-maskdata, main matches 400/400 in both modes on this card (seed 73190611), so the masks-as-data programs are the only ones that differ here.

The one left here: cs_xl32_2511325437669, wave32, group 20. --minimize gives:

v_cmp_eq_u32_e64 s20, v1, v4      ; no lane is equal: s20 = 0
s_and_saveexec_b32 s24, s20       ; EXEC = 0
v_mov_b32_e32 v3, s20             ; no lane is active, so v3 keeps its old data
v_readfirstlane_b32 s14, v3       ; EXEC = 0: lane 0's v3

v3 was seeded as lane + 0xd4718f66. The model expects s14 = 0xd4718f66 in every lane, lane 0's untouched v3. This head returns 0x00018f66 in all 20 lanes, which is that value ANDed with 0xfffff, the 20 lanes of the group. So it looks as if the v_readfirstlane reads v3 as a mask word because a v_mov from a mask reaches it, although that v_mov wrote no lane. I did not trace it in the translator, so take the cause as a guess; the numbers are measured.

It is not a regression: main fails the same program differently (each lane gets its own v3, so only lane 0 is right), and #1043 returns 0x000fffff.

For comparison, the four programs #1043 leaves on this seed reduce to a v_mov_b32 of a mask followed by v_readfirstlane_b32 (three wave32 cases, one with EXEC set to 0 first) and to v_mov_b32 v3, s21 of the high half of a s[20:21] mask under --wave64-emulate. This PR matches all four.

Not tested: native wave64 (this card has no 64-wide subgroup), other seeds on this head, and the semantic suite.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7170371126 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7170371126). Originally posted by [mrgenty](https://github.com/mrgenty) on 2026-11-25T18:03:11Z. --- Tested `52fb23042` with `crosslane_fuzz.py` on an NVIDIA GeForce RTX 3060 (NVIDIA 621.24, Windows 11 build 26300, subgroup 32..32). One program is left, reduced to four instructions below. Setup: `vk_compute_test` and the fuzzer (with its model) from main `b0f3d399`, `--translator` pointed at each tree's `tools/rdna2spirv.py`, llvm-mc 21.1.8 (`scripts\build_llvm_mc.ps1`), Vulkan SDK 1.4.363.0. No game files. ``` python -I tools/crosslane_fuzz.py --programs 200 --seed 25112501 --wave both --dpp --ext --translator <tree>/tools/rdna2spirv.py ``` | tree | wave32 native (100) | wave64 emulate (100) | |---|---|---| | main `b0f3d399` | 8 mismatches, 3 hyp_only | 2 mismatches, 4 hyp_only | | #1043 `4d58a05d6` | 3 mismatches | 1 mismatch | | this PR `52fb23042` | **1 mismatch** | **0** | With `--no-maskdata`, main matches 400/400 in both modes on this card (seed 73190611), so the masks-as-data programs are the only ones that differ here. **The one left here**: `cs_xl32_2511325437669`, wave32, group 20. `--minimize` gives: ``` v_cmp_eq_u32_e64 s20, v1, v4 ; no lane is equal: s20 = 0 s_and_saveexec_b32 s24, s20 ; EXEC = 0 v_mov_b32_e32 v3, s20 ; no lane is active, so v3 keeps its old data v_readfirstlane_b32 s14, v3 ; EXEC = 0: lane 0's v3 ``` `v3` was seeded as `lane + 0xd4718f66`. The model expects `s14 = 0xd4718f66` in every lane, lane 0's untouched `v3`. This head returns `0x00018f66` in all 20 lanes, which is that value ANDed with `0xfffff`, the 20 lanes of the group. So it looks as if the `v_readfirstlane` reads `v3` as a mask word because a `v_mov` from a mask reaches it, although that `v_mov` wrote no lane. I did not trace it in the translator, so take the cause as a guess; the numbers are measured. It is not a regression: main fails the same program differently (each lane gets its own `v3`, so only lane 0 is right), and #1043 returns `0x000fffff`. For comparison, the four programs #1043 leaves on this seed reduce to a `v_mov_b32` of a mask followed by `v_readfirstlane_b32` (three wave32 cases, one with EXEC set to 0 first) and to `v_mov_b32 v3, s21` of the high half of a `s[20:21]` mask under `--wave64-emulate`. This PR matches all four. Not tested: native wave64 (this card has no 64-wide subgroup), other seeds on this head, and the semantic suite. AI-assisted (Claude Code).
ecox982745 commented 2026-11-25 18:16:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T18:16:32Z.


I narrowed down the RTX 3060 result on an RTX 4090. It also happens when both the move and the read have active lanes. This gives a regression test independent of the semantics of a read with empty EXEC.

On 52fb23042, seed v3 with 0xd4718f66 + lane, let only lane 7 overwrite its own v3, then restore full EXEC before reading lane 0. The shader stores both v3 directly and the word returned through s14. Lane 0's direct word is correct in all three group sizes.

Threads in the group Direct lane 0 word Word broadcast through s14
8 0xd4718f66 0x00000066
20 0xd4718f66 0x00018f66
32 0xd4718f66 0xd4718f66
v_add_nc_u32_e32 v3, 0xd4718f66, v0   ; v0 is the local lane index
v_cmp_eq_u32_e64 s20, s4, v0          ; dispatch input s4 = 7
s_and_saveexec_b32 s24, s20
v_mov_b32_e32 v3, s20                 ; only lane 7 writes
s_mov_b32 exec_lo, s5                 ; dispatch input s5 = 0xffffffff
v_readfirstlane_b32 s14, v3           ; lane 0 supplies its original word
s_mov_b32 exec_lo, -1
v_mov_b32_e32 v4, s14                 ; store v3 and v4 side by side

Removing only the predicated v_mov gave the full expected broadcast in all 12 control dispatches. Selecting lane 7 as the reader after only lane 3 wrote gave the same truncation at group sizes 8 and 20. Reading lane 7 after lane 7 itself wrote gave the expected 0x80 in all three sizes.

In the 20-thread module, OpGroupNonUniformShuffle broadcasts the word, then a shift and AND extract one bit per lane. The s14 consumer rebuilds the word with OpGroupNonUniformBitwiseOr … Reduce. A 20-thread group can supply only bits 0–19 to that reduction. This points to preserving the full scalar value through this read when the selected lane retains ordinary data. Read-first-lane lowering on the tested head

Native wave32, Windows 11, NVIDIA 616.64. Six synthetic modules per revision passed Vulkan 1.2 validation, with all readback guards intact. Baseline 9e7720c9e also fails the 20-thread live-move case, returning different words across lanes. AI-assisted verification with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7170685090 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7170685090). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T18:16:32Z. --- I narrowed down [the RTX 3060 result](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7170371126) on an RTX 4090. **It also happens when both the move and the read have active lanes.** This gives a regression test independent of the semantics of a read with empty EXEC. On `52fb23042`, seed `v3` with `0xd4718f66 + lane`, let only lane 7 overwrite its own `v3`, then restore full EXEC before reading lane 0. The shader stores both `v3` directly and the word returned through `s14`. Lane 0's direct word is correct in all three group sizes. | Threads in the group | Direct lane 0 word | Word broadcast through `s14` | | ---: | ---: | ---: | | 8 | `0xd4718f66` | `0x00000066` | | 20 | `0xd4718f66` | `0x00018f66` | | 32 | `0xd4718f66` | `0xd4718f66` | ```asm v_add_nc_u32_e32 v3, 0xd4718f66, v0 ; v0 is the local lane index v_cmp_eq_u32_e64 s20, s4, v0 ; dispatch input s4 = 7 s_and_saveexec_b32 s24, s20 v_mov_b32_e32 v3, s20 ; only lane 7 writes s_mov_b32 exec_lo, s5 ; dispatch input s5 = 0xffffffff v_readfirstlane_b32 s14, v3 ; lane 0 supplies its original word s_mov_b32 exec_lo, -1 v_mov_b32_e32 v4, s14 ; store v3 and v4 side by side ``` Removing only the predicated `v_mov` gave the full expected broadcast in all 12 control dispatches. Selecting lane 7 as the reader after only lane 3 wrote gave the same truncation at group sizes 8 and 20. Reading lane 7 after lane 7 itself wrote gave the expected `0x80` in all three sizes. In the 20-thread module, `OpGroupNonUniformShuffle` broadcasts the word, then a shift and AND extract one bit per lane. The `s14` consumer rebuilds the word with `OpGroupNonUniformBitwiseOr … Reduce`. A 20-thread group can supply only bits 0–19 to that reduction. This points to preserving the full scalar value through this read when the selected lane retains ordinary data. [Read-first-lane lowering on the tested head](https://github.com/ubiquitarianism/leonida/blob/52fb230420be4efeac9778a361b3c6e0882f52f4/tools/rdna2spirv.py#L7940) Native wave32, Windows 11, NVIDIA 616.64. Six synthetic modules per revision passed Vulkan 1.2 validation, with all readback guards intact. Baseline `9e7720c9e` also fails the 20-thread live-move case, returning different words across lanes. AI-assisted verification with OpenAI Codex.
whoalin1 commented 2026-11-25 19:33:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T19:33:38Z.


Thanks for narrowing this down. I agree with the interpretation that this is a mixed-provenance case rather than a regression introduced by 52fb23042: your baseline control also fails the live-move case.

The current model has one static provenance for the whole VGPR. lane_masks.py already special-cases the copy shape: a v_mov_b32 of a mask into a VGPR is an ordinary EXEC-gated VALU write, not an all-lanes mask computation, so inactive lanes keep their old data. But after that write the register can contain the mask word in some lanes and ordinary data in others. When v_readfirstlane later selects a lane, the correct result depends on which kind of value that selected lane retained. The present translator cannot represent that lane-dependent provenance, so it chooses the mask interpretation for the whole register and rebuilds only the mask bits — exactly the 8/20-thread truncation you measured.

I do not see a small sound fix inside this PR without tracking which lanes of the VGPR received the mask word (or otherwise carrying per-lane provenance) through the copy and the first-lane selection. Since the case exists on main as well, my preference is to treat it as a follow-up rather than block the lane-mask data-read improvement here. If others prefer, I can write the finding up separately with your reduced shader as the reproducer.

AI-assisted analysis with Devin.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172465267 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7172465267). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T19:33:38Z. --- Thanks for narrowing this down. I agree with the interpretation that this is a mixed-provenance case rather than a regression introduced by `52fb23042`: your baseline control also fails the live-move case. The current model has one static provenance for the whole VGPR. `lane_masks.py` already special-cases the copy shape: a `v_mov_b32` of a mask into a VGPR is an ordinary EXEC-gated VALU write, not an all-lanes mask computation, so inactive lanes keep their old data. But after that write the register can contain the mask word in some lanes and ordinary data in others. When `v_readfirstlane` later selects a lane, the correct result depends on which kind of value that selected lane retained. The present translator cannot represent that lane-dependent provenance, so it chooses the mask interpretation for the whole register and rebuilds only the mask bits — exactly the 8/20-thread truncation you measured. I do not see a small sound fix inside this PR without tracking which lanes of the VGPR received the mask word (or otherwise carrying per-lane provenance) through the copy and the first-lane selection. Since the case exists on main as well, my preference is to treat it as a follow-up rather than block the lane-mask data-read improvement here. If others prefer, I can write the finding up separately with your reduced shader as the reproducer. AI-assisted analysis with Devin.
whoalin1 commented 2026-11-25 22:38:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T22:38:14Z.


Rebased onto current main (581ddba5d) and pushed as e3e119a46; GitHub now reports the PR mergeable again. The only conflicts were the fixture-list intersections with the newly merged cs_w32_wrxchg2* / cs_w64x_partial_swizzle entries; resolution keeps both those and cs_exec_copy.

Post-rebase verification on this machine:

  • python -m compileall -q make_game.py tools tests scripts/run_gpu_tests.py runtime/test/shaders/check.py — pass.
  • python -I scripts/run_semantic_tests.py tests/semantic — 493 files, 6,334 tests, 0 files failed in 345 s (Python 3.14).
  • python -I scripts/run_gpu_tests.py --filter cs_exec_copy --require-pass — pass on both GPUs, with LEONIDA_VK_VALIDATION=1 and spirv-val clean:
    • AMD Radeon Graphics (Ryzen 5 7600 RDNA2 iGPU, 128-byte push constants, AMD Windows driver 24.10.24): cs_exec_copy PASS, exact words.
    • NVIDIA RTX 4070 SUPER (driver 610.88): cs_exec_copy PASS, identical exact words.

No game files used. AI-assisted with Devin.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7176607606 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7176607606). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T22:38:14Z. --- Rebased onto current `main` (`581ddba5d`) and pushed as `e3e119a46`; GitHub now reports the PR mergeable again. The only conflicts were the fixture-list intersections with the newly merged `cs_w32_wrxchg2*` / `cs_w64x_partial_swizzle` entries; resolution keeps both those and `cs_exec_copy`. Post-rebase verification on this machine: - `python -m compileall -q make_game.py tools tests scripts/run_gpu_tests.py runtime/test/shaders/check.py` — pass. - `python -I scripts/run_semantic_tests.py tests/semantic` — **493 files, 6,334 tests, 0 files failed** in 345 s (Python 3.14). - `python -I scripts/run_gpu_tests.py --filter cs_exec_copy --require-pass` — pass on both GPUs, with `LEONIDA_VK_VALIDATION=1` and spirv-val clean: - AMD Radeon Graphics (Ryzen 5 7600 RDNA2 iGPU, 128-byte push constants, AMD Windows driver 24.10.24): `cs_exec_copy` PASS, exact words. - NVIDIA RTX 4070 SUPER (driver 610.88): `cs_exec_copy` PASS, identical exact words. No game files used. AI-assisted with Devin.
whoalin1 commented 2026-11-26 05:01:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T05:01:04Z.


Additional AMD evidence on the current head e3e119a46f. Same synthetic crosslane slice before/after, no game files:

  • Environment: Windows, AMD RDNA2 Radeon iGPU (128-byte push-constant device), validation on, VK_LOADER_DRIVERS_SELECT selecting the AMD Vulkan driver, LEONIDA_PC_TAIL_UBO=1.
  • Current main a73a57e13, seed 14 wave64-emulate slice (26 programs, --dpp --ext): 23 match, 1 non-hypothesis mismatch (cs_xl64_1400067), 1 hypothesis-only mismatch (cs_xl64_1400059). The companion wave32-native half was 25/25 clean.
  • With this PR's translator on the identical generated wave64 slice: 26/26 match, 0 mismatch, 0 hypothesis-only, 0 harness errors.

So this PR fixes both seed-14 wave64-emulate divergences on AMD, including the non-hypothesis cs_xl64_1400067 case.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7183104364 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7183104364). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-26T05:01:04Z. --- Additional AMD evidence on the current head e3e119a46f. Same synthetic crosslane slice before/after, no game files: - Environment: Windows, AMD RDNA2 Radeon iGPU (128-byte push-constant device), validation on, VK_LOADER_DRIVERS_SELECT selecting the AMD Vulkan driver, LEONIDA_PC_TAIL_UBO=1. - Current main a73a57e13, seed 14 wave64-emulate slice (26 programs, --dpp --ext): 23 match, 1 non-hypothesis mismatch (cs_xl64_1400067), 1 hypothesis-only mismatch (cs_xl64_1400059). The companion wave32-native half was 25/25 clean. - With this PR's translator on the identical generated wave64 slice: 26/26 match, 0 mismatch, 0 hypothesis-only, 0 harness errors. So this PR fixes both seed-14 wave64-emulate divergences on AMD, including the non-hypothesis cs_xl64_1400067 case.
EvgHaze commented 2026-11-26 05:58:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-26T05:58:21Z.


@ecox982745 ran your five fixtures on the Apple side, at this head (e3e119a46), on both drivers.

Machine:  Apple M3, 10-core, macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2 (subgroup 4..32) and KosmicKrisp, Mesa 26.3.1 (32..32)
Tree:     whoalin1/leonida-continued `mask-regs-data-read` @ e3e119a46, `runtime/build`, 33 `vk_*` tools
Fixtures: your `cs_exec_copy_independent`, plus the XOR and move shaders with `s8` and with `vcc_lo`, built by `runtime/test/shaders/build.py`, all five `spirv-val` clean
Run:      `VKC_SUBGROUP_SIZE=32`, `VKC_OUT_WORDS=144` for the independent fixture and 64 for the pairs, `VKC_DUMP` readback, your expected words and guard words
Check MoltenVK 1.4.2 KosmicKrisp 26.3.1
independent SGPR fixture PASS, 128/128 output words + 16 guard words PASS, same
move, s8 (6 SGPR pairs) PASS, 6/6 PASS, 6/6
XOR, s8 (6 SGPR pairs) PASS, 6/6 PASS, 6/6
move, vcc_lo (6 SGPR pairs) PASS, 6/6 PASS, 6/6
XOR, vcc_lo (6 SGPR pairs) PASS, 6/6 PASS, 6/6
total 25/25 25/25

Every lane value and 0xeeeeeeee fill word matches, and both drivers agree word for word — a 32-wide host runs these natively, so nothing here goes through wave64 emulation.

Two notes on reproducing it:

  • v_cmp_ne_u32_e64 vcc_lo, v5, 0 (your VCC variant) assembles, but the move variant has to drop the v7 operand — v_mov_b32_e32 v2, s8, not v_mov_b32_e32 v2, s8, v7; with three operands llvm-mc rejects it.
  • I did not run the baseline on this machine, so I am not claiming the main-side numbers; on Apple both drivers pass the head, which is what the row was for.

AI-assisted. No game data: hand-written shaders, and every number above is a readback comparison.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7183972057 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7183972057). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-26T05:58:21Z. --- @ecox982745 ran your five fixtures on the Apple side, at this head (`e3e119a46`), on both drivers. ```text Machine: Apple M3, 10-core, macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2 (subgroup 4..32) and KosmicKrisp, Mesa 26.3.1 (32..32) Tree: whoalin1/leonida-continued `mask-regs-data-read` @ e3e119a46, `runtime/build`, 33 `vk_*` tools Fixtures: your `cs_exec_copy_independent`, plus the XOR and move shaders with `s8` and with `vcc_lo`, built by `runtime/test/shaders/build.py`, all five `spirv-val` clean Run: `VKC_SUBGROUP_SIZE=32`, `VKC_OUT_WORDS=144` for the independent fixture and 64 for the pairs, `VKC_DUMP` readback, your expected words and guard words ``` | Check | MoltenVK 1.4.2 | KosmicKrisp 26.3.1 | |---|---|---| | independent SGPR fixture | **PASS**, 128/128 output words + 16 guard words | **PASS**, same | | move, `s8` (6 SGPR pairs) | **PASS**, 6/6 | **PASS**, 6/6 | | XOR, `s8` (6 SGPR pairs) | **PASS**, 6/6 | **PASS**, 6/6 | | move, `vcc_lo` (6 SGPR pairs) | **PASS**, 6/6 | **PASS**, 6/6 | | XOR, `vcc_lo` (6 SGPR pairs) | **PASS**, 6/6 | **PASS**, 6/6 | | **total** | **25/25** | **25/25** | Every lane value and `0xeeeeeeee` fill word matches, and both drivers agree word for word — a 32-wide host runs these natively, so nothing here goes through wave64 emulation. Two notes on reproducing it: - `v_cmp_ne_u32_e64 vcc_lo, v5, 0` (your VCC variant) assembles, but the **move** variant has to drop the `v7` operand — `v_mov_b32_e32 v2, s8`, not `v_mov_b32_e32 v2, s8, v7`; with three operands llvm-mc rejects it. - I did not run the baseline on this machine, so I am not claiming the main-side numbers; on Apple both drivers pass the head, which is what the row was for. AI-assisted. No game data: hand-written shaders, and every number above is a readback comparison.
ecox982745 commented 2026-11-26 06:19:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T06:19:31Z.


@sdelectron, I checked the six seed-1 cases you reported on the RTX 5080 against this PR on a physical RTX 4090. All six also differ from the CPU reference on current main. All six match after merging this PR locally. That includes the three read-first-lane cases (100023, 100075, 100014), parked lane access (100026), the prefix count (100034), and the 18-lane tail mask (100077). For the last case main returned 0xffffffff where the reference has 0x0003ffff. Seed-1 coordination reports

Unchanged seed-1 inputs Main a73a57e13 Main + PR head e3e119a46
Native wave32 programs matching 45/50 50/50
Emulated wave64 programs matching 45/50 50/50
Output words differing from the CPU model 422/103,180 0/103,180

I used main's crosslane_fuzz.py generator and reference (--seed 1 --programs 100 --wave both, default 24 ops), assembled the inputs once and ran both sets with the same vk_compute_test built from main. Six of the ten main-side mismatches were ordinary model comparisons. The other four programs contain an operation the fuzzer marks as a hypothesis. All 200 dispatched modules passed Vulkan 1.2 SPIR-V validation and ran with Khronos validation enabled. Windows 11, NVIDIA 616.64. The clean merge tree was dd50d3bb2bb09f7d406a90cc0c534a5af48f6300.

I also retested the separate lane-7 fixture on that merge tree to check what remains for the mixed-provenance claim. After only lane 7 writes a mask to its vector register and full EXEC is restored, the direct lane values are all correct. The broadcast of lane 0 should give 0xd4718f66; it still gives 0x00000066 for 8 threads and 0x00018f66 for 20. The 32-thread case and all three controls without the predicated move pass; all guard words stayed intact. This smaller fixture still exercises the outstanding bug even though the full seed-1 corpus now passes.

AI-assisted verification (OpenAI Codex). All shaders and inputs were synthetic.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7184318604 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7184318604). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-26T06:19:31Z. --- @sdelectron, I checked the six seed-1 cases you reported on the RTX 5080 against this PR on a physical RTX 4090. **All six also differ from the CPU reference on current main. All six match after merging this PR locally.** That includes the three read-first-lane cases (`100023`, `100075`, `100014`), parked lane access (`100026`), the prefix count (`100034`), and the 18-lane tail mask (`100077`). For the last case main returned `0xffffffff` where the reference has `0x0003ffff`. [Seed-1 coordination reports](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7183993600) | Unchanged seed-1 inputs | Main `a73a57e13` | Main + PR head `e3e119a46` | | --- | ---: | ---: | | Native wave32 programs matching | 45/50 | 50/50 | | Emulated wave64 programs matching | 45/50 | 50/50 | | Output words differing from the CPU model | 422/103,180 | 0/103,180 | I used main's `crosslane_fuzz.py` generator and reference (`--seed 1 --programs 100 --wave both`, default 24 ops), assembled the inputs once and ran both sets with the same `vk_compute_test` built from main. Six of the ten main-side mismatches were ordinary model comparisons. The other four programs contain an operation the fuzzer marks as a hypothesis. All 200 dispatched modules passed Vulkan 1.2 SPIR-V validation and ran with Khronos validation enabled. Windows 11, NVIDIA 616.64. The clean merge tree was `dd50d3bb2bb09f7d406a90cc0c534a5af48f6300`. I also retested the [separate lane-7 fixture](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7170685090) on that merge tree to check what remains for the mixed-provenance claim. After only lane 7 writes a mask to its vector register and full EXEC is restored, the direct lane values are all correct. The broadcast of lane 0 should give `0xd4718f66`; it still gives `0x00000066` for 8 threads and `0x00018f66` for 20. The 32-thread case and all three controls without the predicated move pass; all guard words stayed intact. This smaller fixture still exercises the outstanding bug even though the full seed-1 corpus now passes. AI-assisted verification (OpenAI Codex). All shaders and inputs were synthetic.
Christopher-Sundeby commented 2026-11-26 13:14:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Christopher-Sundeby on 2026-11-26T13:14:42Z.


Verified on NVIDIA: this pull request clears 19 of the 20 crosslane_fuzz mismatches that main gives on four seeds, with no new ones. The one left is the known cs_xl64_200065.

Setup: RTX 3060 Ti (subgroup 32), NVIDIA 621.24, Windows 11, MSVC vk_compute_test. The head e3e119a46 merges cleanly onto main a73a57e13. llvm-mc 21.1.8 (AMDGPU), --programs 100 --wave both (50 wave32 native + 50 wave64 emulate per seed), translator oracle.

seed main mismatches (w32 / w64 emu) main hypothesis-only this PR mismatches (w32 / w64 emu) this PR hypothesis-only
1 3 / 3 2 / 2 0 / 0 0 / 0
2 2 / 5 2 / 1 0 / 1 0 / 0
3 3 / 1 2 / 1 0 / 0 0 / 0
7 1 / 1 2 / 2 0 / 0 0 / 0
  • The remaining one is cs_xl64_200065 (seed 2, wave64 emulate, s10 expected 0x0000008c, got 0x00000000). That is sdelectron's repro of the outstanding SHADER-READFIRSTLANE-MIXED-PROVENANCE part, so it is not new.
  • A two-instruction repro from seed 7 (cs_xl64_700024, wave64 emulate) that this pull request fixes:
    v_cmp_ge_u32_e32 vcc, 8, v1
    v_mov_b32_e32 v2, vcc_hi      ; main: 0xffffffff, model: 0x00000000
    
  • python -I scripts/run_semantic_tests.py tests/semantic on the merged tree: 499 files, 6,370 tests, 0 files failed (262 s, 32 jobs).
  • The other families on main with the same setup (seed 41, 100 programs, native and emulated) are clean: valu_fuzz f16 and mem, lds_fuzz, image_fuzz (seed 42), f32_fuzz (seed 42, 200 programs).

No game files. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7193071364 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7193071364). Originally posted by [Christopher-Sundeby](https://github.com/Christopher-Sundeby) on 2026-11-26T13:14:42Z. --- Verified on NVIDIA: this pull request clears 19 of the 20 `crosslane_fuzz` mismatches that `main` gives on four seeds, with no new ones. The one left is the known `cs_xl64_200065`. **Setup:** RTX 3060 Ti (subgroup 32), NVIDIA 621.24, Windows 11, MSVC `vk_compute_test`. The head e3e119a46 merges cleanly onto `main` a73a57e13. llvm-mc 21.1.8 (AMDGPU), `--programs 100 --wave both` (50 wave32 native + 50 wave64 emulate per seed), translator oracle. | seed | `main` mismatches (w32 / w64 emu) | `main` hypothesis-only | this PR mismatches (w32 / w64 emu) | this PR hypothesis-only | |---|---|---|---|---| | 1 | 3 / 3 | 2 / 2 | 0 / 0 | 0 / 0 | | 2 | 2 / 5 | 2 / 1 | 0 / **1** | 0 / 0 | | 3 | 3 / 1 | 2 / 1 | 0 / 0 | 0 / 0 | | 7 | 1 / 1 | 2 / 2 | 0 / 0 | 0 / 0 | - The remaining one is `cs_xl64_200065` (seed 2, wave64 emulate, `s10` expected `0x0000008c`, got `0x00000000`). That is sdelectron's repro of the outstanding SHADER-READFIRSTLANE-MIXED-PROVENANCE part, so it is not new. - A two-instruction repro from seed 7 (`cs_xl64_700024`, wave64 emulate) that this pull request fixes: ``` v_cmp_ge_u32_e32 vcc, 8, v1 v_mov_b32_e32 v2, vcc_hi ; main: 0xffffffff, model: 0x00000000 ``` - `python -I scripts/run_semantic_tests.py tests/semantic` on the merged tree: 499 files, 6,370 tests, 0 files failed (262 s, 32 jobs). - The other families on `main` with the same setup (seed 41, 100 programs, native and emulated) are clean: `valu_fuzz` f16 and mem, `lds_fuzz`, `image_fuzz` (seed 42), `f32_fuzz` (seed 42, 200 programs). No game files. AI-assisted (Claude Code).
qhukz13 commented 2026-11-26 14:14:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-26T14:14:36Z.


I checked e3e119a46 merged onto main a73a57e13 (no conflicts), CPU only, on Linux with Python 3.14. The GPU side is well covered above, but every run there is crosslane_fuzz compute. This adds the mesh stage under --wave64-emulate: 128-thread NGG mesh shaders (two waves) are the "VS as MS" path the world-load draws take. I ran them in spirv_mini_interp.run_workgroup on 32-wide subgroups and compared each thread's exported position with a hand model.

The bug is there on the mesh path too, and this fixes it. Take v_cmp_gt_u32 vcc, 40, v0, then v_mov_b32 v6, vcc_lo:

  • on main, lanes 40-63 of wave 0 get 0 instead of the word 0xffffffff;
  • v_cmp_gt_u32_e64 s[10:11], 40, v0 followed by s_add_u32 s20, s10, 1 is wrong on the same 24 lanes.

With this PR both are right, in the structured form and in the forced round-loop form.

No regressions on the mesh path:

  • 17 hand-written mesh programs, 34 runs, give the same correct words as on main, in both forms:
    • waterfall v_readfirstlane / s_and_saveexec loops;
    • execnz, v_cmpx and VCC-vote latches;
    • loops whose trip count differs between the two waves;
    • s_barrier + LDS inside a loop;
    • a wave skipping to s_endpgm.
  • s_cmp_eq/lg/lt_u32 and s_bitcmp1_b32 on a mask word, into s_cselect_b32 or a branch, are right on both trees. I had wondered whether MASK_NUMBER_READERS needs the compares, and it does not.
  • tools/cf_diff.py's programs as 2-wave mesh shaders: 300 programs (seeds 21-22, depth 3), each in the default form, the forced round-loop form and without the extra s_barrier. That is 900 runs, 350 of them in the round-loop form: 900 match cf_ref, with no non-uniform barrier and no runaway loop.
  • The full translator suite, on the PR merged onto main 73516a290 (Windows 10, Python, 24 jobs): 499 files, 6,370 tests, 0 files failed.

Cost, for the record. Each mask-as-data read site adds one exchange segment under --wave64-emulate. The scheduler switch goes 2 → 3 cases for a single v_mov_b32 v, vcc_lo, and 5 → 6 for one inside a loop, plus 2 workgroup atomics. The static OpControlBarrier count is unchanged, but in the round-loop form an extra segment is an extra round at run time. That includes v_mov_b32 v6, exec_lo with EXEC still full, which main already got right. If a census ever shows these reads are common in the mesh corpus, the gather could be skipped where lane_masks proves the mask is all ones or zero. That is not a reason to hold this.

On #1043: plamea's seed-1 sweep (#1608) and the runs above have this PR covering everything #1043 does, plus the v_readfirstlane cases, and #1043 is 553 commits behind. I would merge this one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7194483421 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7194483421). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-26T14:14:36Z. --- I checked `e3e119a46` merged onto main `a73a57e13` (no conflicts), CPU only, on Linux with Python 3.14. The GPU side is well covered above, but every run there is `crosslane_fuzz` compute. This adds the **mesh stage under `--wave64-emulate`**: 128-thread NGG mesh shaders (two waves) are the "VS as MS" path the world-load draws take. I ran them in `spirv_mini_interp.run_workgroup` on 32-wide subgroups and compared each thread's exported position with a hand model. **The bug is there on the mesh path too, and this fixes it.** Take `v_cmp_gt_u32 vcc, 40, v0`, then `v_mov_b32 v6, vcc_lo`: - on main, lanes 40-63 of wave 0 get `0` instead of the word `0xffffffff`; - `v_cmp_gt_u32_e64 s[10:11], 40, v0` followed by `s_add_u32 s20, s10, 1` is wrong on the same 24 lanes. With this PR both are right, in the structured form and in the forced round-loop form. **No regressions on the mesh path:** - 17 hand-written mesh programs, 34 runs, give the same correct words as on main, in both forms: - waterfall `v_readfirstlane` / `s_and_saveexec` loops; - `execnz`, `v_cmpx` and VCC-vote latches; - loops whose trip count differs between the two waves; - `s_barrier` + LDS inside a loop; - a wave skipping to `s_endpgm`. - `s_cmp_eq/lg/lt_u32` and `s_bitcmp1_b32` on a mask word, into `s_cselect_b32` or a branch, are right on both trees. I had wondered whether `MASK_NUMBER_READERS` needs the compares, and it does not. - `tools/cf_diff.py`'s programs as 2-wave mesh shaders: 300 programs (seeds 21-22, depth 3), each in the default form, the forced round-loop form and without the extra `s_barrier`. That is 900 runs, 350 of them in the round-loop form: **900 match** `cf_ref`, with no non-uniform barrier and no runaway loop. - The full translator suite, on the PR merged onto main `73516a290` (Windows 10, Python, 24 jobs): **499 files, 6,370 tests, 0 files failed**. **Cost, for the record.** Each mask-as-data read site adds one exchange segment under `--wave64-emulate`. The scheduler switch goes 2 → 3 cases for a single `v_mov_b32 v, vcc_lo`, and 5 → 6 for one inside a loop, plus 2 workgroup atomics. The static `OpControlBarrier` count is unchanged, but in the round-loop form an extra segment is an extra round at run time. That includes `v_mov_b32 v6, exec_lo` with EXEC still full, which main already got right. If a census ever shows these reads are common in the mesh corpus, the gather could be skipped where `lane_masks` proves the mask is all ones or zero. That is not a reason to hold this. On #1043: plamea's seed-1 sweep (#1608) and the runs above have this PR covering everything #1043 does, plus the `v_readfirstlane` cases, and #1043 is 553 commits behind. I would merge this one. AI-assisted (Claude Code).
kawaii-shakal commented 2026-11-27 10:02:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T10:02:13Z.


Independent check of e3e119a under --wave64-emulate, by Claude Code (AI-assisted) on my behalf. Linux, Mesa
lavapipe (llvmpipe, LLVM 19.1.7, 8-lane subgroups; emulated wave64 uses no subgroup operations, so it is judged
there, docs/shader_validation.md "Subgroup size").

tools/crosslane_fuzz.py --wave 64 --modes emulate --dpp --ext (main's fuzzer, --translator pointed at this
head):

seed, programs main d1dff794 this head
205, 150 143 match, 5 mismatch, 2 hyp_only 150 match
311, 300 286 match, 10 mismatch, 4 hyp_only 300 match

Every one of main's 21 failing programs has a mask read as data (maskdata); none is left here, and nothing is
rejected. Minimized on main, the shortest are:

  • s_bfm_b64 s[18:19], 47, 49 / v_mov_b32_e32 v3, s19 (group 192): expected 0xfffe0000 in every lane, main
    gives 0 or 0xffffffff per lane. s_bfm_b64 is not mentioned in this thread, so this may be a useful fixture.
  • v_cmp_gt_u32_e32 vcc, 51, v1 / v_mov_b32_e32 v3, vcc_hi (group 64): expected 0x0007ffff.
  • v_cmp_ne_u32_e64 s[18:19], v7, v4 / s_and_b64 s[20:21], ... / v_mov_b32_e32 v5, s21 in a group of 100
    (a partial second wave): expected 0x0000000f in wave 1.

No regressions seen on this head (each its own seed): tests/semantic 493 files / 6,334 tests, 0 failed;
lds_fuzz.py --wave 64 --emulate 150/150; valu_fuzz.py --family mem --wave 64 --emulate 120/120;
cf_diff.py --wave 64 300/300. Native wave32 was not run (lavapipe can't pin 32-lane subgroups), and no hardware
GPU. The branch now conflicts with main.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7215397141 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1397#issuecomment-7215397141). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-27T10:02:13Z. --- Independent check of e3e119a under `--wave64-emulate`, by Claude Code (AI-assisted) on my behalf. Linux, Mesa lavapipe (llvmpipe, LLVM 19.1.7, 8-lane subgroups; emulated wave64 uses no subgroup operations, so it is judged there, docs/shader_validation.md "Subgroup size"). `tools/crosslane_fuzz.py --wave 64 --modes emulate --dpp --ext` (main's fuzzer, `--translator` pointed at this head): | seed, programs | main d1dff794 | this head | |---|---|---| | 205, 150 | 143 match, 5 mismatch, 2 hyp_only | 150 match | | 311, 300 | 286 match, 10 mismatch, 4 hyp_only | 300 match | Every one of main's 21 failing programs has a mask read as data (`maskdata`); none is left here, and nothing is rejected. Minimized on main, the shortest are: - `s_bfm_b64 s[18:19], 47, 49` / `v_mov_b32_e32 v3, s19` (group 192): expected 0xfffe0000 in every lane, main gives 0 or 0xffffffff per lane. `s_bfm_b64` is not mentioned in this thread, so this may be a useful fixture. - `v_cmp_gt_u32_e32 vcc, 51, v1` / `v_mov_b32_e32 v3, vcc_hi` (group 64): expected 0x0007ffff. - `v_cmp_ne_u32_e64 s[18:19], v7, v4` / `s_and_b64 s[20:21], ...` / `v_mov_b32_e32 v5, s21` in a group of 100 (a partial second wave): expected 0x0000000f in wave 1. No regressions seen on this head (each its own seed): `tests/semantic` 493 files / 6,334 tests, 0 failed; `lds_fuzz.py --wave 64 --emulate` 150/150; `valu_fuzz.py --family mem --wave 64 --emulate` 120/120; `cf_diff.py --wave 64` 300/300. Native wave32 was not run (lavapipe can't pin 32-lane subgroups), and no hardware GPU. The branch now conflicts with main. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-11-28 03:00:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T03:00:57Z.


Hi @whoalin1, thanks for this pull request. It currently conflicts with main (conflicting file(s): scripts/run_gpu_tests.py, tools/rdna2spirv.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232738053 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7232738053). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T03:00:57Z. --- Hi @whoalin1, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `scripts/run_gpu_tests.py`, `tools/rdna2spirv.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
ecox982745 commented 2026-11-28 23:03:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T23:03:44Z.


On the rebased #1397 head (5c37f5fd98), I verified the sparse EXEC arithmetic case reported on gfx906 in #2357 on a desktop RTX 4090. This PR fixes reading EXEC as the numeric operand of an add or subtract with carry. A separate wave32 carry-input problem still needs #1943 when a scalar move writes VCC.

I used synthetic v_add_co_ci_u32, v_sub_co_ci_u32 and v_subrev_co_ci_u32 shaders with two sparse execution masks and one full mask. Each has a control that supplies the same numeric word through an ordinary scalar register. This table counts wrong active-lane arithmetic results on the EXEC-source cases when a vector comparison sets the carry bits.

Execution mode Current main / PR base adfb3821a #1397 5c37f5fd98
Native wave32, numeric exec_lo 42 / 138 0 / 138
Emulated wave64, numeric exec_lo or exec_hi 168 / 552 0 / 552

The scalar-register controls matched on both trees. For example, with exec_lo=0x42048005, lane 0 adding 0xbadc0fee with carry-in 1 returned 0xbadc0fee on main and the expected 0xfce08ff4 on the PR.

I then loaded packed carry bits into VCC with a scalar move. On wave32, #1397 alone still had 75/138 wrong results even with the ordinary scalar source control. Applying #1943 alone fixed that control, but the EXEC-source version still had 42/138 wrong. On the clean combined tree 143e52b57e (#1397 plus #1943 head c82d668d0a), all 54 packed-carry cases matched, including the emulated high-half and ordinary-register controls. Inactive lanes remained untouched, all guard words held, and the generated modules passed Vulkan 1.2 SPIR-V validation.

Windows, NVIDIA 616.64, physical subgroup width 32. Coordination claim. AI-assisted verification with OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247171740 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7247171740). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T23:03:44Z. --- On the rebased #1397 head (`5c37f5fd98`), I verified the [sparse EXEC arithmetic case reported on gfx906 in #2357](https://github.com/ProjectLeonida/mandy/pull/2357#issuecomment-7239407390) on a desktop RTX 4090. This PR fixes reading EXEC as the numeric operand of an add or subtract with carry. A separate wave32 carry-input problem still needs [#1943](https://github.com/ProjectLeonida/mandy/pull/1943) when a scalar move writes VCC. I used synthetic `v_add_co_ci_u32`, `v_sub_co_ci_u32` and `v_subrev_co_ci_u32` shaders with two sparse execution masks and one full mask. Each has a control that supplies the same numeric word through an ordinary scalar register. This table counts **wrong active-lane arithmetic results** on the EXEC-source cases when a vector comparison sets the carry bits. | Execution mode | Current main / PR base `adfb3821a` | #1397 `5c37f5fd98` | | --- | ---: | ---: | | Native wave32, numeric `exec_lo` | 42 / 138 | 0 / 138 | | Emulated wave64, numeric `exec_lo` or `exec_hi` | 168 / 552 | 0 / 552 | The scalar-register controls matched on both trees. For example, with `exec_lo=0x42048005`, lane 0 adding `0xbadc0fee` with carry-in 1 returned `0xbadc0fee` on main and the expected `0xfce08ff4` on the PR. I then loaded packed carry bits into VCC with a scalar move. On wave32, #1397 alone still had 75/138 wrong results **even with the ordinary scalar source control**. Applying #1943 alone fixed that control, but the EXEC-source version still had 42/138 wrong. On the clean combined tree `143e52b57e` (#1397 plus #1943 head `c82d668d0a`), all 54 packed-carry cases matched, including the emulated high-half and ordinary-register controls. Inactive lanes remained untouched, all guard words held, and the generated modules passed Vulkan 1.2 SPIR-V validation. Windows, NVIDIA 616.64, physical subgroup width 32. [Coordination claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7247123828). AI-assisted verification with OpenAI Codex (GPT-6).
zmasi commented 2026-11-29 02:37:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:37:19Z.


#1397 | head 5c37f5fd98 (merged cleanly onto origin/main c8bf0e7b65) | Windows 11 (10.0.26200.9974), Python 3.12.10, NVIDIA GeForce RTX 3090 (Vulkan 1.4.363.1) | AI-assisted: yes

Summary — PASS

Verified 5c37f5fd988fb70ab647523167a57dedcd20db9f merged cleanly onto origin/main (c8bf0e7b6568f471b42540010e335ca6413d4c58, git merge-tree --write-tree exit 0) on Windows 11 (x64) with physical NVIDIA GeForce RTX 3090 Vulkan compute execution.

Red -> Green Verification

  1. Red (origin/main c8bf0e7b65 with #1397's updated semantic test suites & cs_exec_copy fixture):
    • tests/semantic/test_lane_masks_vector_bitwise.py -> FAILED (failures=23) (18 tests)
    • tests/semantic/test_salu64_bitwise_data.py -> FAILED (failures=9) (11 tests)
    • tests/semantic/test_salu_movrels_lane_mask.py -> FAILED (failures=32) (3 tests)
    • tests/semantic/test_scselect_b64_data.py -> FAILED (failures=2) (12 tests)
    • tests/semantic/test_slot67_operand_forms.py -> FAILED (failures=1) (2 tests)
  2. Green (origin/main + #1397):
    • tests/semantic/test_lane_masks_vector_bitwise.py -> 18/18 passed (2.062s, OK) (covering VALU bitwise mask words under narrowed EXEC, v_readfirstlane_b32 into VGPR destination on Wave32/Wave64 and Wave64-emulated %x_buf, scalar MASK_NUMBER_READERS, and vcc_lo data reads under narrowed exec_lo)
    • tests/semantic/test_salu64_bitwise_data.py -> 11/11 passed (2.560s, OK)
    • tests/semantic/test_salu_movrels_lane_mask.py -> 3/3 passed (0.318s, OK)
    • tests/semantic/test_scselect_b64_data.py -> 12/12 passed (0.892s, OK)
    • tests/semantic/test_slot67_operand_forms.py -> 2/2 passed (0.161s, OK)
    • tests/test_shader_checks.py -> 88/88 passed (3.551s, OK)
    • tests/test_run_gpu_tests.py -> 75/75 passed (3.702s, OK)
    • tests/test_docs_design_rows.py -> 5/5 passed (0.093s, OK) (0 link errors in docs/design.md)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249542734 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7249542734). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:37:19Z. --- #1397 | head 5c37f5fd988fb70ab647523167a57dedcd20db9f (merged cleanly onto origin/main c8bf0e7b65) | Windows 11 (10.0.26200.9974), Python 3.12.10, NVIDIA GeForce RTX 3090 (Vulkan 1.4.363.1) | AI-assisted: yes ### Summary — PASS Verified `5c37f5fd988fb70ab647523167a57dedcd20db9f` merged cleanly onto `origin/main` (`c8bf0e7b6568f471b42540010e335ca6413d4c58`, `git merge-tree --write-tree` exit `0`) on Windows 11 (`x64`) with physical NVIDIA GeForce RTX 3090 Vulkan compute execution. ### Red -> Green Verification 1. **Red (`origin/main` `c8bf0e7b65` with `#1397`'s updated semantic test suites & `cs_exec_copy` fixture)**: - `tests/semantic/test_lane_masks_vector_bitwise.py` -> `FAILED (failures=23)` (`18` tests) - `tests/semantic/test_salu64_bitwise_data.py` -> `FAILED (failures=9)` (`11` tests) - `tests/semantic/test_salu_movrels_lane_mask.py` -> `FAILED (failures=32)` (`3` tests) - `tests/semantic/test_scselect_b64_data.py` -> `FAILED (failures=2)` (`12` tests) - `tests/semantic/test_slot67_operand_forms.py` -> `FAILED (failures=1)` (`2` tests) 2. **Green (`origin/main` + `#1397`)**: - `tests/semantic/test_lane_masks_vector_bitwise.py` -> **`18/18` passed (`2.062s`, `OK`)** (covering VALU bitwise mask words under narrowed `EXEC`, `v_readfirstlane_b32` into VGPR destination on Wave32/Wave64 and Wave64-emulated `%x_buf`, scalar `MASK_NUMBER_READERS`, and `vcc_lo` data reads under narrowed `exec_lo`) - `tests/semantic/test_salu64_bitwise_data.py` -> **`11/11` passed (`2.560s`, `OK`)** - `tests/semantic/test_salu_movrels_lane_mask.py` -> **`3/3` passed (`0.318s`, `OK`)** - `tests/semantic/test_scselect_b64_data.py` -> **`12/12` passed (`0.892s`, `OK`)** - `tests/semantic/test_slot67_operand_forms.py` -> **`2/2` passed (`0.161s`, `OK`)** - `tests/test_shader_checks.py` -> **`88/88` passed (`3.551s`, `OK`)** - `tests/test_run_gpu_tests.py` -> **`75/75` passed (`3.702s`, `OK`)** - `tests/test_docs_design_rows.py` -> **`5/5` passed (`0.093s`, `OK`)** (`0` link errors in `docs/design.md`)
OreoFR commented 2026-11-29 05:47:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T05:47:20Z.


Verified by OreoFR — FAILS

  • Base: main c8bf0e7b6 + this PR (head 5c37f5fd9) merged with --no-ff
  • Red (main + only this PR's tests): the PR's semantic tests fail on main: test_lane_masks_vector_bitwise 23 failures, test_salu64_bitwise_data 9, test_salu_movrels_lane_mask 32, test_scselect_b64_data 2, test_slot67_operand_forms 1.
  • Green (merge): the five PR test files pass (python -I -m unittest discover -s tests/semantic -p <file>). But the full translator suite (python -I scripts/run_semantic_tests.py tests/semantic -j 4) has 2 new failures vs main. test_gather4_c_lz: 7 failures, 52 errors. test_lane_masks_edge_cases: test_wave32_writelane_lane_32_aliases_lane_0_for_parked_masks gives [20, 20, 20, 20] != [20, 20, 10, 10]. Both pass on main, where the suite runs 527 files and only test_valu_cvt_f16_int16_mods fails. ctest in package p5 (main + #2477 + #1397): 495 tests, no new failures
  • Diff read: tools/rdna2spirv.py: the PR head no longer has main's elif op in ("image_gather4_c_lz", "image_gather4_c_lz_o"): self.image_op(op, a, mods), next to the v_readfirstlane branch the PR rewrites (the merge of main into the PR dropped it). So those two ops are no longer translated, which is the test_gather4_c_lz failure. The fixture tests/semantic/fixtures/disasm/cs_exec_copy.s is hand-written, and the docs/design.md row is updated.
  • Other runs: The earlier runs (EvgHaze, mrgenty, Christopher-Sundeby, qhukz13) were on older heads. Both regressions are against current main.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251460346 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7251460346). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T05:47:20Z. --- **Verified by OreoFR** — FAILS - Base: main c8bf0e7b6 + this PR (head 5c37f5fd9) merged with --no-ff - Red (main + only this PR's tests): the PR's semantic tests fail on main: `test_lane_masks_vector_bitwise` 23 failures, `test_salu64_bitwise_data` 9, `test_salu_movrels_lane_mask` 32, `test_scselect_b64_data` 2, `test_slot67_operand_forms` 1. - Green (merge): the five PR test files pass (`python -I -m unittest discover -s tests/semantic -p <file>`). But the full translator suite (`python -I scripts/run_semantic_tests.py tests/semantic -j 4`) has 2 new failures vs main. `test_gather4_c_lz`: 7 failures, 52 errors. `test_lane_masks_edge_cases`: `test_wave32_writelane_lane_32_aliases_lane_0_for_parked_masks` gives `[20, 20, 20, 20] != [20, 20, 10, 10]`. Both pass on main, where the suite runs 527 files and only `test_valu_cvt_f16_int16_mods` fails. ctest in package p5 (main + #2477 + #1397): 495 tests, no new failures - Diff read: `tools/rdna2spirv.py`: the PR head no longer has main's `elif op in ("image_gather4_c_lz", "image_gather4_c_lz_o"): self.image_op(op, a, mods)`, next to the `v_readfirstlane` branch the PR rewrites (the merge of main into the PR dropped it). So those two ops are no longer translated, which is the `test_gather4_c_lz` failure. The fixture `tests/semantic/fixtures/disasm/cs_exec_copy.s` is hand-written, and the docs/design.md row is updated. - Other runs: The earlier runs (EvgHaze, mrgenty, Christopher-Sundeby, qhukz13) were on older heads. Both regressions are against current main. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
ecox982745 commented 2026-11-29 06:16:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-29T06:16:07Z.


I reproduced both cases in the review above on the clean merge of 5c37f5fd9 and main ef3299584. The patch restores both depth-compare gather dispatches. It also passes the current wave mode to the parked-slot check in the new mask-word selector, so that in Wave32 lane 32 aliases lane 0 there as it already does in the slot tracker and read/write paths.

  • CPU. All 16 depth-compare gather tests passed with SPIRV-Tools on PATH, including binary validation. All eight lane-mask edge tests and the five test files changed by this PR passed. The full Python suite ran 6,539 tests on the patched merge versus 6,525 on main. Both reported the same failures in test_interp_computed_ij_fallback and test_valu_cvt_f16_int16_mods.
  • RTX 4090. Windows 11, NVIDIA 616.64, native 32-lane subgroup and Vulkan validation enabled. I assembled and dispatched both synthetic lane-32 cases from the interpreter suite. The restore case returned [20, 20, 20, 20] before the patch and [20, 20, 10, 10] with it. The overwrite case returned 0x55aa in all four lanes before and after. All four shaders passed spirv-val and the dispatches reported zero Vulkan validation errors.

The patch applies after merging main ef329958483832297acb53e68be94b439e88a90e into this head. It reconstructs tested tree 26733e70326581ad2bf57fc97d1c45ba7524bba8. Coordination

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

Patch for git am

Save the block as a patch file and apply it with git am.

From 2119984c1c9d5acee9921cd734189bea34cb2b4f Mon Sep 17 00:00:00 2001
From: OpenAI Codex <[email protected]>
Date: Sun, 29 Nov 2026 16:13:17 +1000
Subject: [PATCH] rdna2spirv: preserve gather dispatch and parked wave32 lanes
 after merge

Restore both depth-compare gather opcodes. Pass the current wave mode when a writelane mask operand checks an already parked lane, matching the slot analysis and the read/write paths.

Refs #1397. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
---
 tools/rdna2spirv.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py
index 0e7e98b35..745c088d3 100644
--- a/tools/rdna2spirv.py
+++ b/tools/rdna2spirv.py
@@ -764,7 +764,7 @@ class Gen:
         if base_op(ins["op"]) == "v_writelane_b32":
             # A mask parked in one lane of a VGPR comes back through v_readlane as this lane's bit: the
             # parked SGPR slot keeps the per-lane value.
-            slot = lane_masks.lane_slot(a[0], a[2])
+            slot = lane_masks.lane_slot(a[0], a[2], wave64=self.wave64)
             if slot and slot[1:] in self.parked:
                 return False
         return True
@@ -8479,6 +8479,8 @@ class Gen:
             self.emit(f"{r} = OpGroupNonUniformShuffle %uint {self.cu(3)} {v} {first}")
             res = r if a[0]["k"] == "vgpr" or not mask_vgpr else self._vgpr_mask_lane_bit(r, a[1])
             self.dst(a[0], res)
+        elif op in ("image_gather4_c_lz", "image_gather4_c_lz_o"):
+            self.image_op(op, a, mods)
         elif op in ("image_sample_o", "image_sample_lz_o", "image_sample_l_o", "image_sample_b_o",
                     "image_sample_c_lz_o", "image_sample_c_o", "image_sample_c_b_o", "image_sample_cl_o", "image_sample_b_cl_o",
                     "image_sample_c_cl_o", "image_sample_c_b_cl_o") or                 op in ("image_sample", "image_sample_lz", "image_sample_l", "image_sample_b", "image_sample_c_lz",
-- 
2.53.0.windows.3

Retest after the rebase. The patch is now present in PR head b907306223822ed3f846ae4623d99b03431a7b60 with the same patch ID. I tested it merged into main 7b907de52311e08374a006e00402995f7a671ca8 (tree 395233906dd4dd755d4e65c07e8eb294c400012b).

  • All 70 focused CPU tests passed with SPIRV-Tools available. The full suite ran 6,539 tests versus 6,525 on main. The same four failures appeared on both trees in the two modules named above.
  • The RTX 4090 still returned [20, 20, 10, 10] for the restore and 0x55aa in all four lanes for the overwrite. Both shaders passed spirv-val and Vulkan validation reported zero errors.

Adopted commit

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251750860 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7251750860). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-29T06:16:07Z. --- I reproduced both cases in the [review above](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7251460346) on the clean merge of `5c37f5fd9` and main `ef3299584`. The patch restores both depth-compare gather dispatches. It also passes the current wave mode to the parked-slot check in the new mask-word selector, so that in Wave32 lane 32 aliases lane 0 there as it already does in the slot tracker and read/write paths. - **CPU.** All 16 depth-compare gather tests passed with SPIRV-Tools on PATH, including binary validation. All eight lane-mask edge tests and the five test files changed by this PR passed. The full Python suite ran 6,539 tests on the patched merge versus 6,525 on main. Both reported the same failures in `test_interp_computed_ij_fallback` and `test_valu_cvt_f16_int16_mods`. - **RTX 4090.** Windows 11, NVIDIA 616.64, native 32-lane subgroup and Vulkan validation enabled. I assembled and dispatched both synthetic lane-32 cases from the interpreter suite. The restore case returned `[20, 20, 20, 20]` before the patch and `[20, 20, 10, 10]` with it. The overwrite case returned `0x55aa` in all four lanes before and after. All four shaders passed `spirv-val` and the dispatches reported zero Vulkan validation errors. The patch applies **after merging** main `ef329958483832297acb53e68be94b439e88a90e` into this head. It reconstructs tested tree `26733e70326581ad2bf57fc97d1c45ba7524bba8`. [Coordination](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7251689836) AI-assisted with OpenAI Codex (GPT-6.2 Sol). <details> <summary>Patch for git am</summary> Save the block as a patch file and apply it with `git am`. ~~~~patch From 2119984c1c9d5acee9921cd734189bea34cb2b4f Mon Sep 17 00:00:00 2001 From: OpenAI Codex <[email protected]> Date: Sun, 29 Nov 2026 16:13:17 +1000 Subject: [PATCH] rdna2spirv: preserve gather dispatch and parked wave32 lanes after merge Restore both depth-compare gather opcodes. Pass the current wave mode when a writelane mask operand checks an already parked lane, matching the slot analysis and the read/write paths. Refs #1397. AI-assisted with OpenAI Codex (GPT-6.2 Sol). --- tools/rdna2spirv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py index 0e7e98b35..745c088d3 100644 --- a/tools/rdna2spirv.py +++ b/tools/rdna2spirv.py @@ -764,7 +764,7 @@ class Gen: if base_op(ins["op"]) == "v_writelane_b32": # A mask parked in one lane of a VGPR comes back through v_readlane as this lane's bit: the # parked SGPR slot keeps the per-lane value. - slot = lane_masks.lane_slot(a[0], a[2]) + slot = lane_masks.lane_slot(a[0], a[2], wave64=self.wave64) if slot and slot[1:] in self.parked: return False return True @@ -8479,6 +8479,8 @@ class Gen: self.emit(f"{r} = OpGroupNonUniformShuffle %uint {self.cu(3)} {v} {first}") res = r if a[0]["k"] == "vgpr" or not mask_vgpr else self._vgpr_mask_lane_bit(r, a[1]) self.dst(a[0], res) + elif op in ("image_gather4_c_lz", "image_gather4_c_lz_o"): + self.image_op(op, a, mods) elif op in ("image_sample_o", "image_sample_lz_o", "image_sample_l_o", "image_sample_b_o", "image_sample_c_lz_o", "image_sample_c_o", "image_sample_c_b_o", "image_sample_cl_o", "image_sample_b_cl_o", "image_sample_c_cl_o", "image_sample_c_b_cl_o") or op in ("image_sample", "image_sample_lz", "image_sample_l", "image_sample_b", "image_sample_c_lz", -- 2.53.0.windows.3 ~~~~ </details> **Retest after the rebase.** The patch is now present in PR head `b907306223822ed3f846ae4623d99b03431a7b60` with the same patch ID. I tested it merged into main `7b907de52311e08374a006e00402995f7a671ca8` (tree `395233906dd4dd755d4e65c07e8eb294c400012b`). - All 70 focused CPU tests passed with SPIRV-Tools available. The full suite ran 6,539 tests versus 6,525 on main. The same four failures appeared on both trees in the two modules named above. - The RTX 4090 still returned `[20, 20, 10, 10]` for the restore and `0x55aa` in all four lanes for the overwrite. Both shaders passed `spirv-val` and Vulkan validation reported zero errors. [Adopted commit](https://github.com/ProjectLeonida/mandy/commit/b907306223822ed3f846ae4623d99b03431a7b60)
whoalin1 commented 2026-11-29 17:27:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-29T17:27:41Z.


Rebased onto current main and applied the reviewer-supplied correction as b90730622: both depth-compare gather dispatches are restored, and the parked-slot lookup now receives the current wave mode.

Validation after that head: 16/16 gather tests, 8/8 lane-mask edge tests, 2/2 slot67 tests, and all five touched semantic test files pass; compileall and diff-check are clean. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259708928 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7259708928). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-29T17:27:41Z. --- Rebased onto current `main` and applied the reviewer-supplied correction as `b90730622`: both depth-compare gather dispatches are restored, and the parked-slot lookup now receives the current wave mode. Validation after that head: 16/16 gather tests, 8/8 lane-mask edge tests, 2/2 slot67 tests, and all five touched semantic test files pass; compileall and diff-check are clean. AI-assisted.
OreoFR commented 2026-11-29 18:36:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T18:36:10Z.


Re-verified by OreoFR at head b90730622 on main eedd72e30 (still merges cleanly on 878b024f4): READY — red 67 fail → green 70 OK; ctest/link n/a (translator and test-runner Python only, nothing gta6rt links); head changed since the earlier verification https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7251460346 (FAILS at 5c37f5fd9: the two regressions are fixed at this head). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5).

  • Red (main + only the PR's five test files): test_lane_masks_vector_bitwise 23 failures, test_salu64_bitwise_data 9, test_salu_movrels_lane_mask 32, test_scselect_b64_data 2, test_slot67_operand_forms 1.
  • Green (main + this PR, git merge --no-ff): those five files 46/46 OK, plus test_gather4_c_lz 16/16 and test_lane_masks_edge_cases 8/8, the two files that failed at the earlier head.
  • Full translator suite (scripts/run_semantic_tests.py tests/semantic, on main 91bab934d, the main of the start of this run): merge 529 files, 6540 tests, only test_interp_computed_ij_fallback fails; main alone 529 files, 6526 tests, the same single failure. No new failure. Main has since gained a small tools/rdna2spirv.py change; the PR still merges cleanly and the files above were rerun on eedd72e30.

Ready to merge per the maintainers' plan.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260611910 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7260611910). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T18:36:10Z. --- **Re-verified by OreoFR** at head `b90730622` on main `eedd72e30` (still merges cleanly on `878b024f4`): READY — red 67 fail → green 70 OK; ctest/link n/a (translator and test-runner Python only, nothing gta6rt links); head changed since the earlier verification https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7251460346 (FAILS at `5c37f5fd9`: the two regressions are fixed at this head). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5). - Red (main + only the PR's five test files): `test_lane_masks_vector_bitwise` 23 failures, `test_salu64_bitwise_data` 9, `test_salu_movrels_lane_mask` 32, `test_scselect_b64_data` 2, `test_slot67_operand_forms` 1. - Green (main + this PR, `git merge --no-ff`): those five files 46/46 OK, plus `test_gather4_c_lz` 16/16 and `test_lane_masks_edge_cases` 8/8, the two files that failed at the earlier head. - Full translator suite (`scripts/run_semantic_tests.py tests/semantic`, on main `91bab934d`, the main of the start of this run): merge 529 files, 6540 tests, only `test_interp_computed_ij_fallback` fails; main alone 529 files, 6526 tests, the same single failure. No new failure. Main has since gained a small `tools/rdna2spirv.py` change; the PR still merges cleanly and the files above were rerun on `eedd72e30`. Ready to merge per the maintainers' plan.
whoalin1 commented 2026-11-30 22:24:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-30T22:24:32Z.


Rebased onto current main as da87c72c6. The conflicts were resolved by keeping upstream’s scalar-spill parking refactor while preserving this branch’s mask-word/EXEC-copy behavior, and by moving cs_exec_copy into upstream’s CS_DUMP_WANTS / CS_DUMP_NON_WAVE64 tables. Validation: the five changed semantic test files pass 46 tests + 480 subtests under Python 3.12, and py_compile/git diff --check are clean. Real-GPU validation of the rebased head is still untested here.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7293805810 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7293805810). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-30T22:24:32Z. --- Rebased onto current `main` as `da87c72c6`. The conflicts were resolved by keeping upstream’s scalar-spill parking refactor while preserving this branch’s mask-word/EXEC-copy behavior, and by moving `cs_exec_copy` into upstream’s `CS_DUMP_WANTS` / `CS_DUMP_NON_WAVE64` tables. Validation: the five changed semantic test files pass **46 tests + 480 subtests** under Python 3.12, and `py_compile`/`git diff --check` are clean. Real-GPU validation of the rebased head is still untested here.
whoalin1 commented 2026-11-30 22:43:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-30T22:43:56Z.


Current head da87c72c is now mergeable with all visible checks green after the rebase. The prior independent hardware validations were against the same translator behavior; the rebase only refreshed the upstream baseline and preserved the mask-word changes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7294232377 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7294232377). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-30T22:43:56Z. --- Current head `da87c72c` is now mergeable with all visible checks green after the rebase. The prior independent hardware validations were against the same translator behavior; the rebase only refreshed the upstream baseline and preserved the mask-word changes.
ecox982745 commented 2026-11-30 23:11:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T23:11:52Z.


Native RTX 4090 hardware retest after the rebase. I tested head da87c72c6 against 9dffbe721, merged tree 471cd3dcb, with Windows 11, NVIDIA 616.64, and Khronos Vulkan validation 1.4.369. I reused the earlier assembled seed-1 inputs, CPU reference and vk_compute_test executable. Both translators used --no-ftz32 for this adapter, with --wave64-emulate on the Wave64 arm.

Synthetic corpus Main Main + PR
Native Wave32 programs matching the reference 45/50 50/50
Emulated Wave64 programs matching the reference 45/50 50/50
Output words differing from the reference 422/103,180 0/103,180

Of the ten baseline discrepancies, four came from programs with fuzzer hypothesis operations. The other six include the earlier reported cases. All 200 SPIR-V modules passed Vulkan 1.2 validation and completed dispatch on the physical RTX 4090. This covers the seed-1 corpus on the rebased translator. AI-assisted with OpenAI Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7294828640 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7294828640). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-30T23:11:52Z. --- Native RTX 4090 hardware retest after the rebase. I tested head `da87c72c6` against `9dffbe721`, merged tree `471cd3dcb`, with Windows 11, NVIDIA 616.64, and Khronos Vulkan validation 1.4.369. I reused the earlier assembled seed-1 inputs, CPU reference and `vk_compute_test` executable. Both translators used `--no-ftz32` for this adapter, with `--wave64-emulate` on the Wave64 arm. | Synthetic corpus | Main | Main + PR | | --- | ---: | ---: | | Native Wave32 programs matching the reference | 45/50 | 50/50 | | Emulated Wave64 programs matching the reference | 45/50 | 50/50 | | Output words differing from the reference | 422/103,180 | 0/103,180 | Of the ten baseline discrepancies, four came from programs with fuzzer hypothesis operations. The other six include the earlier reported cases. All 200 SPIR-V modules passed Vulkan 1.2 validation and completed dispatch on the physical RTX 4090. This covers the seed-1 corpus on the rebased translator. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
whoalin1 commented 2026-11-30 23:57:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-30T23:57:38Z.


Current-head status after the rebase: all visible checks are green, and the fresh independent RTX 4090 hardware retest above passed against the merged tree. From the author side this is ready for maintainer review/merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7295739277 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#issuecomment-7295739277). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-30T23:57:38Z. --- Current-head status after the rebase: all visible checks are green, and the fresh independent RTX 4090 hardware retest above passed against the merged tree. From the author side this is ready for maintainer review/merge.
aslan2142 commented 2026-12-01 11:33:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:33:19Z.

Review: COMMENTED


Reviewed head diff against main: this PR is cleanly rebased, clean-room verified, and has all CI checks green (plus independent RTX 4090 verification). Holding from merge because this is a competing variant against #1043 for the same lane-mask-as-data defect (SHADER-MASK-AS-DATA); a maintainer needs to choose between #1397 and #1043.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130382987 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#pullrequestreview-6130382987). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:33:19Z. **Review:** COMMENTED --- Reviewed head diff against `main`: this PR is cleanly rebased, clean-room verified, and has all CI checks green (plus independent RTX 4090 verification). Holding from merge because this is a competing **variant** against `#1043` for the same lane-mask-as-data defect (`SHADER-MASK-AS-DATA`); a maintainer needs to choose between `#1397` and `#1043`. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 11:52:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:52:47Z.

Review: APPROVED


Chosen over competing variant #1043 (now closed) and approving for merge.

  • Clean invariant: VALU data reads (src_u) always materialize the wave's 32-bit mask word, while mask consumers (mask_src, v_readfirstlane_b32 into mask-tracked destinations) extract this lane's bit via _vgpr_mask_lane_bit (half-aware in wave64) and broadcast from the first active lane — avoiding the lookahead mismatches seen on #1043. Also incorporates scalar MASK_NUMBER_READERS and updates wave64_emulate_opt.py.
  • Cleanly rebased on main (MERGEABLE/CLEAN), all 7 CI checks green, clean-room verified, with GPU fixture cs_exec_copy.asm, 280+ lines of semantic tests, and independent RTX 4090 (50/50 native wave32 + 50/50 emulated wave64, 0/103,180 word mismatches) and RTX 4070 verification.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130708719 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1397#pullrequestreview-6130708719). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:52:47Z. **Review:** APPROVED --- Chosen over competing variant **#1043** (now closed) and approving for merge. - Clean invariant: VALU data reads (`src_u`) always materialize the wave's 32-bit mask word, while mask consumers (`mask_src`, `v_readfirstlane_b32` into mask-tracked destinations) extract this lane's bit via `_vgpr_mask_lane_bit` (half-aware in wave64) and broadcast from the first active lane — avoiding the lookahead mismatches seen on `#1043`. Also incorporates scalar `MASK_NUMBER_READERS` and updates `wave64_emulate_opt.py`. - Cleanly rebased on `main` (`MERGEABLE/CLEAN`), all 7 CI checks green, clean-room verified, with GPU fixture `cs_exec_copy.asm`, 280+ lines of semantic tests, and independent RTX 4090 (50/50 native wave32 + 50/50 emulated wave64, 0/103,180 word mismatches) and RTX 4070 verification. *(AI-assisted review.)*
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!1397
No description provided.