[GH-ISSUE #2323] [Bug]: Mac (M2 Max, macOS 26.3): garbage output — gdn_step for 2+ tokens is never dispatched (pipeline max 448 threads < 512); qsa_prompt.metal fails to compile #938

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

Originally created by @botbizs on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2323

What happened

Fresh ./setup.sh --model IQ3_S on an M2 Max (main at ed4773e, engine 0.1.44-metal). The engine starts, but every reply is garbage (e.g. """ZEROxmlxmlxml..., #文哲ntaxntax...) and MTP accepts 0 drafts. STRATA_METAL_PROMPT=window, STRATA_HC_Q8=0, STRATA_METAL_FUSE=0 do not change it.

I tracked it down to two separate problems.

1. gdn_step with GDN_NTOK >= 2 does not run at all on M2 Max

gdn_parity (built from metal/tests) fails on this Mac:

gdn_step pipeline: max 512 threads per threadgroup (the kernel needs 512)
gdn parity ntok 1: y rel L2 1.66e-07, ... PASS
gdn parity ntok 2: y rel L2 6.84e-01, state 1.83e+00, history 1.3e+00; ... partial commits bitwise: NO  FAIL
gdn parity ntok 3: y rel L2 8.02e-01, state 2.38e+00, history nan; ... FAIL
gdn parity ntok 4: y rel L2 8.49e-01, state 2.49e+00, history nan; ... FAIL

The test prints max_threads only for the ntok = 1 specialization. Per specialization on the M2 Max:

GDN_NTOK 1: maxTotalThreadsPerThreadgroup 512
GDN_NTOK 2: 448
GDN_NTOK 3: 448

The kernel is dispatched with 512 threads, so the 2+ token variants are silently not executed: a marker written after the token loop stays 0, and there is no command-buffer error. Every verify window / prompt window longer than one token therefore runs on stale outputs. My guess is that M2 has a smaller register budget than M4/M5, where you tested.

Fix: force the compiler to fit 512 (or 1024 for gdn_step8) threads:

--- metal/kernels/gdn.metal
-kernel void gdn_step_t(device float* state [[buffer(0)]], device float* hist [[buffer(1)]],
+[[max_total_threads_per_threadgroup(1024)]] kernel void gdn_step_t(device float* state [[buffer(0)]], device float* hist [[buffer(1)]],

After this change, gdn_parity reports ALL PASS (ntok 1–4: y rel L2 ~1.7e-07, history exact, partial commits bitwise), and gdn_prompt_parity passes too. It would probably also be worth checking pipeline.max_threads >= tg at dispatch time and failing loudly instead of silently.

2. qsa_prompt.metal does not compile with the macOS 26.3 MetalPerformancePrimitives headers

The first longer prompt kills the engine (exit(3)) with:

mtl: compile failed:
.../metal_cooperative_tensor:389:62: error: cannot initialize a parameter of type 'void *' with an rvalue of type 'const void *'
qsa_prompt.metal:234:16: note: in instantiation of member function 'metal::cooperative_tensor<float, ...>::cooperative_tensor' requested here

The cause is the copy auto tot = acc; in qsa_flash. Getting a second destination tensor instead compiles:

--- metal/kernels/qsa_prompt.metal
-    auto tot = acc;   // the running output; ...
+    auto tot = opO.template get_destination_cooperative_tensor<__tensor_ops_detail::__remove_addrspace_t<decltype(tPh)>,
+                                                               __tensor_ops_detail::__remove_addrspace_t<decltype(rv)>, float>();   // the running output; ...

(tot is zeroed right after, so the copy is only there for its type.) Note: qsa_prompt_parity then hangs the GPU on M2 (kIOGPUCommandBufferCallbackErrorHang), also with COOP_K4=0; I did not dig further. The engine itself (no M5 layout → no flash) runs fine.

Result with both fixes (via STRATA_METAL_KERNELS=<patched copy>)

Correct answers, MTP accepting drafts (e.g. 65 of 101). IQ3_S on M2 Max 96 GB, --spec 2, temp 0, 3 runs each:

decode tok/s prompt tok/s
short code / RU / story (400 tok) 31–33 / 27 / 31 —
after 5.6K / 22K prompt 29–30 / 31–32 295–309 / 302–309

The prompt runs on the prompt chain with "the older expert / attention kernels (no M5 layout)".

Other parity tests on this Mac all pass: gemv, expert, gr, gr2, qsa, route, sample, fuse, pair, mma, prompt, dense_mm. moe_mm_parity reports no function mm_gu_42_16_64_16_2 (probably a test-only issue).

Both diffs are above (full patch is the two hunks shown).

Strata version, GPU, OS: 0.1.44-metal (main ed4773e) · Apple M2 Max 96 GB · macOS 26.3.1

Originally created by @botbizs on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2323 ### What happened Fresh `./setup.sh --model IQ3_S` on an M2 Max (main at `ed4773e`, engine 0.1.44-metal). The engine starts, but every reply is garbage (e.g. `"""ZEROxmlxmlxml...`, `#文哲ntaxntax...`) and MTP accepts 0 drafts. `STRATA_METAL_PROMPT=window`, `STRATA_HC_Q8=0`, `STRATA_METAL_FUSE=0` do not change it. I tracked it down to two separate problems. **1. `gdn_step` with `GDN_NTOK >= 2` does not run at all on M2 Max** `gdn_parity` (built from `metal/tests`) fails on this Mac: ``` gdn_step pipeline: max 512 threads per threadgroup (the kernel needs 512) gdn parity ntok 1: y rel L2 1.66e-07, ... PASS gdn parity ntok 2: y rel L2 6.84e-01, state 1.83e+00, history 1.3e+00; ... partial commits bitwise: NO FAIL gdn parity ntok 3: y rel L2 8.02e-01, state 2.38e+00, history nan; ... FAIL gdn parity ntok 4: y rel L2 8.49e-01, state 2.49e+00, history nan; ... FAIL ``` The test prints `max_threads` only for the `ntok = 1` specialization. Per specialization on the M2 Max: ``` GDN_NTOK 1: maxTotalThreadsPerThreadgroup 512 GDN_NTOK 2: 448 GDN_NTOK 3: 448 ``` The kernel is dispatched with 512 threads, so the 2+ token variants are silently not executed: a marker written after the token loop stays 0, and there is no command-buffer error. Every verify window / prompt window longer than one token therefore runs on stale outputs. My guess is that M2 has a smaller register budget than M4/M5, where you tested. Fix: force the compiler to fit 512 (or 1024 for `gdn_step8`) threads: ```diff --- metal/kernels/gdn.metal -kernel void gdn_step_t(device float* state [[buffer(0)]], device float* hist [[buffer(1)]], +[[max_total_threads_per_threadgroup(1024)]] kernel void gdn_step_t(device float* state [[buffer(0)]], device float* hist [[buffer(1)]], ``` After this change, `gdn_parity` reports ALL PASS (ntok 1–4: y rel L2 ~1.7e-07, history exact, partial commits bitwise), and `gdn_prompt_parity` passes too. It would probably also be worth checking `pipeline.max_threads >= tg` at dispatch time and failing loudly instead of silently. **2. `qsa_prompt.metal` does not compile with the macOS 26.3 MetalPerformancePrimitives headers** The first longer prompt kills the engine (`exit(3)`) with: ``` mtl: compile failed: .../metal_cooperative_tensor:389:62: error: cannot initialize a parameter of type 'void *' with an rvalue of type 'const void *' qsa_prompt.metal:234:16: note: in instantiation of member function 'metal::cooperative_tensor<float, ...>::cooperative_tensor' requested here ``` The cause is the copy `auto tot = acc;` in `qsa_flash`. Getting a second destination tensor instead compiles: ```diff --- metal/kernels/qsa_prompt.metal - auto tot = acc; // the running output; ... + auto tot = opO.template get_destination_cooperative_tensor<__tensor_ops_detail::__remove_addrspace_t<decltype(tPh)>, + __tensor_ops_detail::__remove_addrspace_t<decltype(rv)>, float>(); // the running output; ... ``` (`tot` is zeroed right after, so the copy is only there for its type.) Note: `qsa_prompt_parity` then hangs the GPU on M2 (`kIOGPUCommandBufferCallbackErrorHang`), also with `COOP_K4=0`; I did not dig further. The engine itself (no M5 layout → no flash) runs fine. ### Result with both fixes (via `STRATA_METAL_KERNELS=<patched copy>`) Correct answers, MTP accepting drafts (e.g. 65 of 101). IQ3_S on M2 Max 96 GB, `--spec 2`, temp 0, 3 runs each: | | decode tok/s | prompt tok/s | |---|---:|---:| | short code / RU / story (400 tok) | 31–33 / 27 / 31 | — | | after 5.6K / 22K prompt | 29–30 / 31–32 | 295–309 / 302–309 | The prompt runs on the prompt chain with "the older expert / attention kernels (no M5 layout)". Other parity tests on this Mac all pass: gemv, expert, gr, gr2, qsa, route, sample, fuse, pair, mma, prompt, dense_mm. `moe_mm_parity` reports `no function mm_gu_42_16_64_16_2` (probably a test-only issue). Both diffs are above (full patch is the two hunks shown). **Strata version, GPU, OS:** 0.1.44-metal (main `ed4773e`) · Apple M2 Max 96 GB · macOS 26.3.1
Author
Owner

@Niko1221 commented on GitHub (Oct 14, 2026):

Thank you, this is a superb report: the per-specialization limits (512 / 448 / 448), the marker that stayed 0, the patch, and the proof that it works. We had only the M4 and M5 to test on.

What 0.1.44.1 does:

  1. gdn_step carries [[max_total_threads_per_threadgroup(IB * 128)]] (512 for gdn_step, 1024 for the 8-token variant), so every GDN_NTOK specialization is asked to fit the launch size. We used the exact launch size instead of 1024 for all (a higher limit asks for fewer registers than needed). Your patch with 1024 is the safe fallback: if gdn_parity still prints 448 for some specialization on your M2 Max, tell us.
  2. Every Metal dispatch checks maxTotalThreadsPerThreadgroup >= threads per threadgroup (the engine graph, the prompt chain, the parity tests, the runtime dispatch) and stops the engine with a message naming the kernel, the limit, the size needed and the GPU. STRATA_METAL_MAX_THREADS_CAP=448 forces the condition for a test; on an M4 it stops with, for example, 'the kernel gdn_step{2=8} can run at most 448 threads per threadgroup on this GPU (Apple M4), but the dispatch asks for 512'. gdn_parity prints and checks the limit of GDN_NTOK 1..8.
  3. qsa_prompt.metal: your second-destination-tensor form, applied.

On an M4 the answers are unchanged (Q2_0, byte-identical to 0.1.44 in 4 runs of 200 tokens, with and without MTP), all parity programs pass (moe_mm_parity fails on 0.1.44 and on the fix alike: it asks for a tile the kernel file does not instantiate, a test-only issue as you suspected), and gdn_step speed is unchanged (5 interleaved pairs).

Not done: the qsa_prompt_parity hang on M2. The engine only uses qsa_flash where the M5 matrix layout is detected (or with STRATA_METAL_PROMPT_QSA=flash), so an M2 does not reach it by default; we did not investigate the hang.

Please try 0.1.44.1 on your M2 Max (./update.sh or git pull + setup) and tell us whether the answers are right and MTP accepts drafts without your patched kernel copy.

<!-- gh-comment-id:6157934889 --> @Niko1221 commented on GitHub (Oct 14, 2026): Thank you, this is a superb report: the per-specialization limits (512 / 448 / 448), the marker that stayed 0, the patch, and the proof that it works. We had only the M4 and M5 to test on. What 0.1.44.1 does: 1. `gdn_step` carries `[[max_total_threads_per_threadgroup(IB * 128)]]` (512 for `gdn_step`, 1024 for the 8-token variant), so every `GDN_NTOK` specialization is asked to fit the launch size. We used the exact launch size instead of 1024 for all (a higher limit asks for fewer registers than needed). Your patch with 1024 is the safe fallback: if `gdn_parity` still prints 448 for some specialization on your M2 Max, tell us. 2. Every Metal dispatch checks `maxTotalThreadsPerThreadgroup >= threads per threadgroup` (the engine graph, the prompt chain, the parity tests, the runtime dispatch) and stops the engine with a message naming the kernel, the limit, the size needed and the GPU. `STRATA_METAL_MAX_THREADS_CAP=448` forces the condition for a test; on an M4 it stops with, for example, 'the kernel gdn_step{2=8} can run at most 448 threads per threadgroup on this GPU (Apple M4), but the dispatch asks for 512'. `gdn_parity` prints and checks the limit of GDN_NTOK 1..8. 3. `qsa_prompt.metal`: your second-destination-tensor form, applied. On an M4 the answers are unchanged (Q2_0, byte-identical to 0.1.44 in 4 runs of 200 tokens, with and without MTP), all parity programs pass (`moe_mm_parity` fails on 0.1.44 and on the fix alike: it asks for a tile the kernel file does not instantiate, a test-only issue as you suspected), and `gdn_step` speed is unchanged (5 interleaved pairs). Not done: the `qsa_prompt_parity` hang on M2. The engine only uses `qsa_flash` where the M5 matrix layout is detected (or with `STRATA_METAL_PROMPT_QSA=flash`), so an M2 does not reach it by default; we did not investigate the hang. Please try 0.1.44.1 on your M2 Max (`./update.sh` or `git pull` + setup) and tell us whether the answers are right and MTP accepts drafts without your patched kernel copy.
Author
Owner

@kingdonb commented on GitHub (Oct 14, 2026):

Thanks for the quick 0.1.44.1 hotfix! The shader fix and require_fit threadgroup assertions worked great on our M2.

One follow-up from our testing on a 24 GB M2: while the 96 GB M2 Max has multi-gigabyte arena chunks, on 16–24 GB Macs with --mmap-experts, arena chunks shrink to ~0.8 GB. Prompts still failed with metal prompt: no arena region for the prompt buffers because the existing standalone allocation fallback sat inside the chunk loop.

I have a small follow-up PR that shares the standalone mmap fallback when no chunk fits, which gets 24 GB M2 machines generating at 3.7–4.1 tok/s.

<!-- gh-comment-id:6158069786 --> @kingdonb commented on GitHub (Oct 14, 2026): Thanks for the quick 0.1.44.1 hotfix! The shader fix and `require_fit` threadgroup assertions worked great on our M2. One follow-up from our testing on a 24 GB M2: while the 96 GB M2 Max has multi-gigabyte arena chunks, on 16–24 GB Macs with `--mmap-experts`, arena chunks shrink to ~0.8 GB. Prompts still failed with `metal prompt: no arena region for the prompt buffers` because the existing standalone allocation fallback sat inside the chunk loop. I have a small follow-up PR that shares the standalone `mmap` fallback when no chunk fits, which gets 24 GB M2 machines generating at 3.7–4.1 tok/s.
Author
Owner

@nullspeech commented on GitHub (Oct 14, 2026):

Confirmed on a second M2 Max, and on the older SDK: macOS 15.8 (96 GB M2 Max, so the Command Line Tools' macOS 15
SDK - no MTLGPUFamilyMetal4 symbol and no MetalPerformancePrimitives headers anywhere on this machine). 0.1.44.1
(296b59d2) fixes it here too, so the attribute is not a macOS 26-only trick.

gdn_parity on this machine, same source tree, kernel unchanged except for the attribute:

0.1.44     GDN_NTOK 1: max 512 threads      GDN_NTOK 2..8: max 448
           ntok 2 -> sentinel: 0 of 12288 output floats written, state UNCHANGED
0.1.44.1   GDN_NTOK 1..8: max 512 threads per threadgroup (the kernel needs 512)
           gdn parity ntok 1..8: ... partial commits bitwise: yes  ALL PASS

I took the same route by hand before I saw the release (optnone on gdn_step, which also lifts the limit to 1024), so
here is the cost of that alternative - please do not adopt it, the attribute is strictly better:

GDN_NTOK 0.1.44 optnone'd kernel 0.1.44.1
1 commit 31.1 us/layer 153.1 us/layer 29.3 us/layer
2 commit never dispatched 78.0 36.9
4 commit never dispatched 113.7 53.0

gdn_parity --bench, 36 distinct layer states rotated, so nothing sits in the SLC. The 1-token path gives nothing up,
and the multi-token windows are ~2x faster than the only workaround that worked.

require_fit verified with your test hook - STRATA_METAL_MAX_THREADS_CAP=448 ./gdn_parity prints

gdn_step pipeline GDN_NTOK 2: max 448 threads per threadgroup (the kernel needs 512)  TOO FEW

for every specialization. Silent-but-wrong turning into a message that names the kernel, the limit and the launch size
is worth keeping on its own; the next person with a GPU that reports something odd gets an answer in one line instead
of a week of parity harnesses.

Engine end to end (IQ3_S, --spec 2 --mtp, 65536 context, STRATA_METAL_PROMPT=window), same 64-token prompt read:
0.1.44 with the windows silently frozen gives garbage; with the optnone workaround it reads at 26.0 tok/s and a
2362-token prompt at 47.8; on 0.1.44.1 the same 64-token read is 1081 ms = 59.2 tok/s, a 2321-token prompt reads at
58.1 tok/s (and answers the counting question in it correctly, with 2316 of 2321 reused on the repeat), and a 200-token
answer generates at 35.8 tok/s with 106 of 124 drafts accepted. Not paired runs, but the 2x on the prompt read is the
multi-token windows losing their optnone penalty, which is what the table above predicts.

Two things still stand between an older-SDK Mac and a working install, and neither is #2323:

  1. The build itself. mtl_rt.mm's supportsFamily:MTLGPUFamilyMetal4 does not compile against the macOS 15 SDK,
    because the enum constant only exists in the 26 headers; the Metal runtime on 15.8 is not the problem (15.0 is your
    documented floor). What I carry locally is two lines - enum { STRATA_MTL_GPU_FAMILY_METAL4 = 5002 }; and a cast at
    the one call site, still behind @available(macOS 26.0, *) - and I have to re-apply it after every pull. Say the
    word and I'll send it as a PR.
  2. The prompt GEMM path is unreachable below macOS 26. dense_mm.metal, moe_mm.metal, mm_bench.metal and
    qsa_prompt.metal #include <MetalPerformancePrimitives/MetalPerformancePrimitives.h> unconditionally, and that
    header ships only with the 26 SDK (this machine's SDK is 15.5, the framework is not in
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/), so any route that compiles them
    (prompt_gemm_init / pc_setup, i.e. anything that is not STRATA_METAL_PROMPT=window) takes the engine down with
    mtl: compile failed: ... 'MetalPerformancePrimitives/MetalPerformancePrimitives.h' file not found and exit 3 - seen
    on 0.1.44, and nothing about that include or about compile()'s std::exit(3) changed in 0.1.44.1. Context:: supports_metal4() is in mtl_rt, but no file under metal/src/engine calls it, so the engine cannot notice the
    missing support and step down by itself. The window path is correct and useful here (the 2321-token prompt above is
    answered right), it just isn't the fast one, so a Mac that stays on 15.x has to know the env var exists. Would
    #if __has_include(<MetalPerformancePrimitives/...h>) around those four includes, plus a supports_metal4() probe
    that picks the window route when MPP is absent, be acceptable? Then the fallback is the engine's choice instead of
    project lore.

Thanks for turning this around in a day - the M2 Max is answering correctly now.

<!-- gh-comment-id:6158924728 --> @nullspeech commented on GitHub (Oct 14, 2026): Confirmed on a second M2 Max, and on the *older* SDK: **macOS 15.8** (96 GB M2 Max, so the Command Line Tools' macOS 15 SDK - no `MTLGPUFamilyMetal4` symbol and no `MetalPerformancePrimitives` headers anywhere on this machine). 0.1.44.1 (`296b59d2`) fixes it here too, so the attribute is not a macOS 26-only trick. `gdn_parity` on this machine, same source tree, kernel unchanged except for the attribute: ``` 0.1.44 GDN_NTOK 1: max 512 threads GDN_NTOK 2..8: max 448 ntok 2 -> sentinel: 0 of 12288 output floats written, state UNCHANGED 0.1.44.1 GDN_NTOK 1..8: max 512 threads per threadgroup (the kernel needs 512) gdn parity ntok 1..8: ... partial commits bitwise: yes ALL PASS ``` I took the same route by hand before I saw the release (optnone on `gdn_step`, which also lifts the limit to 1024), so here is the cost of that alternative - please do not adopt it, the attribute is strictly better: | GDN_NTOK | 0.1.44 | optnone'd kernel | 0.1.44.1 | |---------:|-------:|-----------------:|---------:| | 1 commit | 31.1 us/layer | 153.1 us/layer | 29.3 us/layer | | 2 commit | never dispatched | 78.0 | 36.9 | | 4 commit | never dispatched | 113.7 | 53.0 | `gdn_parity --bench`, 36 distinct layer states rotated, so nothing sits in the SLC. The 1-token path gives nothing up, and the multi-token windows are ~2x faster than the only workaround that worked. `require_fit` verified with your test hook - `STRATA_METAL_MAX_THREADS_CAP=448 ./gdn_parity` prints ``` gdn_step pipeline GDN_NTOK 2: max 448 threads per threadgroup (the kernel needs 512) TOO FEW ``` for every specialization. Silent-but-wrong turning into a message that names the kernel, the limit and the launch size is worth keeping on its own; the next person with a GPU that reports something odd gets an answer in one line instead of a week of parity harnesses. Engine end to end (IQ3_S, `--spec 2 --mtp`, 65536 context, `STRATA_METAL_PROMPT=window`), same 64-token prompt read: 0.1.44 with the windows silently frozen gives garbage; with the optnone workaround it reads at 26.0 tok/s and a 2362-token prompt at 47.8; on 0.1.44.1 the same 64-token read is 1081 ms = 59.2 tok/s, a 2321-token prompt reads at 58.1 tok/s (and answers the counting question in it correctly, with 2316 of 2321 reused on the repeat), and a 200-token answer generates at 35.8 tok/s with 106 of 124 drafts accepted. Not paired runs, but the 2x on the prompt read is the multi-token windows losing their optnone penalty, which is what the table above predicts. Two things still stand between an older-SDK Mac and a working install, and neither is #2323: 1. **The build itself.** `mtl_rt.mm`'s `supportsFamily:MTLGPUFamilyMetal4` does not compile against the macOS 15 SDK, because the enum constant only exists in the 26 headers; the Metal *runtime* on 15.8 is not the problem (15.0 is your documented floor). What I carry locally is two lines - `enum { STRATA_MTL_GPU_FAMILY_METAL4 = 5002 };` and a cast at the one call site, still behind `@available(macOS 26.0, *)` - and I have to re-apply it after every pull. Say the word and I'll send it as a PR. 2. **The prompt GEMM path is unreachable below macOS 26.** `dense_mm.metal`, `moe_mm.metal`, `mm_bench.metal` and `qsa_prompt.metal` `#include <MetalPerformancePrimitives/MetalPerformancePrimitives.h>` unconditionally, and that header ships only with the 26 SDK (this machine's SDK is 15.5, the framework is not in `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/`), so any route that compiles them (`prompt_gemm_init` / `pc_setup`, i.e. anything that is not `STRATA_METAL_PROMPT=window`) takes the engine down with `mtl: compile failed: ... 'MetalPerformancePrimitives/MetalPerformancePrimitives.h' file not found` and exit 3 - seen on 0.1.44, and nothing about that include or about `compile()`'s `std::exit(3)` changed in 0.1.44.1. `Context:: supports_metal4()` is in `mtl_rt`, but no file under `metal/src/engine` calls it, so the engine cannot notice the missing support and step down by itself. The window path is correct and useful here (the 2321-token prompt above is answered right), it just isn't the fast one, so a Mac that stays on 15.x has to know the env var exists. Would `#if __has_include(<MetalPerformancePrimitives/...h>)` around those four includes, plus a `supports_metal4()` probe that picks the window route when MPP is absent, be acceptable? Then the fallback is the engine's choice instead of project lore. Thanks for turning this around in a day - the M2 Max is answering correctly now.
Author
Owner

@Depechie commented on GitHub (Oct 14, 2026):

I'm running strata 0.1.44.1 on a M2 with 32 GB mem and also running into "metal prompt: no arena region for the prompt buffers".
Correct to assume we still need to wait for a next release to get it working?

<!-- gh-comment-id:6176331203 --> @Depechie commented on GitHub (Oct 14, 2026): I'm running strata 0.1.44.1 on a M2 with 32 GB mem and also running into "metal prompt: no arena region for the prompt buffers". Correct to assume we still need to wait for a next release to get it working?
Author
Owner

@qiuzan2001 commented on GitHub (Oct 15, 2026):

For the follow-up question ("metal prompt: no arena region for the prompt buffers" on 24-32 GB Macs): that case is not in 0.1.44.1 (296b59d2). The fix is open PR #2345, which adds the fallback for arena chunks too small for the prompt's buffers (measured there on a 24 GB M2), so it needs that PR merged or applied locally. The original gdn_step bug of this issue is fixed in 0.1.44.1 by 5ce99945, as confirmed above on two M2 Max machines.

<!-- gh-comment-id:6184285668 --> @qiuzan2001 commented on GitHub (Oct 15, 2026): For the follow-up question ("metal prompt: no arena region for the prompt buffers" on 24-32 GB Macs): that case is not in 0.1.44.1 (296b59d2). The fix is open PR #2345, which adds the fallback for arena chunks too small for the prompt's buffers (measured there on a 24 GB M2), so it needs that PR merged or applied locally. The original `gdn_step` bug of this issue is fixed in 0.1.44.1 by 5ce99945, as confirmed above on two M2 Max machines.
Author
Owner

@nullspeech commented on GitHub (Oct 15, 2026):

M2 Max / 96 GB / macOS 15.8 — numbers from the machine that cannot reach the prompt chain, for the record.

Setup. Strata 0.1.44.1-metal, Qwen3.8-Flash-Next IQ3_S (78 GB gguf, experts streamed), --expert-cache 64 --prefill auto --spec 2 --mtp --max-context 65536 --mmap-experts. On 15.8 MetalPerformancePrimitives is absent from both the SDK and /System/Library/Frameworks, so prompt_gemm_init dies at runtime with mtl: compile failed: ... file not found and this box runs STRATA_METAL_PROMPT=window + COOP_K4=0.

1. Same M2 Max, same model, llama.cpp's Metal backend — no MPP anywhere in it.
Pack: Qwen3.8-Flash-Next-AD-4.27bpw-Q4_K_M-M64 (91 GB, 33 shards), i.e. heavier than the pack Strata streams here. From 6 weeks of server logs, using prompt eval time (tokens processed after cache, so directly comparable to the HUD's (prompt_tokens - reused) / prompt_ms):

prompts n median p90 max
≥ 1000 tokens 761 190 tok/s 251 349
≥ 4000 tokens 214 211 — 289
≥ 8000 tokens 134 215 — 273

Single sessions: 286.78 tok/s on a 20926-token prompt and 265.28 on 30619 (gguf-mtp-20261006-182929.log, n_threads = 8). Decode in the same logs: median 24.9 tok/s over 3324 samples of ≥20 tokens, p90 34.4.

2. What the window path gets on this machine: 52.0–59.6 tok/s on a cold 1355-token prompt (temp 0, same convention). Strata's decode here (34.6–35.5 tok/s) is already above llama.cpp's p90, so the machine is not short of bandwidth or of CPU — only the prompt read is 3–4× behind, and it is behind on a path that has no GEMM in it at all.

3. STRATA_PREFILL_CPU_SHARE measured here, and it is free. Paired A/B, reverse order in round 2 (this Mac drifts ~±8% warm), engine restarted between arms, 1355-token cold prompt:

round A: default (share only below 1024) B: =auto + _MAX=8192 delta
1 54.1, 55.5 59.5, 59.3 +8.4%
2 52.9, 52.0 57.6, 55.4 +7.7%

Decode unchanged (34.7/35.1 vs 34.1/33.7) — the CPU work does not steal from the token path. On a window-path Mac the CPU is otherwise idle during a prompt, so the 1024 gate looks like the wrong default there.

4. PR #2609, measured on this machine (only the test target built; nothing deployed): gemv_parity 130 PASS / 0 FAIL — every gemv_wide.metal kernel bitwise its stock twin, windows bitwise equal to one-token calls, and both --sweep runs print ALL BITWISE. Best tile vs today's, this M2 Max:

ntok qkv gate out lm head
1 1.10–1.56× 1.11–1.61× 1.11–1.60× 1.38×
2 1.46–1.55× 1.30–1.59× 1.41× (IQ3_S) 1.57×
3 — — — 1.20×

So the tiles are a genuine M1/M2 win, but they accelerate the window path's projections — which is what the 52–59 tok/s is made of, not the wall itself.

The ask, restated: a prompt chain whose matmul is not MPP (simdgroup_matrix is already used by mma.metal and compiles fine on 15.x). The same silicon, with llama.cpp's simdgroup_matrix backend on a heavier pack, reads 190–290 tok/s — so what is missing on 15.x Macs is a kernel path, not performance headroom.

<!-- gh-comment-id:6193169884 --> @nullspeech commented on GitHub (Oct 15, 2026): M2 Max / 96 GB / macOS 15.8 — numbers from the machine that cannot reach the prompt chain, for the record. **Setup.** Strata 0.1.44.1-metal, Qwen3.8-Flash-Next IQ3_S (78 GB gguf, experts streamed), `--expert-cache 64 --prefill auto --spec 2 --mtp --max-context 65536 --mmap-experts`. On 15.8 `MetalPerformancePrimitives` is absent from both the SDK and `/System/Library/Frameworks`, so `prompt_gemm_init` dies at runtime with `mtl: compile failed: ... file not found` and this box runs `STRATA_METAL_PROMPT=window` + `COOP_K4=0`. **1. Same M2 Max, same model, llama.cpp's Metal backend — no MPP anywhere in it.** Pack: `Qwen3.8-Flash-Next-AD-4.27bpw-Q4_K_M-M64` (91 GB, 33 shards), i.e. *heavier* than the pack Strata streams here. From 6 weeks of server logs, using `prompt eval time` (tokens processed after cache, so directly comparable to the HUD's `(prompt_tokens - reused) / prompt_ms`): | prompts | n | median | p90 | max | |---|---|---|---|---| | ≥ 1000 tokens | 761 | 190 tok/s | 251 | 349 | | ≥ 4000 tokens | 214 | 211 | — | 289 | | ≥ 8000 tokens | 134 | 215 | — | 273 | Single sessions: 286.78 tok/s on a 20926-token prompt and 265.28 on 30619 (`gguf-mtp-20261006-182929.log`, `n_threads = 8`). Decode in the same logs: median 24.9 tok/s over 3324 samples of ≥20 tokens, p90 34.4. **2. What the window path gets on this machine:** 52.0–59.6 tok/s on a cold 1355-token prompt (temp 0, same convention). Strata's decode here (34.6–35.5 tok/s) is already **above** llama.cpp's p90, so the machine is not short of bandwidth or of CPU — only the prompt read is 3–4× behind, and it is behind on a path that has no GEMM in it at all. **3. `STRATA_PREFILL_CPU_SHARE` measured here, and it is free.** Paired A/B, reverse order in round 2 (this Mac drifts ~±8% warm), engine restarted between arms, 1355-token cold prompt: | round | A: default (share only below 1024) | B: `=auto` + `_MAX=8192` | delta | |---|---|---|---| | 1 | 54.1, 55.5 | 59.5, 59.3 | +8.4% | | 2 | 52.9, 52.0 | 57.6, 55.4 | +7.7% | Decode unchanged (34.7/35.1 vs 34.1/33.7) — the CPU work does not steal from the token path. On a window-path Mac the CPU is otherwise idle during a prompt, so the 1024 gate looks like the wrong default there. **4. PR #2609, measured on this machine** (only the test target built; nothing deployed): `gemv_parity` 130 PASS / 0 FAIL — every `gemv_wide.metal` kernel bitwise its stock twin, windows bitwise equal to one-token calls, and both `--sweep` runs print `ALL BITWISE`. Best tile vs today's, this M2 Max: | ntok | qkv | gate | out | lm head | |---|---|---|---|---| | 1 | 1.10–1.56× | 1.11–1.61× | 1.11–1.60× | 1.38× | | 2 | 1.46–1.55× | 1.30–1.59× | 1.41× (IQ3_S) | 1.57× | | 3 | — | — | — | 1.20× | So the tiles are a genuine M1/M2 win, but they accelerate the window path's projections — which is what the 52–59 tok/s is made of, not the wall itself. **The ask, restated:** a prompt chain whose matmul is not MPP (simdgroup_matrix is already used by `mma.metal` and compiles fine on 15.x). The same silicon, with llama.cpp's simdgroup_matrix backend on a heavier pack, reads 190–290 tok/s — so what is missing on 15.x Macs is a kernel path, not performance headroom.
Author
Owner

@nullspeech commented on GitHub (Oct 17, 2026):

Housekeeping from the macOS 15.8 confirmation above (96 GB M2 Max, second data point, 2026-10-14): this looks fixed, and the issue is still open.

  • 5ce99945 ("Metal: gdn_step fits its launch size, every dispatch checks maxTotalThreadsPerThreadgroup, qsa_prompt compiles on macOS 26.3 (#2323)", 2026-10-13) shipped in v0.1.44.1; 831ba47a carries the runtime half of the same two kernels for M1 Max into v0.1.45.
  • Just re-ran gdn_parity on our 0.1.44.1-metal build (M2 Max, macOS 15.8): every gdn_step pipeline gets the 512 threads the kernel needs for GDN_NTOK 1..8, and ntok 1-4 all PASS (worst rel L2 1.76e-07 on y, 1.30e-07 on state, history exactly 0, partial commits bitwise equal) — ALL PASS.
  • End-to-end, same engine, serving Flash-Next IQ3_S at 65,536 context: a fresh 3,991-token prompt, greedy, returned all four topic markers embedded in that prompt correctly, with the reasoning text also tracking the input. No silent drop of a prompt window in sight.

So if the thread was kept open only for the dispatch-limit work, it reads as done. I cannot speak for the --mmap-experts half kingdonb added in f037612b — that targets 16-24 GB Macs and is not reachable from 96 GB. Leaving the close call to @Niko1221 and @Excavatory.

<!-- gh-comment-id:6236833564 --> @nullspeech commented on GitHub (Oct 17, 2026): Housekeeping from the macOS 15.8 confirmation above (96 GB M2 Max, second data point, 2026-10-14): this looks fixed, and the issue is still open. - `5ce99945` ("Metal: gdn_step fits its launch size, every dispatch checks maxTotalThreadsPerThreadgroup, qsa_prompt compiles on macOS 26.3 (#2323)", 2026-10-13) shipped in **v0.1.44.1**; `831ba47a` carries the runtime half of the same two kernels for M1 Max into v0.1.45. - Just re-ran `gdn_parity` on our 0.1.44.1-metal build (M2 Max, macOS 15.8): every `gdn_step` pipeline gets the 512 threads the kernel needs for `GDN_NTOK 1..8`, and ntok 1-4 all PASS (worst rel L2 1.76e-07 on `y`, 1.30e-07 on state, history exactly 0, partial commits bitwise equal) — `ALL PASS`. - End-to-end, same engine, serving Flash-Next IQ3_S at 65,536 context: a fresh 3,991-token prompt, greedy, returned all four topic markers embedded in that prompt correctly, with the reasoning text also tracking the input. No silent drop of a prompt window in sight. So if the thread was kept open only for the dispatch-limit work, it reads as done. I cannot speak for the `--mmap-experts` half kingdonb added in `f037612b` — that targets 16-24 GB Macs and is not reachable from 96 GB. Leaving the close call to @Niko1221 and @Excavatory.
Author
Owner

@nullspeech commented on GitHub (Oct 17, 2026):

Following up on the macOS 15.8 reports above (96 GB M2 Max, same box) — we found why the chain cannot start here, built a fix, measured it, and opened a PR: #2987 (draft, based on 296b59d2 / v0.1.44.1, 11 files under metal/, +399/−28).

Cause, for the record. It is not the GPU and not the instruction set. Every matmul2d kernel is reached through an unguarded #include <MetalPerformancePrimitives/MetalPerformancePrimitives.h>, and that header only ships with a Metal 4 SDK. On macOS 15.8 Context::compile() therefore fails for dense_mm.metal / moe_mm.metal / prompt.metal / qsa_prompt.metal, the failure is fatal at init (exit 3), and the config has to carry STRATA_METAL_PROMPT=window. simdgroup_matrix<half,8,8> + simdgroup_multiply_accumulate is Apple7+ and has always worked on this chip: with the guards applied, the repo's own probe measures 7.22 TFLOP/s at 4096³ and 6.89 at the dense prompt shape (rel L2 2.75e-07 vs the fp32 reference), printing device Apple M2 Max, metal4 0.

Result (one binary, STRATA_METAL_LEGACY=1 vs the window path, 1023-token prompts, five alternating runs each): prefill 58 → 177 tok/s median (3.02×), TTFT 20.6–26.4 s → 8.8–14.4 s, decode unchanged to slightly better (26.8/26.4 → 29.0/27.3). Server-level, a 4252-token prompt: 55.3 → 159.4 tok/s. Prompts under _PROMPT_GEMM_MIN = 64 are unchanged because they never reach the chain. dense_mm_parity 67 PASS / 0 FAIL, prompt_parity and gdn_parity all PASS, moe_mm_parity --v2 PASS for every format this pack routes — and the legacy tiles report identical error numbers to the upstream tiles, so the tile changes are speed-only.

One honest caveat, because it is the next question. We also ran llama-server (b11408, -ngl 999, -c 65536, MTP draft) against the identical GGUF file on this machine to see where the ceiling actually is: it prefills 285.6 tok/s at 4220 prompt tokens, 267.6 at 1609, where this branch reaches 160–172. So the branch recovers ~3× of this engine's own 4.9× deficit on the old SDK, it does not overtake llama.cpp — and the deficit is spread across the chain rather than one kernel (llama.cpp's whole 1024-token chunk costs ~3.6 s at that rate; gate/up alone is 2.93 s here, plus 1.21 s of gdn projections). Anyone landing #2987 should read it as "make the chain reachable on pre-Metal-4 SDKs", not "close the gap to other engines". Decode is a wash: llama.cpp's 1596 completed production requests on this box median 30.1 tok/s, ours 24–31 depending on whether the sample is a 64-token tail or a full generation.

The PR is a draft because the branch sits on v0.1.44.1 and main has 13 later commits under metal/ (the maxBufferLength wrap bounds the MoE kernels where the twins live), plus main does not build on a Mac today at all (#2860; #2895 looks like the fix). Say the word and I will rebase onto main and re-run the gates. The msl_has_mpp() oracle — asking the compiler for the header instead of trusting the GPU family, which answers "Metal 4" on an M2 under a macOS 26 beta — is the part worth merging even if the tiles stay a follow-up, and I can split it that way.

<!-- gh-comment-id:6243377261 --> @nullspeech commented on GitHub (Oct 17, 2026): Following up on the macOS 15.8 reports above (96 GB M2 Max, same box) — we found why the chain cannot start here, built a fix, measured it, and opened a PR: **#2987** (draft, based on `296b59d2` / v0.1.44.1, 11 files under `metal/`, +399/−28). **Cause, for the record.** It is not the GPU and not the instruction set. Every `matmul2d` kernel is reached through an unguarded `#include <MetalPerformancePrimitives/MetalPerformancePrimitives.h>`, and that header only ships with a Metal 4 SDK. On macOS 15.8 `Context::compile()` therefore fails for `dense_mm.metal` / `moe_mm.metal` / `prompt.metal` / `qsa_prompt.metal`, the failure is fatal at init (`exit 3`), and the config has to carry `STRATA_METAL_PROMPT=window`. `simdgroup_matrix<half,8,8>` + `simdgroup_multiply_accumulate` is Apple7+ and has always worked on this chip: with the guards applied, the repo's own probe measures 7.22 TFLOP/s at 4096³ and 6.89 at the dense prompt shape (rel L2 2.75e-07 vs the fp32 reference), printing `device Apple M2 Max, metal4 0`. **Result** (one binary, `STRATA_METAL_LEGACY=1` vs the window path, 1023-token prompts, five alternating runs each): prefill 58 → **177 tok/s median (3.02×)**, TTFT 20.6–26.4 s → **8.8–14.4 s**, decode unchanged to slightly better (26.8/26.4 → 29.0/27.3). Server-level, a 4252-token prompt: 55.3 → 159.4 tok/s. Prompts under `_PROMPT_GEMM_MIN` = 64 are unchanged because they never reach the chain. `dense_mm_parity` 67 PASS / 0 FAIL, `prompt_parity` and `gdn_parity` all PASS, `moe_mm_parity --v2` PASS for every format this pack routes — and the legacy tiles report *identical* error numbers to the upstream tiles, so the tile changes are speed-only. **One honest caveat, because it is the next question.** We also ran `llama-server` (b11408, `-ngl 999`, `-c 65536`, MTP draft) against the **identical GGUF file** on this machine to see where the ceiling actually is: it prefills 285.6 tok/s at 4220 prompt tokens, 267.6 at 1609, where this branch reaches 160–172. So the branch recovers ~3× of this engine's own 4.9× deficit on the old SDK, it does not overtake llama.cpp — and the deficit is spread across the chain rather than one kernel (llama.cpp's whole 1024-token chunk costs ~3.6 s at that rate; gate/up alone is 2.93 s here, plus 1.21 s of gdn projections). Anyone landing #2987 should read it as "make the chain reachable on pre-Metal-4 SDKs", not "close the gap to other engines". Decode is a wash: llama.cpp's 1596 completed production requests on this box median 30.1 tok/s, ours 24–31 depending on whether the sample is a 64-token tail or a full generation. The PR is a draft because the branch sits on v0.1.44.1 and `main` has 13 later commits under `metal/` (the `maxBufferLength` wrap bounds the MoE kernels where the twins live), plus `main` does not build on a Mac today at all (#2860; #2895 looks like the fix). Say the word and I will rebase onto `main` and re-run the gates. The `msl_has_mpp()` oracle — asking the compiler for the header instead of trusting the GPU family, which answers "Metal 4" on an M2 under a macOS 26 beta — is the part worth merging even if the tiles stay a follow-up, and I can split it that way.
Author
Owner

@nullspeech commented on GitHub (Oct 18, 2026):

Follow-up on the legacy (simdgroup_matrix) branch from #2987 — this one is mostly a negative result, written up so nobody spends a weekend re-deriving it. 96 GB M2 Max, macOS 15.8, IQ3_S Qwen pack, engine at v0.1.44.1.

1. STRATA_METAL_GEMV_NR=2 pays only at exactly two rows, and regresses at three. I measured the rule at window.cpp:578 with token_chain (GPU-only median, 30 reps, mirrored NR1→NR2→NR2→NR1 so a warming machine cannot fake a result). ntok = 1 is a provably no-op control arm, because the gate requires ntok > 1 — it reads 0.8%, which is the instrument floor:

window rows NR=1 NR=2 delta
1 (control, rule cannot fire) 27.31 / 28.11 ms 27.86 / 27.97 ms +0.8% — floor
2 43.71 / 44.54 / 44.39 / 44.15 39.17 / 39.12 / 38.66 / 39.01 −11.8% (faster)
3 56.05 / 54.48 57.39 / 57.27 +3.7% (slower)
4 69.31 / 69.21 69.64 / 70.29 +1.0% (slower)

The mechanism matches: Rr = 2 shares one x load across two rows' weight loads, which is exactly amortised at two rows; at three rows the second Rr group re-loads weights for a third row while x is already SLC-resident, so you pay thread-group pressure and save nothing. Suggested one-liner: gate on ntok == 2 instead of ntok > 1. Under MTP --spec 2 a full draft is a 3-row window, i.e. the arm where NR=2 is slower — which is why the server sees no benefit (below) even though the tile really is 11.8% better at 2 rows.

2. Neither STRATA_METAL_PROMPT_CHUNK=8192 nor GEMV_NR=2 moves the live server, and an apparent +20% win was session drift. Same driver, same seed, prompts of 4220/2652/1609 tokens, two reps, six boots:

chunk NR prefill decode
2048 1 153.3–171.5 24.1–27.3
8192 2 184.2–200.5 32.7–34.5
8192 1 158.7–170.5 24.8–27.2
8192 2 (repeat of the row above) 157.7–168.5 26.6–30.0
2048 1 (final, production) 158.1–169.5 24.6–25.8

The 8192/2 row that looked like a 20% win did not repeat with the same config, and the 8192/1 boot prints for chunks of 4213 rows — so a 4220-token prompt is one chunk there and it prefills no faster than three chunks of 2048. drafts accepted 25 of 38 is identical in every boot, so it isn't draft luck; it's thermal. Lesson for anyone benchmarking on a laptop: a whole session can sit 15–20% off another session of the same binary and same config, and a single before/after pair across a restart is worthless. The honest production number for this branch is 158–172 prefill / 24–27 decode at 4220 tokens.

3. The legacy expert GEMM's tile space is exhausted — the remaining gap to llama.cpp is not a tile choice. Swept in one process (each 4096-token arm is 21–27 s, so in-process pairing is the only way to read it), mm_gu2_* / mm_down2_* over TM × TN × TK × SG, restricted to tiles every format in the pack instantiates:

variant prefill tok/s verdict
shipped: TM16, gu 16_32_32_2, dn 16_64_32_2 176.2–200.4 baseline
TM=32 (halves the tile count per expert) 155.7–167.4 8% slower
gu TK 32→64 185.6–189.8 ~−5%, inside spread
gu SG 2→4 193.7–207.2 ≈ baseline
gu SG=1 149.1–152.1 −20%, clearly worse
dn TN=128 / SG=4 191.6–203.4 ≈ baseline

The load-bearing row is TM=32: it takes the per-expert tile count from 5 to 3 at ~82 tokens/expert, i.e. it removes most of the redundant dequant, and it is slower. So "the twins are dequant-bound and a taller M tile fixes it" is wrong on this chip, and gu2_tile()'s !mpp → "_16_32_32_2" / dn2_tile() → "_16_64_32_2" are already the best legal choice. That, plus point 2, means the 1.7× we still carry against llama.cpp on the identical file lives in the kernels, not in any tile or env knob.

One trap worth recording for whoever sweeps next: this pack is format-mixed per layer — gate/up is {IQ3_XXS, IQ3_S, IQ2_S, IQ4_XS} and down is {IQ4_NL, Q2_0} across the 48 layers, while a chunk carries one tile value in meta[2]/[5]. Requesting a tile that any present format lacks aborts at init (no function mm_gu2_23_32_32_32_2, exit 3), so the sweep space is the intersection, not the product.

4. Small bug: STRATA_METAL_PROFILE is unobservable in normal operation. The per-window-size table is printed only from Window::~Window() (window.cpp:1302). Every engine I stopped with SIGTERM exited without ever printing it, so the flag silently does nothing for a long-running server — it needs an atexit/signal path. (It also means I could not confirm the live T mix from the log, which is why point 1 phrases the spec-2 window as inference rather than measurement.)

Not claiming anything new about prefill here — #2987's +3.0× stands and the llama.cpp comparison in my last comment is unchanged. The harness seams for points 1–3 (sweepable prompt_chain, GEMV_NR in token_chain) are ~95 lines of test-only code; say the word and I'll put them in a branch so these axes can be re-run instead of re-guessed.

<!-- gh-comment-id:6253608287 --> @nullspeech commented on GitHub (Oct 18, 2026): Follow-up on the legacy (`simdgroup_matrix`) branch from #2987 — this one is mostly a **negative result**, written up so nobody spends a weekend re-deriving it. 96 GB M2 Max, macOS 15.8, IQ3_S Qwen pack, engine at v0.1.44.1. **1. `STRATA_METAL_GEMV_NR=2` pays only at exactly two rows, and regresses at three.** I measured the rule at `window.cpp:578` with `token_chain` (GPU-only median, 30 reps, mirrored NR1→NR2→NR2→NR1 so a warming machine cannot fake a result). `ntok = 1` is a provably no-op control arm, because the gate requires `ntok > 1` — it reads 0.8%, which is the instrument floor: | window rows | NR=1 | NR=2 | delta | |---|---|---|---| | 1 (control, rule cannot fire) | 27.31 / 28.11 ms | 27.86 / 27.97 ms | +0.8% — floor | | 2 | 43.71 / 44.54 / 44.39 / 44.15 | 39.17 / 39.12 / 38.66 / 39.01 | **−11.8% (faster)** | | 3 | 56.05 / 54.48 | 57.39 / 57.27 | **+3.7% (slower)** | | 4 | 69.31 / 69.21 | 69.64 / 70.29 | +1.0% (slower) | The mechanism matches: `Rr = 2` shares one x load across two rows' weight loads, which is exactly amortised at two rows; at three rows the second `Rr` group re-loads weights for a third row while x is already SLC-resident, so you pay thread-group pressure and save nothing. Suggested one-liner: gate on `ntok == 2` instead of `ntok > 1`. Under MTP `--spec 2` a full draft is a 3-row window, i.e. the arm where NR=2 is slower — which is why the server sees no benefit (below) even though the tile really is 11.8% better at 2 rows. **2. Neither `STRATA_METAL_PROMPT_CHUNK=8192` nor `GEMV_NR=2` moves the live server, and an apparent +20% win was session drift.** Same driver, same seed, prompts of 4220/2652/1609 tokens, two reps, six boots: | chunk | NR | prefill | decode | |---|---|---|---| | 2048 | 1 | 153.3–171.5 | 24.1–27.3 | | 8192 | 2 | 184.2–200.5 | 32.7–34.5 | | 8192 | 1 | 158.7–170.5 | 24.8–27.2 | | 8192 | 2 (repeat of the row above) | 157.7–168.5 | 26.6–30.0 | | 2048 | 1 (final, production) | 158.1–169.5 | 24.6–25.8 | The 8192/2 row that looked like a 20% win did not repeat with the same config, and the 8192/1 boot prints `for chunks of 4213 rows` — so a 4220-token prompt is one chunk there and it prefills no faster than three chunks of 2048. `drafts accepted 25 of 38` is identical in every boot, so it isn't draft luck; it's thermal. Lesson for anyone benchmarking on a laptop: a whole session can sit 15–20% off another session of the same binary and same config, and a single before/after pair across a restart is worthless. The honest production number for this branch is 158–172 prefill / 24–27 decode at 4220 tokens. **3. The legacy expert GEMM's tile space is exhausted — the remaining gap to llama.cpp is not a tile choice.** Swept in one process (each 4096-token arm is 21–27 s, so in-process pairing is the only way to read it), `mm_gu2_* / mm_down2_*` over TM × TN × TK × SG, restricted to tiles every format in the pack instantiates: | variant | prefill tok/s | verdict | |---|---|---| | shipped: TM16, gu `16_32_32_2`, dn `16_64_32_2` | 176.2–200.4 | baseline | | TM=32 (halves the tile count per expert) | 155.7–167.4 | **8% slower** | | gu TK 32→64 | 185.6–189.8 | ~−5%, inside spread | | gu SG 2→4 | 193.7–207.2 | ≈ baseline | | gu SG=1 | 149.1–152.1 | −20%, clearly worse | | dn TN=128 / SG=4 | 191.6–203.4 | ≈ baseline | The load-bearing row is TM=32: it takes the per-expert tile count from 5 to 3 at ~82 tokens/expert, i.e. it removes most of the redundant dequant, and it is *slower*. So "the twins are dequant-bound and a taller M tile fixes it" is wrong on this chip, and `gu2_tile()`'s `!mpp → "_16_32_32_2"` / `dn2_tile() → "_16_64_32_2"` are already the best legal choice. That, plus point 2, means the 1.7× we still carry against llama.cpp on the identical file lives in the kernels, not in any tile or env knob. One trap worth recording for whoever sweeps next: this pack is **format-mixed per layer** — gate/up is {IQ3_XXS, IQ3_S, IQ2_S, IQ4_XS} and down is {IQ4_NL, Q2_0} across the 48 layers, while a chunk carries one tile value in `meta[2]/[5]`. Requesting a tile that any present format lacks aborts at init (`no function mm_gu2_23_32_32_32_2`, `exit 3`), so the sweep space is the intersection, not the product. **4. Small bug: `STRATA_METAL_PROFILE` is unobservable in normal operation.** The per-window-size table is printed only from `Window::~Window()` (`window.cpp:1302`). Every engine I stopped with SIGTERM exited without ever printing it, so the flag silently does nothing for a long-running server — it needs an `atexit`/signal path. (It also means I could not confirm the live `T` mix from the log, which is why point 1 phrases the spec-2 window as inference rather than measurement.) Not claiming anything new about prefill here — #2987's +3.0× stands and the llama.cpp comparison in my last comment is unchanged. The harness seams for points 1–3 (sweepable `prompt_chain`, `GEMV_NR` in `token_chain`) are ~95 lines of test-only code; say the word and I'll put them in a branch so these axes can be re-run instead of re-guessed.
Author
Owner

@Niko1221 commented on GitHub (Oct 29, 2026):

Thank you again for this report. Fixed in 0.1.44.1: gdn_step is asked to fit its launch size, every Metal dispatch checks the pipeline limit, and qsa_prompt compiles on macOS 26.3. The no arena region for the prompt buffers case on 16 to 32 GB Macs was fixed in 0.1.45 (the prompt's buffers get their own allocation when no arena chunk fits). Confirmed on two M2 Max machines in this thread.

Release: https://github.com/Niko1221/Strata/releases/tag/v0.1.44.1

<!-- gh-comment-id:6491942166 --> @Niko1221 commented on GitHub (Oct 29, 2026): Thank you again for this report. Fixed in 0.1.44.1: `gdn_step` is asked to fit its launch size, every Metal dispatch checks the pipeline limit, and `qsa_prompt` compiles on macOS 26.3. The `no arena region for the prompt buffers` case on 16 to 32 GB Macs was fixed in 0.1.45 (the prompt's buffers get their own allocation when no arena chunk fits). Confirmed on two M2 Max machines in this thread. Release: https://github.com/Niko1221/Strata/releases/tag/v0.1.44.1
Author
Owner
<!-- gh-comment-id:6492820452 --> @botbizs commented on GitHub (Oct 29, 2026): bro. Thank you for that чт, 29 окт. 2026 г., 11:36 Niko ***@***.***>: > Closed #2323 <https://github.com/Niko1221/Strata/issues/2323> as > completed. > > — > Reply to this email directly, view it on GitHub > <https://github.com/Niko1221/Strata/issues/2323?email_source=notifications&email_token=A7ROORFN4LYBQVEDXABIRX35WL6SJA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTGNBVGYZTONJWG4ZDRJTSMVQXG33OU5WWK3TUNFXW5JLFOZSW45FMMZXW65DFOJPWG3DJMNVQ#event-34563756728>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/A7ROORCWD5ABHB4ILRID5GD5WL6SJAVCNFSNUABGKJSXA33TNF2G64TZHMYTGOBVHE2DMMZQGE5US43TOVSTWNJYGM3TOMJWHEZTTILWAI> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
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#938
No description provided.