mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1449] Add Metal backend support for Strata on macOS #3462
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3462
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/Niko1221/Strata/pull/1449
State: closed
Merged: No
Title
Experimental macOS / Apple Silicon support (Metal engine)
Summary
Strata now runs on Apple Silicon Macs (M1 or newer, 64 GB+). A new engine,
strata-metal, runs the model onllama.cpp's Metal backend and speaks the CUDA engine's line protocol, so the server, web app and APIs (OpenAI,
Anthropic, Responses, MCP) work unchanged. Setup detects a Mac and builds it by itself:
make check,make pull MODEL=Q2_0,make run. Experimental: tested on one MacBook Pro M5 Max (128 GB, macOS 26.4) with Q2_0.Measured on that Mac (Q2_0, 32K context, through the OpenAI API, greedy, thinking off):
With
--mtp on(opt-in): up to 21.6 tok/s; MTP alone gives 1.23–1.50x on short chats.The README's one-shot voxel pagoda garden prompt, with a 4,096-token thinking budget, produced a complete HTML
page in 443 s (~3.7 min of capped thinking, then ~16K characters of code at ~20 tok/s). Without the budget,
greedy thinking ran for 90K tokens and never answered.
What changed
metal/strata_metal.cpp: the Metal engine: conversation reuse through recurrent-state checkpoints, pictureswith M-RoPE positions, batch slots, MTP drafting.
metal/CMakeLists.txt,CMakeLists.txt:-DSTRATA_ENABLE_METAL=ON, llama.cpp at a pinned commit;metal/patches/: two optional Metal kernel patches;metal/bench/ab.py: A/B test of two engine builds.metal/setup_mac.py,setup.py,setup.sh: setup's Mac steps (Metal GPU check, local build, configconversion);
make checkon a Mac uses a 64 GB floor and marks untested sizes.metal/mtp_gguf.py: builds the MTP draft head for llama.cpp, checked by SHA-256.serve/telemetry.py,serve/web/app.js: Mac GPU load, memory, power and chip temperature in the Monitor,without root; PCIe shows "n/a" for an integrated GPU.
serve/server.py: RFC 6750WWW-Authenticateon 401.Makefile,tools/chat.py,tools/set_context.py:make run/start/stop/status/chat/pull/check/test,make run CONTEXT=131072,make chat REASONING_BUDGET=N; works with macOS's make 3.81.docs/MACOS.md: quick start, limits and warnings, measurements, MLX comparison; a line in each of the 7 READMEs.make chatand the context option. Three tests that failed only on macOS now pass;make testpasses on the Mac.Extra Notes
make checkmarks the other sizes "untested on a Mac".