[GH-ISSUE #15862] Metal shader compile fails on macOS 26.3.1 — MPPTensorOpsMatMul2dImpl static_assert (bfloat/half) on Apple M5 #72167

Open
opened 2026-05-05 03:35:10 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @mcp10 on GitHub (Apr 28, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15862

Environment

  • Hardware: MacBook Pro (Mac17,2), Apple M5
  • macOS: 26.3.1 (a) — build 25D771280a (Rapid Security Response)
  • Ollama: tested on 0.21.2 (stable) and 0.22.0-rc1 — same failure

Symptom

POST /api/chat returns 500 Internal Server Error: llama runner process has terminated. Affects every model loaded so far (gemma4:26b, llama3.2:3b).

Root cause (from logs)

On-the-fly Metal library compilation fails against macOS 26.3.1's MetalPerformancePrimitives headers, which now enforce strict type-matching on cooperative tensors:

ggml_metal_init: picking default device: Apple M5
ggml_metal_init: the device does not have a precompiled Metal library - this is unexpected
ggml_metal_init: will try to compile it on the fly
ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
  MPPTensorOpsMatMul2dImpl.h:3266: static_assert failed due to requirement
    '__tensor_ops_detail::__is_same_v<bfloat, half>'
    "Input types must match cooperative tensor types"
  MPPTensorOpsMatMul2dImpl.h:3267: static_assert failed due to requirement
    '__tensor_ops_detail::__is_same_v<half, bfloat>'
ggml_metal_init: error: failed to initialize the Metal library
ggml_backend_metal_device_init: error: failed to allocate context
llama_init_from_model: failed to initialize the context: failed to initialize Metal backend
panic: unable to create llama context

Embedded GGML shader source is instantiating mpp::tensor_ops::matmul2d with mismatched <half, bfloat> operands; the new MPP headers reject this.

Notes

  • Models that previously worked (cached compiled shaders) broke after the macOS 26.3.1 RSR purged Metal's per-device shader cache, forcing a recompile that now fails.
  • Reproduces on a fresh install of 0.22.0-rc1 (verified locally).
Originally created by @mcp10 on GitHub (Apr 28, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15862 ### Environment - Hardware: MacBook Pro (Mac17,2), Apple **M5** - macOS: **26.3.1 (a)** — build `25D771280a` (Rapid Security Response) - Ollama: tested on **0.21.2** (stable) and **0.22.0-rc1** — same failure ### Symptom `POST /api/chat` returns `500 Internal Server Error: llama runner process has terminated`. Affects every model loaded so far (`gemma4:26b`, `llama3.2:3b`). ### Root cause (from logs) On-the-fly Metal library compilation fails against macOS 26.3.1's `MetalPerformancePrimitives` headers, which now enforce strict type-matching on cooperative tensors: ``` ggml_metal_init: picking default device: Apple M5 ggml_metal_init: the device does not have a precompiled Metal library - this is unexpected ggml_metal_init: will try to compile it on the fly ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3 MPPTensorOpsMatMul2dImpl.h:3266: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' "Input types must match cooperative tensor types" MPPTensorOpsMatMul2dImpl.h:3267: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<half, bfloat>' ggml_metal_init: error: failed to initialize the Metal library ggml_backend_metal_device_init: error: failed to allocate context llama_init_from_model: failed to initialize the context: failed to initialize Metal backend panic: unable to create llama context ``` Embedded GGML shader source is instantiating `mpp::tensor_ops::matmul2d` with mismatched `<half, bfloat>` operands; the new MPP headers reject this. ### Notes - Models that previously worked (cached compiled shaders) broke after the macOS 26.3.1 RSR purged Metal's per-device shader cache, forcing a recompile that now fails. - Reproduces on a fresh install of 0.22.0-rc1 (verified locally).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#72167