You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cs_w32_permlane_fi fails on MoltenVK 1.4.2: the FI=0 / BOUND_CTRL lanes read the source lane's value instead of keeping the old value #5895
cs_w32_permlane_fi fails on MoltenVK 1.4.2: the FI=0 / BOUND_CTRL lanes read the source lane's value instead of keeping the old value
The SHADER-74 fixture (runtime/test/shaders/cs_w32_permlane_fi.asm, EXEC 0x55555555, every active lane's source lane off) fails on Apple M1 Max / macOS 27.2.1 / MoltenVK 1.4.2 at main561b65a83:
FAIL cs_w32_permlane_fi 4 4 4 1 52 52 52 49
Expected (pinned in docs/design.md and check.py): 1000 0 4 1 1000 0 52 49 — the FI=0 lanes keep their old value (out[0], out[4]) or read 0 with BOUND_CTRL=1 (out[1], out[5]). Instead they read the source lane's value (4, 52), which is the pre-SHADER-74 behaviour: the source on ? value : (FI ? value : (BC ? 0 : old)) select always takes the value arm on this driver.
Passes on KosmicKrisp (Homebrew mesa 26.3.1) on the same machine, same commit, same build — so the translator's FI/BC implementation is correct on that path.
Suspect is MoltenVK 1.4.2's SPIRV-Cross lowering breaking the active-bit shuffle + select, the same short-circuiting class as Keep ds_bpermute subgroup operations convergent on MoltenVK #932 (ds_bpermute under a lane-dependent ternary) and the cs_dpp_ops note in docs/testing.md (SPIRV-Cross moving subgroup ballots/shuffles into &&/?:).
Worth checking: a MoltenVK build with SPIRV-Cross 5c372ffb or newer, via LEONIDA_VULKAN_LOADER.
Both native and LEONIDA_W64_EMULATE=1 full-suite runs show it (8 failures total on MoltenVK, this the only one outside the documented set). Synthetic fixture only; no game data. Full result in #166.
AI-assisted (OpenCode / DeepSeek V4.1 Flash + GLM-5.3): the agents ran the suites and wrote this issue.
Follow-up: the fixture is not a regression of a previously passing state on this driver. cs_w32_permlane_fi.asm entered with 71d8f8685 (SHADER-74), after main7b7d73f8 — a suite run at 7b7d73f8 on this same machine has no such test, and at 561b65a83 it has failed on MoltenVK 1.4.2 in every run (native and LEONIDA_W64_EMULATE=1), while passing on KosmicKrisp at the same commit and build. So the SHADER-74 FI/BC lowering has never held on MoltenVK 1.4.2 here; the hardware measurement in docs/design.md was RDNA2 (aslan2142 in #374), so an Apple/MoltenVK path was unmeasured until now.
Interim result (per the claim): a fresh MoltenVK main build at SPIRV-Cross aa217aeb — which includes all four revisions docs/testing.md cites for the other MoltenVK fixes (5c372ffb "control dependent expressions don't end up in a ternary", 300681bb negative-zero, 57e4efcc, 98cbb7c0) — does not fix cs_w32_permlane_fi on this M1 Max: same words (4 4 4 1 52 52 52 49, want 1000 0 4 1 1000 0 52 49). KosmicKrisp passes; the CPU model passes. So the resolution is the translator-side workaround branch of the claim: rework the SHADER-74 FI/BOUND_CTRL lowering the way #932 reworked ds_bpermute (bitwise masks instead of a select whose arms the driver's lowering can short-circuit), keeping it correct on every driver.
Also measured on the same build, for the follow-up: cs_fma_fused still reads 0x00000000 for word 7 on this GPU with MoltenVK main, where docs/testing.md documents a pass with MoltenVK main (measured on other M-series). Same symptom on 1.4.2.
Fix: #6322 — the #932 pattern applied to the permlane FI/BOUND_CTRL path: absent source lanes are redirected to the calling lane, the value and the source's activity bit are fetched through that safe index, and the result and the destination write combine with bitwise masks instead of a scalar select, so the ballot and both shuffles run before lane predication.
On this M1 Max: cs_w32_permlane_fi passes on MoltenVK 1.4.2, on MoltenVK main @ SPIRV-Cross aa217aeb, and on KosmicKrisp; the full suite goes from 165/232 (8 failed) to 166/232 (7 failed, the documented set) on MoltenVK and is unchanged on KosmicKrisp. crosslane_fuzz seed 1, 50 programs, wave32 native, standard model: 36/50 match + 10 hypothesis-only before, 43/50 + 3 after, the seven newly matching programs being the FI=0 permlane ones; the four remaining mismatches are the same non-permlane programs before and after. --permlane-fetch-inactive (which models the off-lane fetch as FI=1) now correctly diverges from the fixed GPU.
Activity
autowert66 commentedon Nov 23, 2026
Follow-up: the fixture is not a regression of a previously passing state on this driver.
cs_w32_permlane_fi.asmentered with71d8f8685(SHADER-74), aftermain7b7d73f8— a suite run at7b7d73f8on this same machine has no such test, and at561b65a83it has failed on MoltenVK 1.4.2 in every run (native andLEONIDA_W64_EMULATE=1), while passing on KosmicKrisp at the same commit and build. So the SHADER-74 FI/BC lowering has never held on MoltenVK 1.4.2 here; the hardware measurement indocs/design.mdwas RDNA2 (aslan2142 in #374), so an Apple/MoltenVK path was unmeasured until now.autowert66 commentedon Nov 23, 2026
Interim result (per the claim): a fresh MoltenVK
mainbuild at SPIRV-Crossaa217aeb— which includes all four revisionsdocs/testing.mdcites for the other MoltenVK fixes (5c372ffb"control dependent expressions don't end up in a ternary",300681bbnegative-zero,57e4efcc,98cbb7c0) — does not fixcs_w32_permlane_fion this M1 Max: same words (4 4 4 1 52 52 52 49, want1000 0 4 1 1000 0 52 49). KosmicKrisp passes; the CPU model passes. So the resolution is the translator-side workaround branch of the claim: rework the SHADER-74 FI/BOUND_CTRL lowering the way #932 reworkedds_bpermute(bitwise masks instead of a select whose arms the driver's lowering can short-circuit), keeping it correct on every driver.Also measured on the same build, for the follow-up:
cs_fma_fusedstill reads0x00000000for word 7 on this GPU with MoltenVKmain, wheredocs/testing.mddocuments a pass with MoltenVKmain(measured on other M-series). Same symptom on 1.4.2.autowert66 commentedon Nov 23, 2026
Fix: #6322 — the #932 pattern applied to the permlane FI/BOUND_CTRL path: absent source lanes are redirected to the calling lane, the value and the source's activity bit are fetched through that safe index, and the result and the destination write combine with bitwise masks instead of a scalar select, so the ballot and both shuffles run before lane predication.
On this M1 Max:
cs_w32_permlane_fipasses on MoltenVK 1.4.2, on MoltenVKmain@ SPIRV-Crossaa217aeb, and on KosmicKrisp; the full suite goes from 165/232 (8 failed) to 166/232 (7 failed, the documented set) on MoltenVK and is unchanged on KosmicKrisp.crosslane_fuzzseed 1, 50 programs, wave32 native, standard model: 36/50 match + 10 hypothesis-only before, 43/50 + 3 after, the seven newly matching programs being the FI=0 permlane ones; the four remaining mismatches are the same non-permlane programs before and after.--permlane-fetch-inactive(which models the off-lane fetch as FI=1) now correctly diverges from the fixed GPU.Keep the permlane FI/BOUND_CTRL subgroup operations convergent on Mol…