[GH-ISSUE #3898] Strata on Mac with Orcarouter has issue #1667

Closed
opened 2026-11-04 01:53:02 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @agapess on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3898

Apple M5 Ultra 96 GB, Strata 0.1.48-metal,
OrcaRouter Qwen3.8 Flash Next IQ3_XXS,
engine loads successfully but first request fails with:
mtl: no function gemv_18_16_1_4_1
Function gemv_18_16_1_4_1 was not found in the library

Originally created by @agapess on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3898 Apple M5 Ultra 96 GB, Strata 0.1.48-metal, OrcaRouter Qwen3.8 Flash Next IQ3_XXS, engine loads successfully but first request fails with: mtl: no function gemv_18_16_1_4_1 Function gemv_18_16_1_4_1 was not found in the library
bsakaguchi 2026-11-04 01:53:02 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6378799704 --> @github-actions[bot] commented on GitHub (Oct 24, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@Jonathan0827 commented on GitHub (Oct 24, 2026):

I also got this issue

<!-- gh-comment-id:6378992091 --> @Jonathan0827 commented on GitHub (Oct 24, 2026): I also got this issue
Author
Owner

@tamacolet commented on GitHub (Oct 28, 2026):

Reproduced locally, with root cause and a fix that worked for me.

Setup: Apple M5 Max 128 GB · macOS 27.2 · Strata 0.2.7 from source (setup.sh, commit 5e8a4cc) · engine 0.1.52-metal · OrcaRouter Qwen3.8-Flash-Next-Uncensored IQ3_XXS (2 shards), repacked with metal_repack.py --verify, packed with iq_pack.py --compat-bf16, 32K context.

What happened: The engine loads, then the first request exits it (code 3) with no function gemv_18_16_1_4_1. After adding IQ3_XXS, the next request failed with no function gemv_22_16_1_4_1 (IQ2_S, which the OrcaRouter file uses for attn_q/attn_k).

Cause: The OrcaRouter GGUF stores some dense (non-expert) tensors as IQ3_XXS and IQ2_S. The Metal kernels already have the dequant code for both types (the expert path uses them), but the dense instantiation lists in gemv.metal, dense_mm.metal and mma.metal only list them up to T_IQ3_S.

Fix: Add T_IQ3_XXS and T_IQ2_S next to T_IQ3_S in those lists. The kernels compile at engine start, so no rebuild was needed.

diff --git a/metal/kernels/dense_mm.metal b/metal/kernels/dense_mm.metal
index 45e29ac..7855ab1 100644
--- a/metal/kernels/dense_mm.metal
+++ b/metal/kernels/dense_mm.metal
@@ -61,7 +61,7 @@ kernel void gemm_f16(device half* A [[buffer(0)]], device half* B [[buffer(1)]],
 
 #define DQ(F) template [[host_name("dq_f16_" #F)]] kernel decltype(dq_f16<F>) dq_f16<F>;
 #define DQ_(F) DQ(F)
-DQ_(T_F32) DQ_(T_BF16) DQ_(T_Q8_0) DQ_(T_Q4_0) DQ_(T_Q5_0) DQ_(T_IQ4_NL) DQ_(T_IQ4_XS) DQ_(T_Q2_0) DQ_(T_IQ3_S) DQ_(T_Q3_K)
+DQ_(T_F32) DQ_(T_BF16) DQ_(T_Q8_0) DQ_(T_Q4_0) DQ_(T_Q5_0) DQ_(T_IQ4_NL) DQ_(T_IQ4_XS) DQ_(T_Q2_0) DQ_(T_IQ3_S) DQ_(T_IQ3_XXS) DQ_(T_IQ2_S) DQ_(T_Q3_K)
 DQ_(T_Q4_K) DQ_(T_Q5_K) DQ_(T_Q6_K)
 template [[host_name("gemm_f16_64_64_4")]] kernel decltype(gemm_f16<64, 64, 4>) gemm_f16<64, 64, 4>;
 template [[host_name("gemm_f16_128_64_4")]] kernel decltype(gemm_f16<128, 64, 4>) gemm_f16<128, 64, 4>;
diff --git a/metal/kernels/gemv.metal b/metal/kernels/gemv.metal
index 6d4ed3a..ca71f72 100644
--- a/metal/kernels/gemv.metal
+++ b/metal/kernels/gemv.metal
@@ -96,7 +96,7 @@ kernel void gemv(device const uchar* W [[buffer(0)]], device const float* xp [[b
                   GV(F, 32, 1, 8, 8) GV(F, 16, 1, 8, 4) GV(F, 32, 1, 8, 2) GV(F, 8, 1, 8, 1)                   GV(F, 1, 1, 4, 1) GV(F, 1, 2, 4, 1) GV(F, 2, 1, 4, 1) GV(F, 2, 2, 4, 1) GV(F, 1, 1, 2, 1) GV(F, 4, 4, 4, 1)
 #ifndef GEMV_TYPES
 #define GEMV_TYPES GV_SET(T_F32) GV_SET(T_BF16) GV_SET(T_Q8_0) GV_SET(T_Q4_0) GV_SET(T_Q5_0) GV_SET(T_IQ4_NL) GV_SET(T_IQ4_XS) \
-                   GV_SET(T_Q2_0) GV_SET(T_IQ3_S) GV_SET(T_Q3_K) GV_SET(T_Q4_K) GV_SET(T_Q5_K) GV_SET(T_Q6_K)
+                   GV_SET(T_Q2_0) GV_SET(T_IQ3_S) GV_SET(T_IQ3_XXS) GV_SET(T_IQ2_S) GV_SET(T_Q3_K) GV_SET(T_Q4_K) GV_SET(T_Q5_K) GV_SET(T_Q6_K)
 #endif
 GEMV_TYPES
 
@@ -154,8 +154,8 @@ kernel void gemv_pair(device const uchar* Wg [[buffer(0)]], device const float*
 
 #define GP_(F1, F2) template [[host_name("gemv_pair_" #F1 "_" #F2)]] kernel decltype(gemv_pair<F1, F2, 32, 4>) gemv_pair<F1, F2, 32, 4>;
 #define GP(F1, F2) GP_(F1, F2)
-#define GP_ROW(F1) GP(F1, T_IQ3_S) GP(F1, T_IQ4_XS) GP(F1, T_Q2_0) GP(F1, T_Q3_K) GP(F1, T_Q4_K) GP(F1, T_Q5_K) GP(F1, T_Q6_K)
-GP_ROW(T_IQ3_S) GP_ROW(T_IQ4_XS) GP_ROW(T_Q2_0) GP_ROW(T_Q3_K) GP_ROW(T_Q4_K) GP_ROW(T_Q5_K) GP_ROW(T_Q6_K)
+#define GP_ROW(F1) GP(F1, T_IQ3_S) GP(F1, T_IQ3_XXS) GP(F1, T_IQ2_S) GP(F1, T_IQ4_XS) GP(F1, T_Q2_0) GP(F1, T_Q3_K) GP(F1, T_Q4_K) GP(F1, T_Q5_K) GP(F1, T_Q6_K)
+GP_ROW(T_IQ3_S) GP_ROW(T_IQ3_XXS) GP_ROW(T_IQ2_S) GP_ROW(T_IQ4_XS) GP_ROW(T_Q2_0) GP_ROW(T_Q3_K) GP_ROW(T_Q4_K) GP_ROW(T_Q5_K) GP_ROW(T_Q6_K)
 // Q2_0 with raw activations (the shared expert's down reading the pair's raw h)
 GV_SET(T_Q2_0R)
 
@@ -261,4 +261,4 @@ kernel void gemv_x(device const uchar* W [[buffer(0)]], device const float* xp [
 #define GVX_SET(F) GVX(F, 32, 1, 4) GVX(F, 32, 2, 4) GVX(F, 16, 1, 4) GVX(F, 16, 2, 4) GVX(F, 8, 1, 4) GVX(F, 8, 2, 4) \
                    GVX(F, 4, 2, 4) GVX(F, 16, 2, 8) GVX(F, 8, 2, 8) GVX(F, 16, 4, 4) GVX(F, 32, 2, 8) GVX(F, 2, 2, 4)
 GVX_SET(T_BF16) GVX_SET(T_Q8_0) GVX_SET(T_Q4_0) GVX_SET(T_Q5_0) GVX_SET(T_IQ4_NL) GVX_SET(T_IQ4_XS) GVX_SET(T_Q2_0)
-GVX_SET(T_IQ3_S) GVX_SET(T_Q3_K) GVX_SET(T_Q4_K) GVX_SET(T_Q5_K) GVX_SET(T_Q6_K)
+GVX_SET(T_IQ3_S) GVX_SET(T_IQ3_XXS) GVX_SET(T_IQ2_S) GVX_SET(T_Q3_K) GVX_SET(T_Q4_K) GVX_SET(T_Q5_K) GVX_SET(T_Q6_K)
diff --git a/metal/kernels/mma.metal b/metal/kernels/mma.metal
index 9bbb27e..7ea7740 100644
--- a/metal/kernels/mma.metal
+++ b/metal/kernels/mma.metal
@@ -213,4 +213,4 @@ kernel void gemv_mma(device const uchar* W [[buffer(0)]], device const float* x
 #define MM(F, S) template [[host_name("gemv_mma_" #F "_" #S)]] kernel decltype(gemv_mma<F, S>) gemv_mma<F, S>;
 #define MM_SET(F) MM(F, 1) MM(F, 2) MM(F, 4)
 MM_SET(T_BF16) MM_SET(T_Q8_0) MM_SET(T_Q4_0) MM_SET(T_Q5_0) MM_SET(T_IQ4_NL) MM_SET(T_IQ4_XS) MM_SET(T_Q2_0)
-MM_SET(T_IQ3_S) MM_SET(T_Q3_K) MM_SET(T_Q4_K) MM_SET(T_Q5_K) MM_SET(T_Q6_K)
+MM_SET(T_IQ3_S) MM_SET(T_IQ3_XXS) MM_SET(T_IQ2_S) MM_SET(T_Q3_K) MM_SET(T_Q4_K) MM_SET(T_Q5_K) MM_SET(T_Q6_K)

Result with the patch: Answers are correct (capital of Japan, a Python primes one-liner, a 400-character story, a 2,835-token summary). Decode runs at 95–107 tok/s, and prompt reading at ~1,240 tok/s warm (385 tok/s on the first cold request). Engine RSS is ~57.6 GB.

Related docs gap: docs/ORCA.md only covers CUDA, while docs/MAC.md reads as if IQ3_XXS works on Metal.

<!-- gh-comment-id:6461877713 --> @tamacolet commented on GitHub (Oct 28, 2026): Reproduced locally, with root cause and a fix that worked for me. **Setup:** Apple M5 Max 128 GB · macOS 27.2 · Strata 0.2.7 from source (`setup.sh`, commit 5e8a4cc) · engine 0.1.52-metal · OrcaRouter Qwen3.8-Flash-Next-Uncensored IQ3_XXS (2 shards), repacked with `metal_repack.py --verify`, packed with `iq_pack.py --compat-bf16`, 32K context. **What happened:** The engine loads, then the first request exits it (code 3) with `no function gemv_18_16_1_4_1`. After adding IQ3_XXS, the next request failed with `no function gemv_22_16_1_4_1` (IQ2_S, which the OrcaRouter file uses for `attn_q`/`attn_k`). **Cause:** The OrcaRouter GGUF stores some dense (non-expert) tensors as IQ3_XXS and IQ2_S. The Metal kernels already have the dequant code for both types (the expert path uses them), but the dense instantiation lists in `gemv.metal`, `dense_mm.metal` and `mma.metal` only list them up to `T_IQ3_S`. **Fix:** Add `T_IQ3_XXS` and `T_IQ2_S` next to `T_IQ3_S` in those lists. The kernels compile at engine start, so no rebuild was needed. ```diff diff --git a/metal/kernels/dense_mm.metal b/metal/kernels/dense_mm.metal index 45e29ac..7855ab1 100644 --- a/metal/kernels/dense_mm.metal +++ b/metal/kernels/dense_mm.metal @@ -61,7 +61,7 @@ kernel void gemm_f16(device half* A [[buffer(0)]], device half* B [[buffer(1)]], #define DQ(F) template [[host_name("dq_f16_" #F)]] kernel decltype(dq_f16<F>) dq_f16<F>; #define DQ_(F) DQ(F) -DQ_(T_F32) DQ_(T_BF16) DQ_(T_Q8_0) DQ_(T_Q4_0) DQ_(T_Q5_0) DQ_(T_IQ4_NL) DQ_(T_IQ4_XS) DQ_(T_Q2_0) DQ_(T_IQ3_S) DQ_(T_Q3_K) +DQ_(T_F32) DQ_(T_BF16) DQ_(T_Q8_0) DQ_(T_Q4_0) DQ_(T_Q5_0) DQ_(T_IQ4_NL) DQ_(T_IQ4_XS) DQ_(T_Q2_0) DQ_(T_IQ3_S) DQ_(T_IQ3_XXS) DQ_(T_IQ2_S) DQ_(T_Q3_K) DQ_(T_Q4_K) DQ_(T_Q5_K) DQ_(T_Q6_K) template [[host_name("gemm_f16_64_64_4")]] kernel decltype(gemm_f16<64, 64, 4>) gemm_f16<64, 64, 4>; template [[host_name("gemm_f16_128_64_4")]] kernel decltype(gemm_f16<128, 64, 4>) gemm_f16<128, 64, 4>; diff --git a/metal/kernels/gemv.metal b/metal/kernels/gemv.metal index 6d4ed3a..ca71f72 100644 --- a/metal/kernels/gemv.metal +++ b/metal/kernels/gemv.metal @@ -96,7 +96,7 @@ kernel void gemv(device const uchar* W [[buffer(0)]], device const float* xp [[b GV(F, 32, 1, 8, 8) GV(F, 16, 1, 8, 4) GV(F, 32, 1, 8, 2) GV(F, 8, 1, 8, 1) GV(F, 1, 1, 4, 1) GV(F, 1, 2, 4, 1) GV(F, 2, 1, 4, 1) GV(F, 2, 2, 4, 1) GV(F, 1, 1, 2, 1) GV(F, 4, 4, 4, 1) #ifndef GEMV_TYPES #define GEMV_TYPES GV_SET(T_F32) GV_SET(T_BF16) GV_SET(T_Q8_0) GV_SET(T_Q4_0) GV_SET(T_Q5_0) GV_SET(T_IQ4_NL) GV_SET(T_IQ4_XS) \ - GV_SET(T_Q2_0) GV_SET(T_IQ3_S) GV_SET(T_Q3_K) GV_SET(T_Q4_K) GV_SET(T_Q5_K) GV_SET(T_Q6_K) + GV_SET(T_Q2_0) GV_SET(T_IQ3_S) GV_SET(T_IQ3_XXS) GV_SET(T_IQ2_S) GV_SET(T_Q3_K) GV_SET(T_Q4_K) GV_SET(T_Q5_K) GV_SET(T_Q6_K) #endif GEMV_TYPES @@ -154,8 +154,8 @@ kernel void gemv_pair(device const uchar* Wg [[buffer(0)]], device const float* #define GP_(F1, F2) template [[host_name("gemv_pair_" #F1 "_" #F2)]] kernel decltype(gemv_pair<F1, F2, 32, 4>) gemv_pair<F1, F2, 32, 4>; #define GP(F1, F2) GP_(F1, F2) -#define GP_ROW(F1) GP(F1, T_IQ3_S) GP(F1, T_IQ4_XS) GP(F1, T_Q2_0) GP(F1, T_Q3_K) GP(F1, T_Q4_K) GP(F1, T_Q5_K) GP(F1, T_Q6_K) -GP_ROW(T_IQ3_S) GP_ROW(T_IQ4_XS) GP_ROW(T_Q2_0) GP_ROW(T_Q3_K) GP_ROW(T_Q4_K) GP_ROW(T_Q5_K) GP_ROW(T_Q6_K) +#define GP_ROW(F1) GP(F1, T_IQ3_S) GP(F1, T_IQ3_XXS) GP(F1, T_IQ2_S) GP(F1, T_IQ4_XS) GP(F1, T_Q2_0) GP(F1, T_Q3_K) GP(F1, T_Q4_K) GP(F1, T_Q5_K) GP(F1, T_Q6_K) +GP_ROW(T_IQ3_S) GP_ROW(T_IQ3_XXS) GP_ROW(T_IQ2_S) GP_ROW(T_IQ4_XS) GP_ROW(T_Q2_0) GP_ROW(T_Q3_K) GP_ROW(T_Q4_K) GP_ROW(T_Q5_K) GP_ROW(T_Q6_K) // Q2_0 with raw activations (the shared expert's down reading the pair's raw h) GV_SET(T_Q2_0R) @@ -261,4 +261,4 @@ kernel void gemv_x(device const uchar* W [[buffer(0)]], device const float* xp [ #define GVX_SET(F) GVX(F, 32, 1, 4) GVX(F, 32, 2, 4) GVX(F, 16, 1, 4) GVX(F, 16, 2, 4) GVX(F, 8, 1, 4) GVX(F, 8, 2, 4) \ GVX(F, 4, 2, 4) GVX(F, 16, 2, 8) GVX(F, 8, 2, 8) GVX(F, 16, 4, 4) GVX(F, 32, 2, 8) GVX(F, 2, 2, 4) GVX_SET(T_BF16) GVX_SET(T_Q8_0) GVX_SET(T_Q4_0) GVX_SET(T_Q5_0) GVX_SET(T_IQ4_NL) GVX_SET(T_IQ4_XS) GVX_SET(T_Q2_0) -GVX_SET(T_IQ3_S) GVX_SET(T_Q3_K) GVX_SET(T_Q4_K) GVX_SET(T_Q5_K) GVX_SET(T_Q6_K) +GVX_SET(T_IQ3_S) GVX_SET(T_IQ3_XXS) GVX_SET(T_IQ2_S) GVX_SET(T_Q3_K) GVX_SET(T_Q4_K) GVX_SET(T_Q5_K) GVX_SET(T_Q6_K) diff --git a/metal/kernels/mma.metal b/metal/kernels/mma.metal index 9bbb27e..7ea7740 100644 --- a/metal/kernels/mma.metal +++ b/metal/kernels/mma.metal @@ -213,4 +213,4 @@ kernel void gemv_mma(device const uchar* W [[buffer(0)]], device const float* x #define MM(F, S) template [[host_name("gemv_mma_" #F "_" #S)]] kernel decltype(gemv_mma<F, S>) gemv_mma<F, S>; #define MM_SET(F) MM(F, 1) MM(F, 2) MM(F, 4) MM_SET(T_BF16) MM_SET(T_Q8_0) MM_SET(T_Q4_0) MM_SET(T_Q5_0) MM_SET(T_IQ4_NL) MM_SET(T_IQ4_XS) MM_SET(T_Q2_0) -MM_SET(T_IQ3_S) MM_SET(T_Q3_K) MM_SET(T_Q4_K) MM_SET(T_Q5_K) MM_SET(T_Q6_K) +MM_SET(T_IQ3_S) MM_SET(T_IQ3_XXS) MM_SET(T_IQ2_S) MM_SET(T_Q3_K) MM_SET(T_Q4_K) MM_SET(T_Q5_K) MM_SET(T_Q6_K) ``` **Result with the patch:** Answers are correct (capital of Japan, a Python primes one-liner, a 400-character story, a 2,835-token summary). Decode runs at 95–107 tok/s, and prompt reading at ~1,240 tok/s warm (385 tok/s on the first cold request). Engine RSS is ~57.6 GB. Related docs gap: `docs/ORCA.md` only covers CUDA, while `docs/MAC.md` reads as if IQ3_XXS works on Metal.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 29, 2026):

Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection.

To bring it back: fix the title (area prefix) and the missing parts, then comment /reopen. A check runs and reopens it, or tells you what is still missing. See CONTRIBUTING.md.

<!-- gh-comment-id:6494798410 --> @github-actions[bot] commented on GitHub (Oct 29, 2026): Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection. To bring it back: fix the title (area prefix) and the missing parts, then comment `/reopen`. A check runs and reopens it, or tells you what is still missing. See [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1667
No description provided.