mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3122] [CLOSED] Metal backend: fix the build on macOS 27.2 / Apple clang 21 and make fused_gr_persist_init a no-op #4465
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#4465
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3122
Author: @mnott
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:metal-build-macos27📝 Commits (2)
7e330e4metal: build on macOS 27.2 / Apple clang 21, fused_gr_persist_init is a no-opac8114dmetal: stubs regenerated in place, compute capability reported unsupported, fused_gr_read_persist returns false📊 Changes
3 files changed (+40 additions, -9 deletions)
View changed files
📝
metal/include/metal_compat/cuda_runtime.h(+10 -1)📝
metal/src/engine/setup_host.cpp(+2 -0)📝
metal/src/engine/stubs.cpp(+28 -8)📄 Description
Problem
Building the Metal engine of v0.1.45 (
./setup.sh, Metal path) on macOS 27.2 with Apple clang 21 fails, and once it builds,serving needs a workaround.
metal/include/metal_compat/cuda_runtime.hlackscudaDevAttrComputeCapabilityMajor/Minor,cudaDeviceGetStreamPriorityRange,cudaStreamCreateWithPriority,cudaMemcpyPeerandcudaDeviceDisablePeerAccess, whichsrc/core/verify.cppandsrc/core/peer_experts.cppuse (the HIP compat header maps them).metal/src/engine/stubs.cppis stale:Gemm::bf16lacks thebool x_f16parameter (compile error), and 21 kernel entrypoints (
wait_handoff,hc_q8_to_bf16,qsa_*,gr_norm*, ...) are undefined at link time.strata::kernels::fused_gr_persist_init(src/core/verify.cpp, theopt-in HIP initialiser behind
STRATA_HC_PERSIST=1). Generated stubs stop the engine (exit 86) unlessSTRATA_METAL_STUBS=logis set, so the server could only be started with stub logging on.Change
cuda_runtime.h: shims for the missing calls. Compute capability and the peer calls report "unsupported" (the onlycompute-capability caller,
src/core/verify.cpp, reads a failure as "not a Turing card"); stream priority range 0/0, apriority stream is a plain stream.
stubs.cpp: regenerated in place withmetal/tools/gen_stubs.pyagainst the v0.1.45 headers (its include root is the LAST-I.../includethat containsstrata/, so-I<repo>/includemust come after-I<repo>/metal/include): stale signaturesupdated (
Gemm::bf16and thegr_norm*family gained theirboolparameter) and the 21 missing entry points added. They arenot ports: they stop the engine with the entry point's name if reached, like the existing stubs.
setup_host.cpp:fused_gr_persist_init() {}next tofused_gr_check() {}, andfused_gr_read_persist()returningfalse,both removed from the generated stubs. This matches the CUDA and SYCL builds (
src/kernels/cuda/fused_gr.cu, non-HIP branch).All other stubs still stop the engine.
The build-fix parts overlap with #3114, which bundles them with RoPE scaling, a memory probe and setup changes; this PR is
only the build fix, tested on hardware, and adopts #3114's in-place stub regeneration and "unsupported" compute capability.
Testing
Apple M5 Max, 128 GB, macOS 27.2, Apple clang 21.
./setup.sh --yes --no-start --no-browser --family unsloth --model UD-Q4_K_XL --vision no --buildfinishes and theengine links (exit 0).
STRATA_METAL_STUBS(IQ3_S pack, 65,536 context, MTP on): the engine reaches READY and answers a short/v1/messagesrequest and a tool-call request (tool_usewith the right arguments,stop_reasontool_use). The engine logof that start has no
STUBline, and the engine stayed up (no exit 86) until stopped. Before the change the same start loggedSTUB strata::kernels::fused_gr_persist_init./v1/messagesrequests, measured from the engine's per-request log lines (prefill = newly read tokens / prefill time,decode = generated tokens / generation time):
Prefill counts requests with at least 4k new tokens; in the 90-130k row no request had that many (the rest of the prompt came
from the prefix cache), so that value is from the 21 requests with 1-3k new tokens. Overall: 738,060 tokens generated at
109.1 tok/s, prompts 98.0 % reused from the prefix cache, median context 33,100 tokens (p90 75,506, max 130,137), about 260
tokens generated per request. Decode stays flat up to 130k context.
/v1/messagestool smoke (Read, Edit, Bash, Edit-after-Read): all pass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.