[GH-ISSUE #4771] [Engine] Mac (M5 Max): DeepSeek V4.1 decode stalls on the GPU busy spin; DS4_BUSY_CAP=2000 gives 18 tok/s instead of 6.7 #2185

Open
opened 2026-11-04 01:57:20 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @sblocktechnologies on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4771

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

Terminal (the strata command)

What happened

DeepSeek-V4.1-Flash IST-DAS 2.00 bpw on an M5 Max with 128 GB decodes at 5 to 6.7 tok/s with the shipped defaults, against the 15 to 18 tok/s that docs/DEEPSEEK_MAC.md reports for the same Mac. Setting DS4_BUSY_CAP=2000 brings it to 14 to 19 tok/s with the same answers.

With DS4_CPU_LOG=1, the CPU lane takes 9.7 ms a call (3.3 ms an expert), but cpu_experts_iq's own phases (prefetch, quant, gate_up, down) add up to about a fifth of that. The rest of the timed span is around ds4_busy_begin() / ds4_busy_end(). ds4_busy_begin() waits on the previous spin's command buffer ([g_busy.last waitUntilCompleted]), so it looks as if the spin kernel runs to its cap here instead of leaving when the host sets the flag. That last part is my reading of metal/src/mtl_rt.mm, not something I measured directly.

Engine CLI, same pack and prompt ids, 96 tokens, shipped profile-2.00.bin with --profile-readonly:

Setting Decode tok/s CPU lane per call Routing waits per token
default (cap 20000) 6.66 9.7 ms 29.9 ms
DS4_BUSY=0 7.62 2.9 ms 58.5 ms
DS4_BUSY_CAP=2000 18.05 2.2 ms 33.8 ms
DS4_BUSY_CAP=500 15.36 2.2 ms 43.5 ms
DS4_BUSY_CAP=100 13.80 2.0 ms 48.4 ms
DS4_SKIP_CPU=1 (timing only) 17.90 0 47.2 ms

Through the server (/v1/chat/completions, greedy, thinking off) with DS4_BUSY_CAP=2000 and the engine's own expert share (67.9 GB): 14.3 to 19.0 tok/s on short and code answers, a 3,000-token prompt read at 268 tok/s. Without it, the same requests ran at 5.0 to 6.5 tok/s.

Things that did not change the speed: stopping the other VMs on the Mac, 69 GB free at start, the shipped expert profile read-only, engine 0.1.53 (Strata 0.2.7, 4.89 tok/s) against 0.1.54 (4.91 tok/s), and --cpu-threads 9, 12 or 16.

Expected: the shipped default to reach the documented speed on this Mac, or a documented setting for it. I have not tried other Macs, so I can't say whether this is specific to the M5 Max or to this macOS version.

Smallest steps or command that reproduce it

cd ~/.local/share/strata/install/engine-dsv41/0.1.54-macos-arm64-metal
P=~/.local/share/strata/Strata-data/packs/deepseek-v4.1-flash-ist-das-2.00bpw
IDS=0,5,100,2000,3000,4000,500,600,700,800,900,1000
DS4_CPU_LOG=1 ./strata-dsv41 --pack $P --max-context 4096 --dspark none --vision off --ids $IDS --n 96
DS4_CPU_LOG=1 DS4_BUSY_CAP=2000 ./strata-dsv41 --pack $P --max-context 4096 --dspark none --vision off --ids $IDS --n 96

Compare the decode: and cpu lane calls: lines.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.8 · engine 0.1.54 (strata-dsv41 build 36f6663c25, 0.1.54-metal); also engine 0.1.53 (build 55a557bb6d)

Graphics card, memory and system

Apple M5 Max (40-core GPU) · 128 GB unified memory · macOS 26.7.2 · internal SSD

Model, size and settings

DeepSeek-V4.1-Flash IST-DAS 2.00 bpw (installed by strata launch --family deepseek41 --model ist-das-2.00bpw), 8K context, vision off, DSpark off (Mac default), Full quality (6 experts)

Logs

Default:

decode: 96 tokens in 14269 ms (6.66 tok/s); CPU lane: 2720 of 22800 experts; the cache moved 432 (432 in all)
decode per token: layers 148.13 ms (of it: routing waits 29.87, CPU lane 111.83, the rest host launches), head wait 1.78, Engram reads 0.01
cpu lane calls: 1262, experts 3671, 12277.9 ms (9.729 ms a call, 3.345 ms an expert)
cpu_experts_iq phases (ms over 1265 calls): prefetch 1954.4, quant1 9.6, gate_up 692.6, quant2 11.0, down 364.6

DS4_BUSY_CAP=2000:

decode: 96 tokens in 5265 ms (18.05 tok/s); CPU lane: 2450 of 22800 experts; the cache moved 397 (397 in all)
decode per token: layers 53.29 ms (of it: routing waits 33.77, CPU lane 12.77, the rest host launches), head wait 1.81, Engram reads 0.01
cpu lane calls: 1187, experts 3345, 2653.4 ms (2.235 ms a call, 0.793 ms an expert)

Investigated with an AI coding assistant; every number above is from a real run on this machine.

Originally created by @sblocktechnologies on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4771 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Terminal (the `strata` command) ### What happened DeepSeek-V4.1-Flash IST-DAS 2.00 bpw on an M5 Max with 128 GB decodes at 5 to 6.7 tok/s with the shipped defaults, against the 15 to 18 tok/s that docs/DEEPSEEK_MAC.md reports for the same Mac. Setting `DS4_BUSY_CAP=2000` brings it to 14 to 19 tok/s with the same answers. With `DS4_CPU_LOG=1`, the CPU lane takes 9.7 ms a call (3.3 ms an expert), but `cpu_experts_iq`'s own phases (prefetch, quant, gate_up, down) add up to about a fifth of that. The rest of the timed span is around `ds4_busy_begin()` / `ds4_busy_end()`. `ds4_busy_begin()` waits on the previous spin's command buffer (`[g_busy.last waitUntilCompleted]`), so it looks as if the spin kernel runs to its cap here instead of leaving when the host sets the flag. That last part is my reading of `metal/src/mtl_rt.mm`, not something I measured directly. Engine CLI, same pack and prompt ids, 96 tokens, shipped `profile-2.00.bin` with `--profile-readonly`: | Setting | Decode tok/s | CPU lane per call | Routing waits per token | |---|---:|---:|---:| | default (cap 20000) | 6.66 | 9.7 ms | 29.9 ms | | `DS4_BUSY=0` | 7.62 | 2.9 ms | 58.5 ms | | `DS4_BUSY_CAP=2000` | 18.05 | 2.2 ms | 33.8 ms | | `DS4_BUSY_CAP=500` | 15.36 | 2.2 ms | 43.5 ms | | `DS4_BUSY_CAP=100` | 13.80 | 2.0 ms | 48.4 ms | | `DS4_SKIP_CPU=1` (timing only) | 17.90 | 0 | 47.2 ms | Through the server (`/v1/chat/completions`, greedy, thinking off) with `DS4_BUSY_CAP=2000` and the engine's own expert share (67.9 GB): 14.3 to 19.0 tok/s on short and code answers, a 3,000-token prompt read at 268 tok/s. Without it, the same requests ran at 5.0 to 6.5 tok/s. Things that did not change the speed: stopping the other VMs on the Mac, 69 GB free at start, the shipped expert profile read-only, engine 0.1.53 (Strata 0.2.7, 4.89 tok/s) against 0.1.54 (4.91 tok/s), and `--cpu-threads` 9, 12 or 16. Expected: the shipped default to reach the documented speed on this Mac, or a documented setting for it. I have not tried other Macs, so I can't say whether this is specific to the M5 Max or to this macOS version. ### Smallest steps or command that reproduce it ```sh cd ~/.local/share/strata/install/engine-dsv41/0.1.54-macos-arm64-metal P=~/.local/share/strata/Strata-data/packs/deepseek-v4.1-flash-ist-das-2.00bpw IDS=0,5,100,2000,3000,4000,500,600,700,800,900,1000 DS4_CPU_LOG=1 ./strata-dsv41 --pack $P --max-context 4096 --dspark none --vision off --ids $IDS --n 96 DS4_CPU_LOG=1 DS4_BUSY_CAP=2000 ./strata-dsv41 --pack $P --max-context 4096 --dspark none --vision off --ids $IDS --n 96 ``` Compare the `decode:` and `cpu lane calls:` lines. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.8 · engine 0.1.54 (strata-dsv41 build 36f6663c25e6, 0.1.54-metal); also engine 0.1.53 (build 55a557bb6d77) ### Graphics card, memory and system Apple M5 Max (40-core GPU) · 128 GB unified memory · macOS 26.7.2 · internal SSD ### Model, size and settings DeepSeek-V4.1-Flash IST-DAS 2.00 bpw (installed by `strata launch --family deepseek41 --model ist-das-2.00bpw`), 8K context, vision off, DSpark off (Mac default), Full quality (6 experts) ### Logs Default: ``` decode: 96 tokens in 14269 ms (6.66 tok/s); CPU lane: 2720 of 22800 experts; the cache moved 432 (432 in all) decode per token: layers 148.13 ms (of it: routing waits 29.87, CPU lane 111.83, the rest host launches), head wait 1.78, Engram reads 0.01 cpu lane calls: 1262, experts 3671, 12277.9 ms (9.729 ms a call, 3.345 ms an expert) cpu_experts_iq phases (ms over 1265 calls): prefetch 1954.4, quant1 9.6, gate_up 692.6, quant2 11.0, down 364.6 ``` `DS4_BUSY_CAP=2000`: ``` decode: 96 tokens in 5265 ms (18.05 tok/s); CPU lane: 2450 of 22800 experts; the cache moved 397 (397 in all) decode per token: layers 53.29 ms (of it: routing waits 33.77, CPU lane 12.77, the rest host launches), head wait 1.81, Engram reads 0.01 cpu lane calls: 1187, experts 3345, 2653.4 ms (2.235 ms a call, 0.793 ms an expert) ``` Investigated with an AI coding assistant; every number above is from a real run on this machine.
Author
Owner

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

Thank you for the detail. A probe shows that on our M5 Max the spin kernel does not see the flag the host writes while it runs: the flag is set 2 ms after launch and the kernel still ends at its cap (with cap 100000, 42 ms on average from the set to the end, against 52 ms when the flag is never set; an atomic read-modify-write, a fence and coherent(device) change nothing). So a spin lasts its cap, and the cap of 20000 is about 10.5 ms here.

We then ran DeepSeek itself, which we could not do before: the pinned ISTA-DASLab 2.00 bpw set (IQ2_XXS shards + Engram), the shipped profile, an M5 Max with 128 GB, nothing else running, three interleaved pairs, fresh process each run, decode tok/s (median):

prompt cap 20000 (default) 2000 1000 500
code, 28 tokens 14.4 12.1 12.6 10.6
agent turn, 913 tokens 14.5 10.2 9.2 11.9
3,000-token document 15.1 10.1 11.8 12.0

The first pair was slower for every cap (cold file cache); on the other two the default was the fastest in each class. So here the default gives 14-16 tok/s and the lower caps are slower, which is not what you see (5-6.7 at the default, 18 at 2000). We have not changed the default. The engine uses 4-5 CPU cores while it decodes, whatever the cap. The generated tokens also differed between runs of the same cap (the expert placement moves as the engine runs), so we could not use them to compare caps.

To find out what differs on your Mac, could you send: the chip and core count, the RAM, the disk (internal SSD or external) and where the model files are, the output of one run with DS4_CPU_LOG=1 (the per-token phase times) at the default and at DS4_BUSY_CAP=2000, and whether the first answers of a run were on a cold file cache (first start after a reboot or after other large files were read) or repeated? Whether anything else was using the Mac (a browser, another model server) matters too.

<!-- gh-comment-id:6547917258 --> @Niko1221 commented on GitHub (Oct 31, 2026): Thank you for the detail. A probe shows that on our M5 Max the spin kernel does not see the flag the host writes while it runs: the flag is set 2 ms after launch and the kernel still ends at its cap (with cap 100000, 42 ms on average from the set to the end, against 52 ms when the flag is never set; an atomic read-modify-write, a fence and `coherent(device)` change nothing). So a spin lasts its cap, and the cap of 20000 is about 10.5 ms here. We then ran DeepSeek itself, which we could not do before: the pinned ISTA-DASLab 2.00 bpw set (IQ2_XXS shards + Engram), the shipped profile, an M5 Max with 128 GB, nothing else running, three interleaved pairs, fresh process each run, decode tok/s (median): | prompt | cap 20000 (default) | 2000 | 1000 | 500 | |---|---|---|---|---| | code, 28 tokens | 14.4 | 12.1 | 12.6 | 10.6 | | agent turn, 913 tokens | 14.5 | 10.2 | 9.2 | 11.9 | | 3,000-token document | 15.1 | 10.1 | 11.8 | 12.0 | The first pair was slower for every cap (cold file cache); on the other two the default was the fastest in each class. So here the default gives 14-16 tok/s and the lower caps are slower, which is not what you see (5-6.7 at the default, 18 at 2000). We have not changed the default. The engine uses 4-5 CPU cores while it decodes, whatever the cap. The generated tokens also differed between runs of the same cap (the expert placement moves as the engine runs), so we could not use them to compare caps. To find out what differs on your Mac, could you send: the chip and core count, the RAM, the disk (internal SSD or external) and where the model files are, the output of one run with `DS4_CPU_LOG=1` (the per-token phase times) at the default and at `DS4_BUSY_CAP=2000`, and whether the first answers of a run were on a cold file cache (first start after a reboot or after other large files were read) or repeated? Whether anything else was using the Mac (a browser, another model server) matters too.
Author
Owner

@HildebrandYu commented on GitHub (Nov 1, 2026):

Independent data point on the same Mac, with the 2.25 bpw set instead of 2.00: DS4_BUSY_CAP=2000 helps, but it lands two orders of magnitude below your numbers, so the busy cap does not look like the whole story.

Setup: M5 Max 128 GB, macOS 27.0.1, engine strata-dsv41 0.1.55-metal build 4cf0d8cd3809, Strata 0.2.8 terminal, pack deepseek-v4.1-flash-ist-das-2.25bpw (274 GB), weights on a quota-limited APFS volume (1 TB quota, 89 % used) rather than the default data folder, --context 32k, greedy, --no-tui --yes.

Measured through /v1/chat/completions (single request, 41-token prompt, 12–16 generated; numbers are the engine's own serve log lines):

Setting Prompt Decode
default (cap 20000) 41 tok in 44.1 s (0.9 tok/s) 16 tok in 125.5 s (0.13 tok/s)
--ssd-cache 32 41 tok in 77.4 s (0.5) 12 tok in 149.7 s (0.08)
DS4_BUSY_CAP=2000 41 tok in 17.4 s (2.4) 12 tok in 47.1 s (0.26)

Placement (engine log, DS4_BUSY_CAP=2000 run): expert share 67.9 GB, 8398 of 15360 experts on the CPU lane (81.5 GB, in place in the model's files), 9 threads, CPU lane 33–37 % of the experts — i.e. the same share docs/DEEPSEEK_MAC.md describes.

Two things that make this not just a slower copy of your report:

  • A single token is fast: the engine's own warm-up line recorded 1 generated in 10 ms (97.33 tok/s) and 26 ms (38.16 tok/s). It is only sustained decoding that collapses.
  • Raising the expert share does not help: with other apps closed the share went 60.4 → 67.4 GB (6909/15360 resident) and decode got slightly worse (0.17 → 0.13 tok/s). --vram-experts 80 never finished starting (450 s, then runtime control returned an invalid response), and --cpu-threads 6 is ignored (log keeps 9 threads).

What the log says about I/O: the experts VRAM leaves over (~46.9 GB) are read in place from the model's files ... (0.0 GB of RAM free to keep them: the most-routed 46.9 GB read ahead). An uncached (F_NOCACHE) sequential read of the pack on this machine is 3.27 GiB/s, so the disk itself is fine — but every decode step appears to re-read ≈ 800 MB (2.25 bpw = 110 MB/token per DEEPSEEK_MAC.md, ~7× that at this rate).

So: your 6.7 → 18 tok/s movement looks like the busy-spin fix working; on 2.25 bpw we see 0.08 → 0.26. If the extra factor is the pack size times the cold-cache behaviour, --ssd-cache did not absorb it.

Happy to run anything else on this box (it is idle, 128 GB, nothing else loaded) — e.g. the same CLI --ids ... --n 96 comparison on 2.25 bpw, or with --profile-readonly, or with the weights moved to the default data folder to rule the volume out.

<!-- gh-comment-id:6553566431 --> @HildebrandYu commented on GitHub (Nov 1, 2026): Independent data point on the same Mac, with the **2.25 bpw** set instead of 2.00: `DS4_BUSY_CAP=2000` helps, but it lands two orders of magnitude below your numbers, so the busy cap does not look like the whole story. **Setup:** M5 Max 128 GB, macOS 27.0.1, engine `strata-dsv41 0.1.55-metal build 4cf0d8cd3809`, Strata 0.2.8 terminal, pack `deepseek-v4.1-flash-ist-das-2.25bpw` (274 GB), weights on a quota-limited APFS volume (1 TB quota, 89 % used) rather than the default data folder, `--context 32k`, greedy, `--no-tui --yes`. **Measured through `/v1/chat/completions`** (single request, 41-token prompt, 12–16 generated; numbers are the engine's own serve log lines): | Setting | Prompt | Decode | |---|---|---| | default (cap 20000) | 41 tok in 44.1 s (0.9 tok/s) | 16 tok in 125.5 s (**0.13 tok/s**) | | `--ssd-cache 32` | 41 tok in 77.4 s (0.5) | 12 tok in 149.7 s (**0.08**) | | `DS4_BUSY_CAP=2000` | 41 tok in 17.4 s (2.4) | 12 tok in 47.1 s (**0.26**) | **Placement** (engine log, `DS4_BUSY_CAP=2000` run): expert share 67.9 GB, 8398 of 15360 experts on the CPU lane (81.5 GB, in place in the model's files), 9 threads, CPU lane 33–37 % of the experts — i.e. the same share docs/DEEPSEEK_MAC.md describes. **Two things that make this not just a slower copy of your report:** * A single token is fast: the engine's own warm-up line recorded `1 generated in 10 ms (97.33 tok/s)` and `26 ms (38.16 tok/s)`. It is only sustained decoding that collapses. * Raising the expert share does not help: with other apps closed the share went 60.4 → 67.4 GB (6909/15360 resident) and decode got slightly *worse* (0.17 → 0.13 tok/s). `--vram-experts 80` never finished starting (450 s, then `runtime control returned an invalid response`), and `--cpu-threads 6` is ignored (log keeps 9 threads). **What the log says about I/O:** `the experts VRAM leaves over (~46.9 GB) are read in place from the model's files ... (0.0 GB of RAM free to keep them: the most-routed 46.9 GB read ahead)`. An uncached (`F_NOCACHE`) sequential read of the pack on this machine is **3.27 GiB/s**, so the disk itself is fine — but every decode step appears to re-read ≈ 800 MB (2.25 bpw = 110 MB/token per DEEPSEEK_MAC.md, ~7× that at this rate). So: your 6.7 → 18 tok/s movement looks like the busy-spin fix working; on 2.25 bpw we see 0.08 → 0.26. If the extra factor is the pack size times the cold-cache behaviour, `--ssd-cache` did not absorb it. Happy to run anything else on this box (it is idle, 128 GB, nothing else loaded) — e.g. the same CLI `--ids ... --n 96` comparison on 2.25 bpw, or with `--profile-readonly`, or with the weights moved to the default data folder to rule the volume out.
Author
Owner

@HildebrandYu commented on GitHub (Nov 1, 2026):

Addendum — the engine's own Metal timing lines point at command-buffer latency, not memory or disk:

mtl: 318.7 ms GPU, 40209 dispatches, 3996 command buffers
mtl: host waited 313844.2 ms for the GPU in 2669 waits; encoding the dispatches took 40.6 ms

mtl: 253.3 ms GPU, 41221 dispatches, 4083 command buffers
mtl: host waited 93920.7 ms for the GPU in 2673 waits; encoding the dispatches took 34.0 ms

mtl: 227.0 ms GPU, 29245 dispatches, 3295 command buffers
mtl: host waited 145685.1 ms for the GPU in 2226 waits; encoding the dispatches took 26.8 ms

Three short runs (2.25 bpw, 32k context, expert share 67.9 GB): the GPU does 0.23–0.32 s of actual work while the host waits 94–314 s for it, i.e. the GPU is idle ~99.9 % of wall time and each waitUntilCompleted costs 35–117 ms for ~0.1 ms of GPU work.

That is consistent with the busy-spin mechanism in the title, and it argues against the expert-cache/I-O theory: with the GPU starved this way, no amount of RAM or SSD bandwidth can matter.

Also tested on this box, for the record:

  • strata launch --tune quick (the official DeepSeek tuner): "Your computer already runs DeepSeek best with the standard settings (0.2 tokens a second); nothing changed" — its DSpark candidate did not finish.
  • thinking off (chat_template_kwargs.enable_thinking=false): 10 tokens in 72.9 s = 0.14 tok/s, same as with thinking on, so it is per-token latency, not reasoning length.
  • --ssd-cache 32: worse (0.08 tok/s).
<!-- gh-comment-id:6554032882 --> @HildebrandYu commented on GitHub (Nov 1, 2026): Addendum — the engine's own Metal timing lines point at command-buffer latency, not memory or disk: ``` mtl: 318.7 ms GPU, 40209 dispatches, 3996 command buffers mtl: host waited 313844.2 ms for the GPU in 2669 waits; encoding the dispatches took 40.6 ms mtl: 253.3 ms GPU, 41221 dispatches, 4083 command buffers mtl: host waited 93920.7 ms for the GPU in 2673 waits; encoding the dispatches took 34.0 ms mtl: 227.0 ms GPU, 29245 dispatches, 3295 command buffers mtl: host waited 145685.1 ms for the GPU in 2226 waits; encoding the dispatches took 26.8 ms ``` Three short runs (2.25 bpw, 32k context, expert share 67.9 GB): the GPU does **0.23–0.32 s of actual work** while the host waits **94–314 s** for it, i.e. the GPU is idle ~99.9 % of wall time and each `waitUntilCompleted` costs **35–117 ms** for ~0.1 ms of GPU work. That is consistent with the busy-spin mechanism in the title, and it argues against the expert-cache/I-O theory: with the GPU starved this way, no amount of RAM or SSD bandwidth can matter. Also tested on this box, for the record: - `strata launch --tune quick` (the official DeepSeek tuner): *"Your computer already runs DeepSeek best with the standard settings (0.2 tokens a second); nothing changed"* — its DSpark candidate did not finish. - thinking off (`chat_template_kwargs.enable_thinking=false`): 10 tokens in 72.9 s = 0.14 tok/s, same as with thinking on, so it is per-token latency, not reasoning length. - `--ssd-cache 32`: worse (0.08 tok/s).
Author
Owner

@sblocktechnologies commented on GitHub (Nov 3, 2026):

Thanks for testing it on your M5 Max. I reran it your way, and the gap is still there on this Mac with a warm cache and with nothing else running.

What you asked for:

  • Apple M5 Max, 18-core CPU (6 super + 12 performance), 40-core GPU, 128 GB, macOS 26.7.2.
  • Internal SSD. Model files are in the home folder on that disk.
  • Engine 0.1.54, shipped profile-2.00.bin with --profile-readonly. The IST-DAS 2.00 bpw IQ2_XXS shards with Engram. (My copy has a patch applied to the attention output weights. The pack's tensors.txt matches the stock one except for paths, so the tensor types and sizes are the same.)
  • Cache: one throwaway run first, then the runs below. All warm.
  • Other load: this Mac normally runs a small Linux VM. I ran it both with the VM up and with it stopped, no builds, and no remote-desktop session.

Engine CLI, the command from the issue, 96 tokens, three interleaved pairs, a fresh process each run, median decode tok/s:

default (20000) DS4_BUSY_CAP=2000
warm, VM running 4.94 16.28
warm, quiet (VM stopped, nothing else running) 5.17 16.29

Through strata serve (greedy, thinking off, 200 tokens max), three interleaved server starts per setting, median decode tok/s:

prompt default 2000
code, 22 tokens 5.53 13.41
agent turn, 752 tokens 6.38 14.21
3,906-token document 6.92 13.97

One CLI run per cap, with DS4_CPU_LOG=1:

cap tok/s CPU lane per call routing waits per token
20000 3.97 9.71 ms 26.1 ms
10000 8.77 4.89 ms 27.9 ms
5000 12.32 2.97 ms 29.5 ms
2000 15.39 2.05 ms 30.7 ms
500 13.61 2.22 ms 42.3 ms
100 12.15 2.10 ms 46.4 ms

The CPU lane time per call tracks the cap down to about 2000, and below that it stays at about 2 ms. At 20000 it's about 9.5 ms, close to your 10.5 ms spin. So here every CPU-lane call seems to wait out a full spin, which fits your finding that the spin runs to its cap. Lower caps then cost GPU time instead (routing waits rise below 2000).

In the quiet runs the output tokens were identical across all seven runs at both caps, and every run put the same 3242 of 22800 experts on the CPU lane. Default quiet run:

decode: 96 tokens in 18360 ms (5.17 tok/s); CPU lane: 3242 of 22800 experts; the cache moved 590 (590 in all)
cpu lane calls: 1697, experts 4112, 15886.6 ms (9.362 ms a call, 3.863 ms an expert)
ds4: expert share: 69.2 GB of VRAM experts (the RAM cap leaves 69.2 GB; --vram-experts sets it)
mtl: host waited 4233.8 ms for the GPU in 6135 waits

Same with DS4_BUSY_CAP=2000:

decode: 96 tokens in 5813 ms (16.34 tok/s); CPU lane: 3242 of 22800 experts; the cache moved 590 (590 in all)
cpu lane calls: 1697, experts 4112, 3327.7 ms (1.961 ms a call, 0.809 ms an expert)
mtl: host waited 3613.4 ms for the GPU in 6135 waits

Could you send the cpu lane calls: and CPU lane: N of 22800 experts lines from one of your default runs? If your CPU lane is also about 9.5 ms a call at the default, I'd expect your decode to be as slow as mine, so I'm curious whether yours is closer to 2 ms or makes far fewer calls a token.

@HildebrandYu, your case looks different from mine. My host waits are about 0.6 to 0.7 ms each (6135 waits, 3.6 to 4.2 s in all) against your 35 to 117 ms, and the cap only changes the CPU-lane time. Also, the mtl: … ms GPU figure reads about 300 ms in all my runs, whether the decode took 18 s or 6 s, so I don't think it measures total GPU time. You have 33 to 37% of experts on the CPU lane, read in place from a nearly full quota volume (mine is about 16% from the internal data volume), so I'd try your second idea first: the weights in the default data folder.

<!-- gh-comment-id:6613843390 --> @sblocktechnologies commented on GitHub (Nov 3, 2026): Thanks for testing it on your M5 Max. I reran it your way, and the gap is still there on this Mac with a warm cache and with nothing else running. What you asked for: - Apple M5 Max, 18-core CPU (6 super + 12 performance), 40-core GPU, 128 GB, macOS 26.7.2. - Internal SSD. Model files are in the home folder on that disk. - Engine 0.1.54, shipped `profile-2.00.bin` with `--profile-readonly`. The IST-DAS 2.00 bpw IQ2_XXS shards with Engram. (My copy has a patch applied to the attention output weights. The pack's `tensors.txt` matches the stock one except for paths, so the tensor types and sizes are the same.) - Cache: one throwaway run first, then the runs below. All warm. - Other load: this Mac normally runs a small Linux VM. I ran it both with the VM up and with it stopped, no builds, and no remote-desktop session. Engine CLI, the command from the issue, 96 tokens, three interleaved pairs, a fresh process each run, median decode tok/s: | | default (20000) | `DS4_BUSY_CAP=2000` | |---|---:|---:| | warm, VM running | 4.94 | 16.28 | | warm, quiet (VM stopped, nothing else running) | 5.17 | 16.29 | Through `strata serve` (greedy, thinking off, 200 tokens max), three interleaved server starts per setting, median decode tok/s: | prompt | default | 2000 | |---|---:|---:| | code, 22 tokens | 5.53 | 13.41 | | agent turn, 752 tokens | 6.38 | 14.21 | | 3,906-token document | 6.92 | 13.97 | One CLI run per cap, with `DS4_CPU_LOG=1`: | cap | tok/s | CPU lane per call | routing waits per token | |---:|---:|---:|---:| | 20000 | 3.97 | 9.71 ms | 26.1 ms | | 10000 | 8.77 | 4.89 ms | 27.9 ms | | 5000 | 12.32 | 2.97 ms | 29.5 ms | | 2000 | 15.39 | 2.05 ms | 30.7 ms | | 500 | 13.61 | 2.22 ms | 42.3 ms | | 100 | 12.15 | 2.10 ms | 46.4 ms | The CPU lane time per call tracks the cap down to about 2000, and below that it stays at about 2 ms. At 20000 it's about 9.5 ms, close to your 10.5 ms spin. So here every CPU-lane call seems to wait out a full spin, which fits your finding that the spin runs to its cap. Lower caps then cost GPU time instead (routing waits rise below 2000). In the quiet runs the output tokens were identical across all seven runs at both caps, and every run put the same 3242 of 22800 experts on the CPU lane. Default quiet run: ``` decode: 96 tokens in 18360 ms (5.17 tok/s); CPU lane: 3242 of 22800 experts; the cache moved 590 (590 in all) cpu lane calls: 1697, experts 4112, 15886.6 ms (9.362 ms a call, 3.863 ms an expert) ds4: expert share: 69.2 GB of VRAM experts (the RAM cap leaves 69.2 GB; --vram-experts sets it) mtl: host waited 4233.8 ms for the GPU in 6135 waits ``` Same with `DS4_BUSY_CAP=2000`: ``` decode: 96 tokens in 5813 ms (16.34 tok/s); CPU lane: 3242 of 22800 experts; the cache moved 590 (590 in all) cpu lane calls: 1697, experts 4112, 3327.7 ms (1.961 ms a call, 0.809 ms an expert) mtl: host waited 3613.4 ms for the GPU in 6135 waits ``` Could you send the `cpu lane calls:` and `CPU lane: N of 22800 experts` lines from one of your default runs? If your CPU lane is also about 9.5 ms a call at the default, I'd expect your decode to be as slow as mine, so I'm curious whether yours is closer to 2 ms or makes far fewer calls a token. @HildebrandYu, your case looks different from mine. My host waits are about 0.6 to 0.7 ms each (6135 waits, 3.6 to 4.2 s in all) against your 35 to 117 ms, and the cap only changes the CPU-lane time. Also, the `mtl: … ms GPU` figure reads about 300 ms in all my runs, whether the decode took 18 s or 6 s, so I don't think it measures total GPU time. You have 33 to 37% of experts on the CPU lane, read in place from a nearly full quota volume (mine is about 16% from the internal data volume), so I'd try your second idea first: the weights in the default data folder.
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#2185
No description provided.