rdna2spirv: handle mixed mask pairs, wave32 VCC, and mask bit indices in s_bitcmp0/1_b32/b64 (SHADER-BITCMP64-MIXED-AND-SPECIAL-SRCS) #2360

Merged
ShotTechOp merged 1 commit from upstream-pr/2360 into main 2026-12-01 15:21:09 +00:00
ShotTechOp commented 2026-11-26 15:22:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ShotTechOp on 2026-11-26T15:22:55Z.


Item ID: SHADER-BITCMP64-MIXED-AND-SPECIAL-SRCS

Summary

Fixes Gen.bitcmp (s_bitcmp0/1_b32 and s_bitcmp0/1_b64) in tools/rdna2spirv.py for five broken lane-mask operand combinations (matching the per-dword word-materialization model used by s_cmp_eq/lg_u64):

  1. Mixed mask/data SGPR pairs in s_bitcmp0/1_b64: when one dword of s[r:r+1] holds a lane mask and the other holds plain scalar data, holds_lane_mask returned False, so the mask dword was loaded raw (0 / 0xFFFFFFFF per lane) instead of materializing the wave's 32-bit mask word.
  2. Wave32 (mask, -1) (EITHER) pairs in s_bitcmp0/1_b64: holds_lane_mask returned True and called wave_mask(s[r:r+1]), which returned (lo, 0) in wave32 and dropped the high -1 word to 0.
  3. Swapped or duplicated wave64 half-mask SGPR pairs in s_bitcmp0/1_b64 (e.g. s10 = vcc_hi, s11 = vcc_lo): holds_lane_mask returned True and wave_mask collapsed them to canonical (lo, hi). Now only canonical wave64 (MASK_LO, MASK_HI) keeps a single wave_mask; all other SGPR pairs materialize each dword independently (lane_mask_word when tracked as a mask, else load_reg).
  4. Wave32 FSPX s_bitcmp0/1_b64 vcc, bit: in wave32, vcc is {vcc_hi, vcc_lo} where vcc_lo can hold a lane mask while vcc_hi holds scalar data (or a separate mask). Previously wave_mask(vcc) zeroed bits 32..63; now vcc_lo and vcc_hi are materialized independently.
  5. Lane-mask bit-index operand a[1] on s_bitcmp0/1_b32 and s_bitcmp0/1_b64: previously self.src_u(a[1]) read per-lane 0 / 0xFFFFFFFF instead of self.lane_mask_word(a[1]).

Also simplifies _b32 to use self.lane_mask_word(src0) and replaces the non-mask 64-bit fallback self.mask_src(src0) with self.src_u(src0). Updates the contract table in docs/design.md and adds tests/semantic/test_bitcmp64_mixed_and_special.py.

