Skip to content

Warn when --gpu-layers puts MoE layers on the CPU; mark #176 fixed in README - #182

Merged
solderzzc merged 2 commits into
mainfrom
feat/gpu-layers-moe-warning
Sep 25, 2026
Merged

solderzzc merged 2 commits into
mainfrom
feat/gpu-layers-moe-warning

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Summary

Test plan

  • Gemma 4 26B-A4B with --gpu-layers 23 prints 7 MoE layers will run on the CPU ...
  • Full-GPU runs print no warning

🤖 Generated with Claude Code

solderzzc and others added 2 commits September 24, 2026 18:09
CPU-resident MoE layers run the quantized expert matmuls on one core
(~0.4 tok/s prefill on Gemma 4 26B-A4B, see #176). Point users at
--stream-experts instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@solderzzc

Copy link
Copy Markdown
Member Author

Cross-review (M6 session): no blocking issues. OK to merge once CI is green.

Reviewed the full diff (Server.swift +8, README.md):

  • The warning is gated on modelIsMoE && cpuCount > 0, so a FULL GPU load (no split) prints nothing. modelIsMoE comes from the same ModelProfile the partition plan uses. When the profile isn't available (first-run download, modelDirectory == nil), partitionPlan is also nil, total == actual and cpuCount == 0, so no warning is lost relative to the split message itself.
  • README: the --gpu-layers note now says "fixed in chore: bump mlx-swift for compile scoped-device fix (#176) #177" and keeps the MoE CPU speed caveat and the --stream-experts recommendation. Merge note: docs: correct M6 TurboKV data — #175 affects every chip, not just M5 #180 rewrites the TurboKV line just above, with one unchanged line in between. Git should merge the two cleanly, but whichever lands second may want a quick look.

Verified on a Mac mini M6 (32 GB), branch 60c0bf4:

  • gemma-4-26b-a4b-it-4bit --gpu-layers 23 prints ⚠️ 7 MoE layers will run on the CPU, which is very slow (expect well under 1 tok/s). and For MoE models that don't fit in GPU memory, prefer --stream-experts over --gpu-layers.
  • The same model without --gpu-layers (FULL GPU): no warning.
  • Clean build, no new compiler warnings.

@solderzzc
solderzzc merged commit 529cbe9 into main Sep 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant