[GH-ISSUE #5488] [Engine] dsv41 on Apple-silicon Metal: routed experts go to the CPU lane, the one-GPU decode path turns itself off, DeepSeek-V4.1-Flash runs 10-40x slower than expected #5459

Open
opened 2026-11-07 20:39:34 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Qfbxz on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5488

[Engine] dsv41 on Apple-silicon Metal: most routed experts go to the "CPU lane", the one-GPU decode path turns itself off, DeepSeek-V4.1-Flash runs 10–40× slower than expected

Area: [Engine] (dsv41 engine component, Metal backend)
Engine: strata-dsv41 0.1.57-metal build 3e0210663 — official signed component (ed25519 key_id 5d1bc23abbeffd0d, sha256 0e52375fdb3876da5c3311f14d19345893265840118cffb0a0526e82b8b75e29)
Product: Strata 0.2.11
Hardware: Apple M3 Max, 128 GB unified memory, macOS 27.2 (26B123), Metal 4, internal NVMe
Model: DeepSeek-V4.1-Flash-1017, ISTA-DAS GSQ-RCO IQ2_XS "2.00bpw" (pack deepseek-v4.1-flash-ist-das-2.00bpw; 384 routed experts × 40 layers = 15360; Engram IQ4_NL shared)
Reproducibility: every engine start, deterministic (same layout decision each boot)

The problem

On Apple silicon there is no PCIe lane, and the engine's lane decision treats that as "the CPU lane is as fast or there is no lane", which turns the one-GPU decode path off and hands most routed experts to CPU threads reading in place from the model's files. Decode throughput collapses to a fraction of the expected rate.

Boot log (verbatim, ~/.local/share/strata/install/strata-deepseek-v4.1-flash-ist-das-2.00bpw.log):

ds4: the one-GPU decode path (in-place pulls, windows streamed, landings): on for now (NVIDIA, one GPU: kept if the PCIe lane's plan streams experts from RAM)
ds4: the experts VRAM leaves over (~28.7 GB) are read in place from the model's files (--mmap-experts off copies them into RAM) (0.0 GB of RAM free to keep them: the most-routed 28.7 GB read ahead; prompts in chunks of 8192)
ds4: other programs hold 26.3 GB of anonymous memory: 6.0 GB less for the experts
ds4: expert share: 63.1 GB of VRAM experts (the RAM cap leaves 63.1 GB; --vram-experts sets it)
ds4: the one-GPU decode path: off - the PCIe lane's plan streams nothing on this GPU (its CPU lane is as fast or there is no lane); v1.1.27's path
ds4: CUDA0 layers [0, 39] + head: weights 5.86 GB, experts 63.13 GB (6025 of 15360 in VRAM), caches 0.12 GB, 38879 MiB free
ds4: 9335 routed experts on the CPU lane (80.3 GB, in place in the model's files), 8 threads

Expected vs observed

source number
Strata's own setup text for IST-DAS 2.25 bpw, measured on M5 Max 128 GB: "13–15 tokens/s for a short answer … the engine kept about 68 GB of the experts resident and read about 110 MB a token from the SSD" 13–15 tok/s
this machine (M3 Max 128 GB, the smaller 2.00 bpw set), App session 0.39 tok/s sustained (4907 tokens in 3.5 h)
same, clean restart, short run 1.73 tok/s, degrading to 0.07
CPU lane busy during generation 25–63 %
GPU during generation near idle

The 2.00 bpw set is smaller than the 2.25 bpw set the official number was measured on, so on equal treatment it should be faster, not 10–40× slower.

What was tried locally

attempt result
DS4_UMA_GPU_RESERVE_GB=96 layout shifts the wrong way: 5738 in VRAM / 9622 experts (82.8 GB) on the CPU lane vs 6025 / 9335 without the knob; path decision unchanged
DS4_STREAM=1 the engine turns it back off and logs strata metal: kernel launch with no Metal dispatch at src/dsv41/ds4_kernels.cu:2703 — the escape hatch crashes into a bad path on Metal
--vram-experts exists ("the RAM cap leaves 63.1 GB; --vram-experts sets it") but the RAM-cap logic computed "0.0 GB of RAM free to keep them" while ~100 GB of the 128 GB was actually free — the cap heuristic also mis-sizes on UMA

Relevant knobs found in the 0.1.57 binary (static strings, untested on Metal)

DS4_STREAM_FORCE, DS4_STREAM_DIRECT, DS4_STREAM_ZC, DS4_STREAM_WIN, DS4_STREAM_SLOTS, DS4_STREAM_THREADS, DS4_STREAM_COPIES, DS4_STREAM_TOKEN_AB, STRATA_DS4_CPU_LANE, DS4_LANE_CAL, DS4_LANE_CHECK, DS4_LANE_FREE, DS4_LANE_SKIP, DS4_LANE_SPIN_MS, DS4_TRACE_AHEAD, DS4_LAND, DS4_UMA_GPU_RESERVE_GB, DS4_UMA_HEADROOM_GIB, DS4_STORE_RESERVE, plus the pack-cached lane measurement lane-times.txt ("this GPU's PCIe lane streamed nothing at an earlier start - lane-times.txt in the pack; delete it to measure again").

A controlled knob sweep on this machine is prepared (per-arm engine restart, layout + tok/s captured); the strings above suggest DS4_STREAM_FORCE and the lane-calibration knobs decide exactly the branch that mis-fires here.

Ask

  1. A UMA-aware lane policy: on Apple silicon, let the GPU's in-place pull from unified memory count as the "lane" win, so the one-GPU decode path engages instead of falling back to the v1.1.27 CPU-thread path.
  2. And/or make the documented escape hatch work on Metal: DS4_STREAM=1 currently hits kernel launch with no Metal dispatch (ds4_kernels.cu:2703) — either fix that path or expose a supported force knob that survives on Metal.
  3. Re-check the --vram-experts RAM-cap heuristic on unified memory: it reported "0.0 GB of RAM free to keep them" with ~100 GB free.
  4. (minor) the device is labeled CUDA0 in the layout lines on a Metal-only host.

Full boot log (32 lines), the run config (with and without the reserve knob), and a knob-name dump can be attached on request. Measured locally; nothing here is inferred from reading code alone — every quoted line is from a real start on this machine.

Originally created by @Qfbxz on GitHub (Nov 7, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5488 # [Engine] dsv41 on Apple-silicon Metal: most routed experts go to the "CPU lane", the one-GPU decode path turns itself off, DeepSeek-V4.1-Flash runs 10–40× slower than expected **Area**: [Engine] (dsv41 engine component, Metal backend) **Engine**: strata-dsv41 0.1.57-metal build 3e0210663 — official signed component (ed25519 key_id `5d1bc23abbeffd0d`, sha256 `0e52375fdb3876da5c3311f14d19345893265840118cffb0a0526e82b8b75e29`) **Product**: Strata 0.2.11 **Hardware**: Apple M3 Max, 128 GB unified memory, macOS 27.2 (26B123), Metal 4, internal NVMe **Model**: DeepSeek-V4.1-Flash-1017, ISTA-DAS GSQ-RCO IQ2_XS "2.00bpw" (pack `deepseek-v4.1-flash-ist-das-2.00bpw`; 384 routed experts × 40 layers = 15360; Engram IQ4_NL shared) **Reproducibility**: every engine start, deterministic (same layout decision each boot) ## The problem On Apple silicon there is no PCIe lane, and the engine's lane decision treats that as "the CPU lane is as fast or there is no lane", which turns the one-GPU decode path **off** and hands most routed experts to CPU threads reading in place from the model's files. Decode throughput collapses to a fraction of the expected rate. Boot log (verbatim, `~/.local/share/strata/install/strata-deepseek-v4.1-flash-ist-das-2.00bpw.log`): ``` ds4: the one-GPU decode path (in-place pulls, windows streamed, landings): on for now (NVIDIA, one GPU: kept if the PCIe lane's plan streams experts from RAM) ds4: the experts VRAM leaves over (~28.7 GB) are read in place from the model's files (--mmap-experts off copies them into RAM) (0.0 GB of RAM free to keep them: the most-routed 28.7 GB read ahead; prompts in chunks of 8192) ds4: other programs hold 26.3 GB of anonymous memory: 6.0 GB less for the experts ds4: expert share: 63.1 GB of VRAM experts (the RAM cap leaves 63.1 GB; --vram-experts sets it) ds4: the one-GPU decode path: off - the PCIe lane's plan streams nothing on this GPU (its CPU lane is as fast or there is no lane); v1.1.27's path ds4: CUDA0 layers [0, 39] + head: weights 5.86 GB, experts 63.13 GB (6025 of 15360 in VRAM), caches 0.12 GB, 38879 MiB free ds4: 9335 routed experts on the CPU lane (80.3 GB, in place in the model's files), 8 threads ``` ## Expected vs observed | source | number | |---|---| | Strata's own setup text for IST-DAS 2.25 bpw, measured on M5 Max 128 GB: "13–15 tokens/s for a short answer … the engine kept about 68 GB of the experts resident and read about 110 MB a token from the SSD" | 13–15 tok/s | | this machine (M3 Max 128 GB, the *smaller* 2.00 bpw set), App session | 0.39 tok/s sustained (4907 tokens in 3.5 h) | | same, clean restart, short run | 1.73 tok/s, degrading to 0.07 | | CPU lane busy during generation | 25–63 % | | GPU during generation | near idle | The 2.00 bpw set is smaller than the 2.25 bpw set the official number was measured on, so on equal treatment it should be *faster*, not 10–40× slower. ## What was tried locally | attempt | result | |---|---| | `DS4_UMA_GPU_RESERVE_GB=96` | layout shifts the wrong way: 5738 in VRAM / **9622 experts (82.8 GB) on the CPU lane** vs 6025 / 9335 without the knob; path decision unchanged | | `DS4_STREAM=1` | the engine turns it back off and logs `strata metal: kernel launch with no Metal dispatch at src/dsv41/ds4_kernels.cu:2703` — the escape hatch crashes into a bad path on Metal | | `--vram-experts` | exists ("the RAM cap leaves 63.1 GB; --vram-experts sets it") but the RAM-cap logic computed "0.0 GB of RAM free to keep them" while ~100 GB of the 128 GB was actually free — the cap heuristic also mis-sizes on UMA | ## Relevant knobs found in the 0.1.57 binary (static `strings`, untested on Metal) `DS4_STREAM_FORCE`, `DS4_STREAM_DIRECT`, `DS4_STREAM_ZC`, `DS4_STREAM_WIN`, `DS4_STREAM_SLOTS`, `DS4_STREAM_THREADS`, `DS4_STREAM_COPIES`, `DS4_STREAM_TOKEN_AB`, `STRATA_DS4_CPU_LANE`, `DS4_LANE_CAL`, `DS4_LANE_CHECK`, `DS4_LANE_FREE`, `DS4_LANE_SKIP`, `DS4_LANE_SPIN_MS`, `DS4_TRACE_AHEAD`, `DS4_LAND`, `DS4_UMA_GPU_RESERVE_GB`, `DS4_UMA_HEADROOM_GIB`, `DS4_STORE_RESERVE`, plus the pack-cached lane measurement `lane-times.txt` ("this GPU's PCIe lane streamed nothing at an earlier start - lane-times.txt in the pack; delete it to measure again"). A controlled knob sweep on this machine is prepared (per-arm engine restart, layout + tok/s captured); the strings above suggest `DS4_STREAM_FORCE` and the lane-calibration knobs decide exactly the branch that mis-fires here. ## Ask 1. A UMA-aware lane policy: on Apple silicon, let the GPU's in-place pull from unified memory count as the "lane" win, so the one-GPU decode path engages instead of falling back to the v1.1.27 CPU-thread path. 2. And/or make the documented escape hatch work on Metal: `DS4_STREAM=1` currently hits `kernel launch with no Metal dispatch` (`ds4_kernels.cu:2703`) — either fix that path or expose a supported force knob that survives on Metal. 3. Re-check the `--vram-experts` RAM-cap heuristic on unified memory: it reported "0.0 GB of RAM free to keep them" with ~100 GB free. 4. (minor) the device is labeled `CUDA0` in the layout lines on a Metal-only host. Full boot log (32 lines), the run config (with and without the reserve knob), and a knob-name dump can be attached on request. Measured locally; nothing here is inferred from reading code alone — every quoted line is from a real start on this machine.
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#5459
No description provided.