From c806611532574052173a8747c8a0f83d5966f246 Mon Sep 17 00:00:00 2001 From: bobcatchris <83428450+bobcatchris@users.noreply.github.com> Date: Sun, 22 Nov 2026 23:24:40 -0600 Subject: [PATCH 1/2] docs: Apple Silicon (M2, MoltenVK) Known problems row One row in docs/testing.md recording which tests on an Apple M2 with MoltenVK 1.4.2 need --lod-bias-fallback, --f16-interp-fallback, --subgroup-temps or --no-vertex-subgroups, with the measured suite counts at each PR head and its base. Counts only; no shader text or game data. AI-assisted. --- docs/testing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/testing.md b/docs/testing.md index 279eab0b2..bbda2bb85 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -435,6 +435,7 @@ The GPU tools of `runtime/test/shaders` (`vk_compute_test`, `vk_harness`, ...) r | `ps_bary` and `ps_uniform_branch` fail by about 0.9 | The GPU runs pixel shaders wave64 without fragment barycentrics (GCN3 and RDNA1 on RADV), or an old AMD Windows driver (22.40) | Current `main` skips them on such devices; on Windows, update the driver | | `cs_w32_salu64` gives eight wrong words on RDNA1 under RADV Mesa 25.2.8 (`0x1E6A2C48 0x1234 0 0x100 47 48 0xFFFF8000 0xFFFFFFFE`, where word 2 should be `0xFFFFFFFF`) | Only the high word of the `s_bfe_i64` result is wrong. The same words appear on four pinned V540s (Navi 12, PCI `1002:7360`) and on a clean upstream/main worktree, and three different valid SPIR-V sign-extension formulations give the same result while the CPU interpreter matches, so this is the driver version rather than the translator (SHADER-276) | Expected with Mesa 25.2.8; the fixture passes on NVIDIA and on AMD's Windows driver. Try a newer Mesa before treating it as a translator bug; do not weaken the fixture's expectation | | `d3d12_typeless_rtv` fails its WARP comparison on an AMD desktop iGPU (TEST-591) | [Reported on the Ryzen 5 7600X iGPU with Windows 10 build 19045 and AMD 23.40.02](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7083403389). The exact cause is still open. | Retest on a newer Windows and AMD driver combination. Passing results were reported on the [Ryzen 9 7900 iGPU with AMD 25.10.30.02](https://github.com/ItsNotRexed/Leonida/issues/3232#issuecomment-7085263408), a [gfx1036 iGPU with AMD 26.5.2](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084023801), and the [Ryzen 7 9800X3D iGPU with driver 32.0.21045.29003](https://github.com/ItsNotRexed/Leonida/pull/3440). | +| On an Apple M2 (Mac14,3) with MoltenVK 1.4.2, `ps_ssharp`, `ps_ssharp_lod` and `ps_ssharp_ops` fail at "point bias +1"; the wave32 subgroup and DPP tests (`cs_dpp*`, `cs_bpermute32`, `cs_exec_const`, the `cs_w32_*` mask/permute tests and the `cs_wqm*` tests) show as SKIP until the subgroup-temps fallback of #3086/#3302 is used; `ps_interp_f16_high` needs `--f16-interp-fallback`; and the `vs_m15` vertex pipeline of #1784 needs the no-vertex-subgroups fallback | Metal samplers have no `mipLodBias` (`samplerMipLodBias=false`), SPIRV-Cross cannot lower `PerVertexKHR` inputs to MSL, and it forwards a single-use subgroup result into a short-circuiting `OpLogicalAnd` / `OpLogicalOr` / `OpSelect`, so only some invocations run it (SHADER-529). MoltenVK also has no `shaderFloat64`, so f64 modules cannot run natively | The runners select these fallbacks where the device lacks the feature; each can be forced with its `LEONIDA_*` variable. Measured on this M2 (macOS 26.4 (25E246), subgroup 4..32, device Vulkan 1.4.357, llvm-mc 21.1.8): current main `98fa503f` 152/217 passed, 58 skipped, 7 failed (the known expected set). On PR heads: #1845 `a71346ff` 119/191 with `LEONIDA_LOD_BIAS_FALLBACK=1` vs 116/191 with `LEONIDA_LOD_BIAS_FALLBACK=0` (only those three S# tests differ); #3302 `b34aed42` 138/199 vs its base `f847748cc` 120/199 (18 subgroup tests SKIP to PASS from the included #3086); #2904 `6eccc0ca` 134/214 vs its base `aa2988cc` 127/210 (f64 fixtures SKIP to PASS); #1784 `vs_m15` 9 ok with the no-vertex-subgroups fallback vs 8 ok without | | `ps_interp_f16_high` fails on a Mac: `PerVertexKHR decoration is not supported in MSL`, then `vkCreateGraphicsPipelines` -3 | MoltenVK can't convert `PerVertexKHR` inputs to Metal | Current `main` translates it with `--f16-interp-fallback` on MoltenVK (see "Macs: 16-bit interpolation") | | `ps_vcmpx_forms` fails on a Mac: word 1 reads `0xf05e8e16`, want `0xf05e8a12` | MoltenVK's fast-math makes a compare of a NaN with itself true (SHADER-234) | Current `main`'s test programs turn it off (`MVK_CONFIG_FAST_MATH_ENABLED=0`, unless you set the variable yourself); rebuild them | | On a Mac, a translated shader's GPU time is 1.5 to 16 times what it would be without the precise-arithmetic overhead | MoltenVK's SPIRV-Cross turns every `NoContraction` float add, subtract and multiply into a call to an `[[clang::optnone]]` helper that Metal does not inline. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-234, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions, and the output is still exact. Before you time shaders on a Mac, build MoltenVK with SPIRV-Cross `98cbb7c0` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision` (KhronosGroup/MoltenVK#2917 moves it to `57e4efcc`), and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` | From f78253ed28e64ded19e3cac7df29b31906c331dd Mon Sep 17 00:00:00 2001 From: bobcatchris <83428450+bobcatchris@users.noreply.github.com> Date: Mon, 23 Nov 2026 00:24:49 -0600 Subject: [PATCH 2/2] docs(testing): note the Apple fallbacks are still open PRs --- docs/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testing.md b/docs/testing.md index bbda2bb85..a8b4c8815 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -435,7 +435,7 @@ The GPU tools of `runtime/test/shaders` (`vk_compute_test`, `vk_harness`, ...) r | `ps_bary` and `ps_uniform_branch` fail by about 0.9 | The GPU runs pixel shaders wave64 without fragment barycentrics (GCN3 and RDNA1 on RADV), or an old AMD Windows driver (22.40) | Current `main` skips them on such devices; on Windows, update the driver | | `cs_w32_salu64` gives eight wrong words on RDNA1 under RADV Mesa 25.2.8 (`0x1E6A2C48 0x1234 0 0x100 47 48 0xFFFF8000 0xFFFFFFFE`, where word 2 should be `0xFFFFFFFF`) | Only the high word of the `s_bfe_i64` result is wrong. The same words appear on four pinned V540s (Navi 12, PCI `1002:7360`) and on a clean upstream/main worktree, and three different valid SPIR-V sign-extension formulations give the same result while the CPU interpreter matches, so this is the driver version rather than the translator (SHADER-276) | Expected with Mesa 25.2.8; the fixture passes on NVIDIA and on AMD's Windows driver. Try a newer Mesa before treating it as a translator bug; do not weaken the fixture's expectation | | `d3d12_typeless_rtv` fails its WARP comparison on an AMD desktop iGPU (TEST-591) | [Reported on the Ryzen 5 7600X iGPU with Windows 10 build 19045 and AMD 23.40.02](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7083403389). The exact cause is still open. | Retest on a newer Windows and AMD driver combination. Passing results were reported on the [Ryzen 9 7900 iGPU with AMD 25.10.30.02](https://github.com/ItsNotRexed/Leonida/issues/3232#issuecomment-7085263408), a [gfx1036 iGPU with AMD 26.5.2](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084023801), and the [Ryzen 7 9800X3D iGPU with driver 32.0.21045.29003](https://github.com/ItsNotRexed/Leonida/pull/3440). | -| On an Apple M2 (Mac14,3) with MoltenVK 1.4.2, `ps_ssharp`, `ps_ssharp_lod` and `ps_ssharp_ops` fail at "point bias +1"; the wave32 subgroup and DPP tests (`cs_dpp*`, `cs_bpermute32`, `cs_exec_const`, the `cs_w32_*` mask/permute tests and the `cs_wqm*` tests) show as SKIP until the subgroup-temps fallback of #3086/#3302 is used; `ps_interp_f16_high` needs `--f16-interp-fallback`; and the `vs_m15` vertex pipeline of #1784 needs the no-vertex-subgroups fallback | Metal samplers have no `mipLodBias` (`samplerMipLodBias=false`), SPIRV-Cross cannot lower `PerVertexKHR` inputs to MSL, and it forwards a single-use subgroup result into a short-circuiting `OpLogicalAnd` / `OpLogicalOr` / `OpSelect`, so only some invocations run it (SHADER-529). MoltenVK also has no `shaderFloat64`, so f64 modules cannot run natively | The runners select these fallbacks where the device lacks the feature; each can be forced with its `LEONIDA_*` variable. Measured on this M2 (macOS 26.4 (25E246), subgroup 4..32, device Vulkan 1.4.357, llvm-mc 21.1.8): current main `98fa503f` 152/217 passed, 58 skipped, 7 failed (the known expected set). On PR heads: #1845 `a71346ff` 119/191 with `LEONIDA_LOD_BIAS_FALLBACK=1` vs 116/191 with `LEONIDA_LOD_BIAS_FALLBACK=0` (only those three S# tests differ); #3302 `b34aed42` 138/199 vs its base `f847748cc` 120/199 (18 subgroup tests SKIP to PASS from the included #3086); #2904 `6eccc0ca` 134/214 vs its base `aa2988cc` 127/210 (f64 fixtures SKIP to PASS); #1784 `vs_m15` 9 ok with the no-vertex-subgroups fallback vs 8 ok without | +| On an Apple M2 (Mac14,3) with MoltenVK 1.4.2, `ps_ssharp`, `ps_ssharp_lod` and `ps_ssharp_ops` fail at "point bias +1"; the wave32 subgroup and DPP tests (`cs_dpp*`, `cs_bpermute32`, `cs_exec_const`, the `cs_w32_*` mask/permute tests and the `cs_wqm*` tests) show as SKIP until the subgroup-temps fallback of #3086/#3302 is used; the `vs_m15` vertex pipeline of #1784 needs the no-vertex-subgroups fallback | Metal samplers have no `mipLodBias` (`samplerMipLodBias=false`), and SPIRV-Cross forwards a single-use subgroup result into a short-circuiting `OpLogicalAnd` / `OpLogicalOr` / `OpSelect`, so only some invocations run it (SHADER-529). MoltenVK also has no `shaderFloat64`, so f64 modules cannot run natively | These fallbacks are in open PRs (#1845, #3086/#3302, #2904, #1784), not on main yet; each PR adds its `LEONIDA_*` variable to force it. Measured on this M2 (macOS 26.4 (25E246), subgroup 4..32, device Vulkan 1.4.357, llvm-mc 21.1.8): main at `98fa503f` 152/217 passed, 58 skipped, 7 failed (the known expected set). On PR heads: #1845 `a71346ff` 119/191 with `LEONIDA_LOD_BIAS_FALLBACK=1` vs 116/191 with `LEONIDA_LOD_BIAS_FALLBACK=0` (only those three S# tests differ); #3302 `b34aed42` 138/199 vs its base `f847748cc` 120/199 (18 subgroup tests SKIP to PASS from the included #3086); #2904 `6eccc0ca` 134/214 vs its base `aa2988cc` 127/210 (f64 fixtures SKIP to PASS); #1784 `vs_m15` 9 ok with the no-vertex-subgroups fallback vs 8 ok without | | `ps_interp_f16_high` fails on a Mac: `PerVertexKHR decoration is not supported in MSL`, then `vkCreateGraphicsPipelines` -3 | MoltenVK can't convert `PerVertexKHR` inputs to Metal | Current `main` translates it with `--f16-interp-fallback` on MoltenVK (see "Macs: 16-bit interpolation") | | `ps_vcmpx_forms` fails on a Mac: word 1 reads `0xf05e8e16`, want `0xf05e8a12` | MoltenVK's fast-math makes a compare of a NaN with itself true (SHADER-234) | Current `main`'s test programs turn it off (`MVK_CONFIG_FAST_MATH_ENABLED=0`, unless you set the variable yourself); rebuild them | | On a Mac, a translated shader's GPU time is 1.5 to 16 times what it would be without the precise-arithmetic overhead | MoltenVK's SPIRV-Cross turns every `NoContraction` float add, subtract and multiply into a call to an `[[clang::optnone]]` helper that Metal does not inline. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-234, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions, and the output is still exact. Before you time shaders on a Mac, build MoltenVK with SPIRV-Cross `98cbb7c0` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision` (KhronosGroup/MoltenVK#2917 moves it to `57e4efcc`), and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` |