Verification

  • AI-assisted: yes
  • Environment: Windows 11, Python 3.12.10 (CPU semantic interpreter spirv_mini_interp; no local GPU/Vulkan/spirv-val installed)
  • GREEN checks:
    • python -I tests/semantic/test_bitcmp64_mixed_and_special.py -v -> 6/6 OK (wave32, FSPX wave32, native wave64, --wave64-emulate)
    • python -I tests/semantic/test_scalar_bitcmp.py -> 23/23 OK
    • python -I tests/test_text_write_line_endings.py -> 3/3 OK
    • python -m compileall -q tools/rdna2spirv.py tests/semantic/test_bitcmp64_mixed_and_special.py -> exit 0
    • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_bitcmp64_mixed_and_special.py docs/design.md -> exit 0
    • git diff --check -> clean
  • RED control against origin/main (tools/ extracted from origin/main):
    • tests/semantic/test_bitcmp64_mixed_and_special.py fails 5 of 6 tests (6 failures across wave32, FSPX wave32, native wave64, and --wave64-emulate; test_wave64_bitcmp32_high_half_mask is a parity regression guard).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5512713380 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360). Originally posted by [ShotTechOp](https://github.com/ShotTechOp) on 2026-11-26T15:22:55Z. --- Item ID: `SHADER-BITCMP64-MIXED-AND-SPECIAL-SRCS` ## Summary Fixes `Gen.bitcmp` (`s_bitcmp0/1_b32` and `s_bitcmp0/1_b64`) in `tools/rdna2spirv.py` for five broken lane-mask operand combinations (matching the per-dword word-materialization model used by `s_cmp_eq/lg_u64`): 1. **Mixed mask/data SGPR pairs in `s_bitcmp0/1_b64`**: when one dword of `s[r:r+1]` holds a lane mask and the other holds plain scalar data, `holds_lane_mask` returned `False`, so the mask dword was loaded raw (`0` / `0xFFFFFFFF` per lane) instead of materializing the wave's 32-bit mask word. 2. **Wave32 `(mask, -1)` (`EITHER`) pairs in `s_bitcmp0/1_b64`**: `holds_lane_mask` returned `True` and called `wave_mask(s[r:r+1])`, which returned `(lo, 0)` in wave32 and dropped the high `-1` word to `0`. 3. **Swapped or duplicated wave64 half-mask SGPR pairs in `s_bitcmp0/1_b64`** (e.g. `s10 = vcc_hi`, `s11 = vcc_lo`): `holds_lane_mask` returned `True` and `wave_mask` collapsed them to canonical `(lo, hi)`. Now only canonical wave64 `(MASK_LO, MASK_HI)` keeps a single `wave_mask`; all other SGPR pairs materialize each dword independently (`lane_mask_word` when tracked as a mask, else `load_reg`). 4. **Wave32 FSPX `s_bitcmp0/1_b64 vcc, bit`**: in wave32, `vcc` is `{vcc_hi, vcc_lo}` where `vcc_lo` can hold a lane mask while `vcc_hi` holds scalar data (or a separate mask). Previously `wave_mask(vcc)` zeroed bits 32..63; now `vcc_lo` and `vcc_hi` are materialized independently. 5. **Lane-mask bit-index operand `a[1]` on `s_bitcmp0/1_b32` and `s_bitcmp0/1_b64`**: previously `self.src_u(a[1])` read per-lane `0` / `0xFFFFFFFF` instead of `self.lane_mask_word(a[1])`. Also simplifies `_b32` to use `self.lane_mask_word(src0)` and replaces the non-mask 64-bit fallback `self.mask_src(src0)` with `self.src_u(src0)`. Updates the contract table in `docs/design.md` and adds `tests/semantic/test_bitcmp64_mixed_and_special.py`. ## Verification - **AI-assisted**: yes - **Environment**: Windows 11, Python 3.12.10 (CPU semantic interpreter `spirv_mini_interp`; no local GPU/Vulkan/`spirv-val` installed) - **GREEN checks**: - `python -I tests/semantic/test_bitcmp64_mixed_and_special.py -v` -> 6/6 OK (wave32, FSPX wave32, native wave64, `--wave64-emulate`) - `python -I tests/semantic/test_scalar_bitcmp.py` -> 23/23 OK - `python -I tests/test_text_write_line_endings.py` -> 3/3 OK - `python -m compileall -q tools/rdna2spirv.py tests/semantic/test_bitcmp64_mixed_and_special.py` -> exit 0 - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_bitcmp64_mixed_and_special.py docs/design.md` -> exit 0 - `git diff --check` -> clean - **RED control against `origin/main` (`tools/` extracted from `origin/main`)**: - `tests/semantic/test_bitcmp64_mixed_and_special.py` fails 5 of 6 tests (6 failures across wave32, FSPX wave32, native wave64, and `--wave64-emulate`; `test_wave64_bitcmp32_high_half_mask` is a parity regression guard).
lixonik commented 2026-11-26 15:35:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:35:09Z.

Review: COMMENTED


Windows 11: 6/6 targeted bitcmp semantic tests passed with synthetic inputs. These cover mixed SGPR pairs, the wave32 high word, wave64 swapped halves, and a lane-mask bit index. No findings from these checks.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6076850749 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#pullrequestreview-6076850749). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T15:35:09Z. **Review:** COMMENTED --- Windows 11: 6/6 targeted bitcmp semantic tests passed with synthetic inputs. These cover mixed SGPR pairs, the wave32 high word, wave64 swapped halves, and a lane-mask bit index. No findings from these checks. AI-assisted.
ecox982745 commented 2026-11-26 15:49:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T15:49:05Z.


On an RTX 4090, all 136 synthetic bit-comparison dispatches at c26efd297 matched an independent scalar reference. The same fixture and runtime inputs matched in 89 of 136 dispatches on parent fbf100b1b.

Mode Parent PR
Native wave32 32/48 48/48
Wave64 emulated on two 32-lane subgroups 57/88 88/88

For example, I gave the low half of an SGPR pair a lane mask of 0x80000001 and the high half ordinary scalar data. Testing bit 0 of that pair should set SCC for the whole wave. On the parent, lane 1 reported zero. On the PR, every lane reported one.

The matrix covered mixed mask/data pairs, all-ones and ordinary scalar controls, duplicate and swapped halves, direct VCC operands, and mask-derived indices. I included wave32 FSPX metadata for the full-VCC case. Each lane wrote the results for both bit polarities and both operand widths. All 28,672 output words on the PR matched, the output-buffer guards stayed intact, and all 17 PR modules passed SPIR-V validation for Vulkan 1.2. The six committed CPU semantic tests also passed.

Windows 11, NVIDIA 616.64, Vulkan validation enabled. The GPU ran synthetic shader listings through the common parent’s vk_compute_test. AI-assisted verification by OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7196791654 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2360#issuecomment-7196791654). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-26T15:49:05Z. --- On an RTX 4090, all 136 synthetic bit-comparison dispatches at `c26efd297` matched an independent scalar reference. The same fixture and runtime inputs matched in 89 of 136 dispatches on parent `fbf100b1b`. | Mode | Parent | PR | | --- | ---: | ---: | | Native wave32 | 32/48 | 48/48 | | Wave64 emulated on two 32-lane subgroups | 57/88 | 88/88 | For example, I gave the low half of an SGPR pair a lane mask of `0x80000001` and the high half ordinary scalar data. Testing bit 0 of that pair should set SCC for the whole wave. On the parent, lane 1 reported zero. On the PR, every lane reported one. The matrix covered mixed mask/data pairs, all-ones and ordinary scalar controls, duplicate and swapped halves, direct VCC operands, and mask-derived indices. I included wave32 FSPX metadata for the full-VCC case. Each lane wrote the results for both bit polarities and both operand widths. All 28,672 output words on the PR matched, the output-buffer guards stayed intact, and all 17 PR modules passed SPIR-V validation for Vulkan 1.2. The six committed CPU semantic tests also passed. Windows 11, NVIDIA 616.64, Vulkan validation enabled. The GPU ran synthetic shader listings through the common parent’s `vk_compute_test`. AI-assisted verification by OpenAI Codex (GPT-6).
wavehs commented 2026-11-26 18:21:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:21:21Z.

Review: COMMENTED


macOS arm64 check of #2360 (SHADER-BITCMP64-MIXED-AND-SPECIAL-SRCS). Translator-only plus one semantic test; the GPU part is MoltenVK/KosmicKrisp, and it does not reach the changed combinations (see the finding).

Tested head c26efd297 merged onto main bdbc7e923 as merge d59a3d6e6 (clean; branch 21 commits behind, git merge-tree clean).

Environment: Apple M3 Pro, arm64 (subgroups 4..32), macOS 27.2.1, CPython 3.15.2, SPIRV-Tools v2026.4, llvm-mc 23.1.5, MoltenVK 1.4.0; KosmicKrisp and lavapipe = Mesa 26.3.0.

The new test passes, and the control bites

  • python -I tests/semantic/test_bitcmp64_mixed_and_special.py: Ran 6 tests ... OK at the head and after merging onto bdbc7e923; tests/semantic/test_scalar_bitcmp.py still 23/23.
  • Negative control (test kept, tools/rdna2spirv.py put back to main's): FAILED (failures=6) - lane-mask bit index, wave32 (mask, -1), wave32 mixed, wave32 FSPX vcc, and wave64 swapped/mixed in both native and --wave64-emulate subtests. The unchanged sixth test (test_wave64_bitcmp32_high_half_mask) is the parity guard, as the description says.

What I checked in the code

  • The canonical (MASK_LO, MASK_HI) wave64 pair still goes through one wave_mask; every other SGPR pair materializes each dword (lane_mask_word for a tracked word, load_reg for data), so (mask, data), (data, mask), swapped and duplicated pairs become the same uniform 64-bit value in every lane. lane_mask_word is uniform: for MASK_LO/MASK_HI it returns that word regardless of the lane, which is what a scalar bit index needs.
  • cur_masks only ever holds MASK, MASK_LO, MASK_HI or EITHER (tools/lane_masks.py:32-35), so the (r + i) in self.cur_masks membership test cannot call lane_mask_word on plain data today. It is a little brittle if a new kind is introduced (the check then means "any tracked kind"), but it is correct now.
  • Wave32 FSPX vcc becomes {vcc_hi, vcc_lo} and each word is materialized on its own; src_u already loads %vcc_hi as an ordinary SGPR in wave32 and %vcc for vcc_lo, so the split is consistent with the rest of the translator.
  • The bit-index operand now goes through lane_mask_word when it is a tracked mask, matching the b32 path.

No regressions

  • Semantic suite: 500 files / 6,367 tests / 0 failed at main bdbc7e923; 501 files / 6,373 tests / 0 failed at the merge (+1 file, +6 tests).
  • GPU fixtures (268): MoltenVK 195 PASS / 3 FAIL / 70 SKIP, KosmicKrisp 190 / 5 / 73, identical at main and the merge after normalising the per-run temp directory. Same pre-existing failures (cs_fma_fused, cs_imgatomic_ext, ps_ssharp on MV; cs_bvh, cs_bvh32, cs_imgatomic_ext, ps_cndmask_sign_mods, ps_valu16_mad_sel on KK).

Finding
The GPU fixtures do not exercise this rule at all: the only shader with s_bitcmp is runtime/test/shaders/cs_w32_salu_ext.asm, and it uses s_bitcmp0/1_b32 on plain SGPR data, not _b64 and not a mask/mixed pair. The doc row says "Not yet GPU-verified", which is accurate; all five fixed combinations rest on spirv_mini_interp. A small cs_w64x_bitcmp_mixed.asm (or a few lines added to an existing cs_w64x_* fixture) storing SCC for a (mask, -1) wave32 pair, a swapped wave64 half pair and a mixed pair would give the rule the same kind of hardware check that cs_w64x_partial_scmp.asm gives the compare rules.

python -I scripts/check_no_game_data.py on the changed files: clean. git diff --check: clean.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6078919557 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#pullrequestreview-6078919557). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:21:21Z. **Review:** COMMENTED --- **macOS arm64 check of #2360** (SHADER-BITCMP64-MIXED-AND-SPECIAL-SRCS). Translator-only plus one semantic test; the GPU part is MoltenVK/KosmicKrisp, and it does not reach the changed combinations (see the finding). Tested head `c26efd297` merged onto `main` `bdbc7e923` as merge `d59a3d6e6` (clean; branch 21 commits behind, `git merge-tree` clean). Environment: Apple M3 Pro, arm64 (subgroups 4..32), macOS 27.2.1, CPython 3.15.2, SPIRV-Tools v2026.4, llvm-mc 23.1.5, MoltenVK 1.4.0; KosmicKrisp and lavapipe = Mesa 26.3.0. **The new test passes, and the control bites** - `python -I tests/semantic/test_bitcmp64_mixed_and_special.py`: `Ran 6 tests ... OK` at the head and after merging onto `bdbc7e923`; `tests/semantic/test_scalar_bitcmp.py` still 23/23. - Negative control (test kept, `tools/rdna2spirv.py` put back to `main`'s): `FAILED (failures=6)` - lane-mask bit index, wave32 `(mask, -1)`, wave32 mixed, wave32 FSPX `vcc`, and wave64 swapped/mixed in both native and `--wave64-emulate` subtests. The unchanged sixth test (`test_wave64_bitcmp32_high_half_mask`) is the parity guard, as the description says. **What I checked in the code** - The canonical `(MASK_LO, MASK_HI)` wave64 pair still goes through one `wave_mask`; every other SGPR pair materializes each dword (`lane_mask_word` for a tracked word, `load_reg` for data), so `(mask, data)`, `(data, mask)`, swapped and duplicated pairs become the same uniform 64-bit value in every lane. `lane_mask_word` is uniform: for `MASK_LO`/`MASK_HI` it returns that word regardless of the lane, which is what a scalar bit index needs. - `cur_masks` only ever holds `MASK`, `MASK_LO`, `MASK_HI` or `EITHER` (`tools/lane_masks.py:32-35`), so the `(r + i) in self.cur_masks` membership test cannot call `lane_mask_word` on plain data today. It is a little brittle if a new kind is introduced (the check then means "any tracked kind"), but it is correct now. - Wave32 FSPX `vcc` becomes `{vcc_hi, vcc_lo}` and each word is materialized on its own; `src_u` already loads `%vcc_hi` as an ordinary SGPR in wave32 and `%vcc` for `vcc_lo`, so the split is consistent with the rest of the translator. - The bit-index operand now goes through `lane_mask_word` when it is a tracked mask, matching the b32 path. **No regressions** - Semantic suite: 500 files / 6,367 tests / 0 failed at `main` `bdbc7e923`; 501 files / 6,373 tests / 0 failed at the merge (+1 file, +6 tests). - GPU fixtures (268): MoltenVK 195 PASS / 3 FAIL / 70 SKIP, KosmicKrisp 190 / 5 / 73, identical at `main` and the merge after normalising the per-run temp directory. Same pre-existing failures (`cs_fma_fused`, `cs_imgatomic_ext`, `ps_ssharp` on MV; `cs_bvh`, `cs_bvh32`, `cs_imgatomic_ext`, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel` on KK). **Finding** The GPU fixtures do not exercise this rule at all: the only shader with `s_bitcmp` is `runtime/test/shaders/cs_w32_salu_ext.asm`, and it uses `s_bitcmp0/1_b32` on plain SGPR data, not `_b64` and not a mask/mixed pair. The doc row says "Not yet GPU-verified", which is accurate; all five fixed combinations rest on `spirv_mini_interp`. A small `cs_w64x_bitcmp_mixed.asm` (or a few lines added to an existing `cs_w64x_*` fixture) storing SCC for a `(mask, -1)` wave32 pair, a swapped wave64 half pair and a mixed pair would give the rule the same kind of hardware check that `cs_w64x_partial_scmp.asm` gives the compare rules. `python -I scripts/check_no_game_data.py` on the changed files: clean. `git diff --check`: clean. No game files. AI-assisted.
tiguan26 commented 2026-11-27 04:46:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:46:44Z.

Review: APPROVED


Approving c26efd297.

s_bitcmp* now reads each half of an SGPR pair as what it holds (a tracked mask word as its mask, data as data) unless the pair is a real lo/hi wave mask, a wave32 vcc operand as its two words, and a lane-mask bit index through lane_mask_word; null, immediates and the 32-bit form keep their paths. wavehs' finding stands as a follow-up rather than a blocker: no GPU fixture reaches these combinations yet, and the doc row says so.

test_bitcmp64_mixed_and_special.py 6 passed (4 subtests). Merged onto main d1dff7949 together with #2397, #2416 and the other three of this series below (no conflicts), on Linux with Python 3.13. The full translator suite (run_semantic_tests.py tests/semantic) on that tree has only the 8 failures main has here (7 in test_fspx_dot4_op_sel_disasm, test_int32_to_f64), and tests/test_translate.py only main's own ps_sdwa_f16_const.asm (an llvm-mc version difference in this environment). AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6083601877 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#pullrequestreview-6083601877). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-27T04:46:44Z. **Review:** APPROVED --- Approving c26efd297. `s_bitcmp*` now reads each half of an SGPR pair as what it holds (a tracked mask word as its mask, data as data) unless the pair is a real lo/hi wave mask, a wave32 `vcc` operand as its two words, and a lane-mask bit index through `lane_mask_word`; null, immediates and the 32-bit form keep their paths. wavehs' finding stands as a follow-up rather than a blocker: no GPU fixture reaches these combinations yet, and the doc row says so. `test_bitcmp64_mixed_and_special.py` 6 passed (4 subtests). Merged onto `main` `d1dff7949` together with #2397, #2416 and the other three of this series below (no conflicts), on Linux with Python 3.13. The full translator suite (`run_semantic_tests.py tests/semantic`) on that tree has only the 8 failures `main` has here (7 in `test_fspx_dot4_op_sel_disasm`, `test_int32_to_f64`), and `tests/test_translate.py` only `main`'s own `ps_sdwa_f16_const.asm` (an llvm-mc version difference in this environment). AI-assisted (Claude Code, Claude Opus 5.5).
Tauwni commented 2026-11-27 15:37:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T15:37:05Z.


Tested c26efd297 merged onto main ec91d695c on a Mac (profile S), where wave64 is always emulated on 32-wide subgroups: Apple M3, macOS 26.5.1, MoltenVK 1.4.2, KosmicKrisp and llvmpipe (Mesa 26.3.1). No game files.

scripts/run_gpu_tests.py, auto mode, test programs from main:

Driver main main + this PR
MoltenVK 196/269 196/269
MoltenVK, LEONIDA_W64_EMULATE=1 230/269 230/269
KosmicKrisp 191/269 191/269
llvmpipe 177/269 177/269

The failures are the same on both sides (the known ones: #1724, #1518 and #1774 on MoltenVK, #2229's on KosmicKrisp). The translator suite passes with no failures.

Evidence: MEASURED, 1 run each. This only shows that nothing changes on Apple drivers. It says nothing about the game.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7222275868 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2360#issuecomment-7222275868). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-27T15:37:05Z. --- Tested `c26efd297` merged onto `main` `ec91d695c` on a Mac (profile S), where wave64 is always emulated on 32-wide subgroups: Apple M3, macOS 26.5.1, MoltenVK 1.4.2, KosmicKrisp and llvmpipe (Mesa 26.3.1). No game files. `scripts/run_gpu_tests.py`, auto mode, test programs from `main`: | Driver | `main` | `main` + this PR | |---|---|---| | MoltenVK | 196/269 | 196/269 | | MoltenVK, `LEONIDA_W64_EMULATE=1` | 230/269 | 230/269 | | KosmicKrisp | 191/269 | 191/269 | | llvmpipe | 177/269 | 177/269 | The failures are the same on both sides (the known ones: #1724, #1518 and #1774 on MoltenVK, #2229's on KosmicKrisp). The translator suite passes with no failures. Evidence: MEASURED, 1 run each. This only shows that nothing changes on Apple drivers. It says nothing about the game. AI-assisted (Claude Code, Claude Opus 5.5).
timbot103 commented 2026-11-28 03:20:57 +00:00 (Migrated from github.com)

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

Review: APPROVED


Verified head c26efd297 (vs parent fbf100b1b) on Windows 11 across AMD Radeon gfx1036 (32.0.21030.2001, native wave64 + emulated wave64) and RTX 5080 (616.64, emulated wave64) with Vulkan SDK 1.4.363.0 Core + SyncVal.

Static & semantic checks:

  • Canonical wave64 mask pairs still use a single wave_mask reconstruction; mixed/swapped/duplicate pairs reconstruct each word independently, EITHER constants stay scalar, wave32 FSPX vcc reads each half separately, and wave64_emulate_opt.py already accounts for mixed pairs as potential exchanges.
  • tests/semantic/test_bitcmp64_mixed_and_special.py — 6/6 OK.
  • tests/semantic/test_scalar_bitcmp.py — 23/23 OK.
  • tests/semantic/test_wave64_emulate_barriers.py — 13/13 OK.

Dual-GPU hardware checks (Vulkan SDK 1.4.363.0 Core + SyncVal):

  • Checked-in fixtures (cs_w32_salu_ext, cs_w64x_partial_scmp): PASS (exit 0 under Core + SyncVal) on both GPUs.
  • Directed mixed pair (lo=0x80000001, hi=0x00000010) testing both s_bitcmp1_b64 and s_bitcmp0_b64 at indices 0, 31, 32, 36, 63, 64, 95, 127 plus mask-derived index 0x20 (b64 bit 32 vs b32 bit 0):
    • Parent fbf100b1b: 498/1152 mismatches (Radeon native wave64 & RTX 5080 emulated 64t) and 306/720 mismatches (40-thread emulated wave64 on both GPUs).
    • Head c26efd297: 0/1152 and 0/720 mismatches across all 4 arms (0 VUIDs).
  • Directed 128-thread wave-divergent branch control (s_bitcmp1_b64 s[10:11], 36 + SCC read inside wave-0-only branch, wave 1 sentinel 0x55555555): 0/64 bad in wave 0 and 0/64 bad in wave 1 on both parent fbf100b1b and head c26efd297 across Radeon native wave64, Radeon emulated wave64, and RTX 5080 emulated wave64 (0 VUIDs).

No game data used. AI-assisted review (Codex static audit + Gemini dual-GPU verification).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6095401032 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#pullrequestreview-6095401032). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T03:20:57Z. **Review:** APPROVED --- Verified head `c26efd297` (vs parent `fbf100b1b`) on Windows 11 across AMD Radeon `gfx1036` (`32.0.21030.2001`, native wave64 + emulated wave64) and RTX 5080 (`616.64`, emulated wave64) with Vulkan SDK `1.4.363.0` Core + SyncVal. **Static & semantic checks:** - Canonical wave64 mask pairs still use a single `wave_mask` reconstruction; mixed/swapped/duplicate pairs reconstruct each word independently, `EITHER` constants stay scalar, wave32 FSPX `vcc` reads each half separately, and `wave64_emulate_opt.py` already accounts for mixed pairs as potential exchanges. - `tests/semantic/test_bitcmp64_mixed_and_special.py` — **6/6 OK**. - `tests/semantic/test_scalar_bitcmp.py` — **23/23 OK**. - `tests/semantic/test_wave64_emulate_barriers.py` — **13/13 OK**. **Dual-GPU hardware checks (Vulkan SDK `1.4.363.0` Core + SyncVal):** - Checked-in fixtures (`cs_w32_salu_ext`, `cs_w64x_partial_scmp`): **PASS** (exit 0 under Core + SyncVal) on both GPUs. - Directed mixed pair `(lo=0x80000001, hi=0x00000010)` testing both `s_bitcmp1_b64` and `s_bitcmp0_b64` at indices `0, 31, 32, 36, 63, 64, 95, 127` plus mask-derived index `0x20` (`b64` bit 32 vs `b32` bit 0): - Parent `fbf100b1b`: **498/1152 mismatches** (Radeon native wave64 & RTX 5080 emulated 64t) and **306/720 mismatches** (40-thread emulated wave64 on both GPUs). - Head `c26efd297`: **0/1152** and **0/720 mismatches** across all 4 arms (0 VUIDs). - Directed 128-thread wave-divergent branch control (`s_bitcmp1_b64 s[10:11], 36` + SCC read inside wave-0-only branch, wave 1 sentinel `0x55555555`): **0/64 bad** in wave 0 and **0/64 bad** in wave 1 on both parent `fbf100b1b` and head `c26efd297` across Radeon native wave64, Radeon emulated wave64, and RTX 5080 emulated wave64 (0 VUIDs). No game data used. AI-assisted review (Codex static audit + Gemini dual-GPU verification).
sodove commented 2026-11-28 09:15:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:15:48Z.


#2360 | head c26efd297e76e2664d0d81de9b8df18b5fd7a9db | python3 -I tests/semantic/test_bitcmp64_mixed_and_special.py -v | red: 6 tests, 6 assertion failures | green: 6 passed | Red → green

The baseline assertions exposed differing lane-mask and bit-test results across the tested wave modes.

Pinned main 4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237124555 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#issuecomment-7237124555). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T09:15:48Z. --- #2360 | head `c26efd297e76e2664d0d81de9b8df18b5fd7a9db` | `python3 -I tests/semantic/test_bitcmp64_mixed_and_special.py -v` | red: 6 tests, 6 assertion failures | green: 6 passed | **Red → green** The baseline assertions exposed differing lane-mask and bit-test results across the tested wave modes. Pinned main `4938673668d807bf365b61284bf22b1ff8d02cc4`, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7236982945).
zmasi commented 2026-11-28 10:28:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:28:08Z.


VERIFY-2360-VEGA20-RADV: native fixed-wave64 compute on gfx906 / RADV Mesa 26.0.8. The same four synthetic dispatches and independent integer reference gave 1,080 wrong words out of 2,368 on 33db04a70 and 0/2,368 on c26efd297 merged with that main. Both builds produced valid modules and completed the GPU work; the difference is in the returned data.

Case Main wrong / checked Merge wrong / checked
Scalar and canonical-mask controls 0/640 0/640
Mixed mask/data halves 248/704 0/704
Swapped or duplicated halves 320/512 0/512
Mask used as bit index 512/512 0/512

A separate GPU probe confirmed subgroup size 64 and lane order. No unwritten payloads or changed guard words; zero Khronos validation or synchronization errors. All six new semantic test methods passed on the merge and the adjacent 23 scalar-bitcmp tests passed on both trees. Wave32 cases were interpreter checks, not native wave32 GPU evidence.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237915775 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#issuecomment-7237915775). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T10:28:08Z. --- `VERIFY-2360-VEGA20-RADV`: native fixed-wave64 compute on gfx906 / RADV Mesa 26.0.8. The same four synthetic dispatches and independent integer reference gave **1,080 wrong words out of 2,368** on `33db04a70` and **0/2,368** on `c26efd297` merged with that main. Both builds produced valid modules and completed the GPU work; the difference is in the returned data. | Case | Main wrong / checked | Merge wrong / checked | |---|---:|---:| | Scalar and canonical-mask controls | 0/640 | 0/640 | | Mixed mask/data halves | 248/704 | 0/704 | | Swapped or duplicated halves | 320/512 | 0/512 | | Mask used as bit index | 512/512 | 0/512 | A separate GPU probe confirmed subgroup size 64 and lane order. No unwritten payloads or changed guard words; zero Khronos validation or synchronization errors. All six new semantic test methods passed on the merge and the adjacent 23 scalar-bitcmp tests passed on both trees. Wave32 cases were interpreter checks, not native wave32 GPU evidence. AI-assisted.
OreoFR commented 2026-11-29 19:17:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T19:17:53Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, spirv-tools + llvm-mc, main 7c330c76d (also merges cleanly on current main dd87aa405; does not force a rebase of #2566), PR head c26efd297 : red 6 failures / green 6 OK, 0 skipped

  • Red: test_bitcmp64_mixed_and_special 0/6. Green: 6/6, 0 skipped.
  • Semantic suite (scripts/run_semantic_tests.py, 529+ files, ~6 530 tests) and the CI translator-tests pytest selection: identical to main (main's known failures only: test_interp_computed_ij_fallback x2, test_mesh_serial_waves x6).
  • Reviews: 2 APPROVED (tiguan26, timbot103) and 2 positive COMMENTED, all on this head; nothing open.
  • Diff: each half of an SGPR pair is read as mask or data, and vcc splits into vcc_lo/vcc_hi in wave32.
  • Rule check: a new docs/design.md row is added, but there is no .asm fixture in tests/semantic/ (the assembly is inline in the test). The repo rule asks for one.

Verdict: READY on tests; missing the .asm fixture required for a new translator rule.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261167619 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#issuecomment-7261167619). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T19:17:53Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, spirv-tools + llvm-mc, main 7c330c76d (also merges cleanly on current main dd87aa405; does not force a rebase of #2566), PR head c26efd297 : red 6 failures / green 6 OK, 0 skipped - **Red**: `test_bitcmp64_mixed_and_special` 0/6. **Green**: 6/6, 0 skipped. - Semantic suite (`scripts/run_semantic_tests.py`, 529+ files, ~6 530 tests) and the CI translator-tests pytest selection: identical to main (main's known failures only: `test_interp_computed_ij_fallback` x2, `test_mesh_serial_waves` x6). - Reviews: 2 APPROVED (tiguan26, timbot103) and 2 positive COMMENTED, all on this head; nothing open. - Diff: each half of an SGPR pair is read as mask or data, and `vcc` splits into `vcc_lo`/`vcc_hi` in wave32. - **Rule check**: a new `docs/design.md` row is added, but there is **no `.asm` fixture in `tests/semantic/`** (the assembly is inline in the test). The repo rule asks for one. **Verdict: READY on tests; missing the `.asm` fixture required for a new translator rule.** AI-assisted: Claude Code
KelboLive commented 2026-11-30 17:36:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T17:36:23Z.


Independent check on Windows (not the author), at c26efd297.

  • tests/semantic/test_bitcmp64_mixed_and_special.py: 6 tests OK.

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10, llvm-mc 21.1.8.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286569792 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#issuecomment-7286569792). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T17:36:23Z. --- Independent check on Windows (not the author), at `c26efd297`. - `tests/semantic/test_bitcmp64_mixed_and_special.py`: **6 tests OK**. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10, llvm-mc 21.1.8. AI-assisted: yes (opencode).
kurrutako commented 2026-12-01 10:46:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kurrutako on 2026-12-01T10:46:59Z.


Tested locally on Windows 11 with Python 3.14 and SPIRV-Tools from Vulkan SDK 1.4.363.

On the PR head

  • tests/semantic/test_bitcmp64_mixed_and_special.py: 6/6 pass on c26efd2.
  • On main cd73dda with only that test file copied in: 6 failures across 5 tests, so the test catches the bug.

Merged into current main locally

  • scripts/run_semantic_tests.py tests/semantic: 554 files, 0 failed.
  • Pytest over the 96 test files that import rdna2spirv/lane_masks: 2776 passed.
    • The other 2 (the test_feature_scan atomic-write tests) fail on this machine on plain main too.
  • Merges cleanly together with #2355, and the combined tree passes the semantic suite (555 files, 0 failed).

CI

  • The red checks are all outside this change, and they fail on #2355 as well:
    • the dpp llvm-mc failure in translator-tests and macos-python;
    • the vk_null_descriptor_test build in linux-gpu-tools;
    • cs_imgatomic_ext on macos;
    • Windows unittest/ctest.
  • Main is green now, so a rebase should clear them.

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7308709971 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#issuecomment-7308709971). Originally posted by [kurrutako](https://github.com/kurrutako) on 2026-12-01T10:46:59Z. --- Tested locally on Windows 11 with Python 3.14 and SPIRV-Tools from Vulkan SDK 1.4.363. **On the PR head** - `tests/semantic/test_bitcmp64_mixed_and_special.py`: 6/6 pass on c26efd2. - On main cd73dda with only that test file copied in: 6 failures across 5 tests, so the test catches the bug. **Merged into current main locally** - `scripts/run_semantic_tests.py tests/semantic`: 554 files, 0 failed. - Pytest over the 96 test files that import rdna2spirv/lane_masks: 2776 passed. - The other 2 (the `test_feature_scan` atomic-write tests) fail on this machine on plain main too. - Merges cleanly together with #2355, and the combined tree passes the semantic suite (555 files, 0 failed). **CI** - The red checks are all outside this change, and they fail on #2355 as well: - the dpp llvm-mc failure in translator-tests and macos-python; - the `vk_null_descriptor_test` build in linux-gpu-tools; - cs_imgatomic_ext on macos; - Windows unittest/ctest. - Main is green now, so a rebase should clear them. AI-assisted (Claude Code)
aslan2142 commented 2026-12-01 11:43:33 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed the diff against main: tools/rdna2spirv.py:2370-2410 cleanly keeps the single wave_mask fast path for canonical wave64 masks while materializing mixed pairs, swapped/duplicated halves, wave32 vcc, and lane-mask bit-index operands accurately, covered by tests/semantic/test_bitcmp64_mixed_and_special.py and documented in docs/design.md. Clean-room verified. Approving; please merge/rebase current main so CI runs green before merge.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130548248 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2360#pullrequestreview-6130548248). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:43:33Z. **Review:** APPROVED --- Reviewed the diff against `main`: `tools/rdna2spirv.py:2370-2410` cleanly keeps the single `wave_mask` fast path for canonical wave64 masks while materializing mixed pairs, swapped/duplicated halves, wave32 `vcc`, and lane-mask bit-index operands accurately, covered by `tests/semantic/test_bitcmp64_mixed_and_special.py` and documented in `docs/design.md`. Clean-room verified. Approving; please merge/rebase current `main` so CI runs green before merge. *(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!2360
No description provided.