[GH-ISSUE #15594] [Bug]: Metal compilation error on Apple M5 (macOS Tahoe 26.3.1) - static_assert failed #35711

Open
opened 2026-04-22 20:23:37 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @Juanc3 on GitHub (Apr 15, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15594

What is the issue?

Description

Models fail to load on the new Apple M5 hardware running macOS Tahoe 26.3.1. The llama runner terminates with exit status 2 due to a critical compilation error in the embedded Metal library.

It seems the Metal compiler in this hardware/OS combination has stricter requirements for cooperative tensor types, causing a mismatch between bfloat and half types that prevents the engine from starting.

Logs

The following error is captured in ~/.ollama/logs/server.log during the model load attempt:

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

The runner crashes shortly after:

time=2026-04-14T14:42:25.972-03:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2"
[GIN] 2026/04/14 - 14:42:25 | 500 |  2.125581542s |       127.0.0.1 | POST     "/api/generate"

Environment

  • Ollama version: 0.20.7
  • OS: macOS Tahoe 26.3.1
  • Hardware: Apple M5 (16GB Unified Memory)
  • Models tested: qwen3.5:2b, qwen3.5:0.8b, llama3.2:1b

Steps to Reproduce

  1. Install Ollama on an Apple M5 Mac running macOS Tahoe.
  2. Attempt to run any model: ollama run qwen3.5:2b.
  3. The model fails to load with Error: 500 Internal Server Error.

Additional Context

Attempting to bypass the GPU with export OLLAMA_LLM_LIBRARY=cpu does not prevent the runner from attempting to initialize the Metal library, which still leads to the same crash. This suggests the initialization sequence for Metal in the current runner is incompatible with the M5's GPU family (MTLGPUFamilyApple10).

Relevant log output

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.20.7

Originally created by @Juanc3 on GitHub (Apr 15, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15594 ### What is the issue? ## Description Models fail to load on the new **Apple M5** hardware running **macOS Tahoe 26.3.1**. The llama runner terminates with `exit status 2` due to a critical compilation error in the embedded Metal library. It seems the Metal compiler in this hardware/OS combination has stricter requirements for cooperative tensor types, causing a mismatch between `bfloat` and `half` types that prevents the engine from starting. ## Logs The following error is captured in `~/.ollama/logs/server.log` during the model load attempt: ```text ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3 In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' "Input types must match cooperative tensor types" ``` The runner crashes shortly after: ```text time=2026-04-14T14:42:25.972-03:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2" [GIN] 2026/04/14 - 14:42:25 | 500 | 2.125581542s | 127.0.0.1 | POST "/api/generate" ``` ## Environment - **Ollama version:** 0.20.7 - **OS:** macOS Tahoe 26.3.1 - **Hardware:** Apple M5 (16GB Unified Memory) - **Models tested:** `qwen3.5:2b`, `qwen3.5:0.8b`, `llama3.2:1b` ## Steps to Reproduce 1. Install Ollama on an Apple M5 Mac running macOS Tahoe. 2. Attempt to run any model: `ollama run qwen3.5:2b`. 3. The model fails to load with `Error: 500 Internal Server Error`. ## Additional Context Attempting to bypass the GPU with `export OLLAMA_LLM_LIBRARY=cpu` does not prevent the runner from attempting to initialize the Metal library, which still leads to the same crash. This suggests the initialization sequence for Metal in the current runner is incompatible with the M5's GPU family (MTLGPUFamilyApple10). ### Relevant log output ```shell ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3 In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' "Input types must match cooperative tensor types" ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.20.7
GiteaMirror added the bug label 2026-04-22 20:23:37 -05:00
Author
Owner

@minhodongcollege commented on GitHub (Apr 15, 2026):

I had the same issue

<!-- gh-comment-id:4248806796 --> @minhodongcollege commented on GitHub (Apr 15, 2026): I had the same issue
Author
Owner

@icshih commented on GitHub (Apr 15, 2026):

I have the same issue, using models like gemma4 and ministral-3.

<!-- gh-comment-id:4249979996 --> @icshih commented on GitHub (Apr 15, 2026): I have the same issue, using models like gemma4 and ministral-3.
Author
Owner

@SamShmid commented on GitHub (Apr 15, 2026):

Same issue on all models

<!-- gh-comment-id:4253272077 --> @SamShmid commented on GitHub (Apr 15, 2026): Same issue on all models
Author
Owner

@SunnyDoraemon commented on GitHub (Apr 16, 2026):

I have the same issue

<!-- gh-comment-id:4258904268 --> @SunnyDoraemon commented on GitHub (Apr 16, 2026): I have the same issue
Author
Owner

@JyotiSheta commented on GitHub (Apr 16, 2026):

same issue but just for image models:

x/z-image-turbo:latest
x/flux2-klein:latest

<!-- gh-comment-id:4261267555 --> @JyotiSheta commented on GitHub (Apr 16, 2026): same issue but just for image models: x/z-image-turbo:latest x/flux2-klein:latest
Author
Owner

@zhouys0725 commented on GitHub (Apr 17, 2026):

这个可以尽快修复吗,这个问题导致在m5上完全使用不了 除非禁用它 launchctl setenv GGML_METAL_TENSOR_DISABLE 1

<!-- gh-comment-id:4264875219 --> @zhouys0725 commented on GitHub (Apr 17, 2026): 这个可以尽快修复吗,这个问题导致在m5上完全使用不了 除非禁用它 launchctl setenv GGML_METAL_TENSOR_DISABLE 1
Author
Owner

@SunnyDoraemon commented on GitHub (Apr 17, 2026):

这个可以尽快修复吗,这个问题导致在m5上完全使用不了 除非禁用它 launchctl setenv GGML_METAL_TENSOR_DISABLE 1

ollama降级后可用

<!-- gh-comment-id:4267370331 --> @SunnyDoraemon commented on GitHub (Apr 17, 2026): > 这个可以尽快修复吗,这个问题导致在m5上完全使用不了 除非禁用它 launchctl setenv GGML_METAL_TENSOR_DISABLE 1 ollama降级后可用
Author
Owner

@PureBlissAK commented on GitHub (Apr 18, 2026):

🤖 Automated Triage & Analysis Report

Issue: #15594
Analyzed: 2026-04-18T18:19:26.135310

Analysis

  • Type: unknown
  • Severity: medium
  • Components: unknown

Implementation Plan

  • Effort: medium
  • Steps:

This issue has been triaged and marked for implementation.

<!-- gh-comment-id:4274304863 --> @PureBlissAK commented on GitHub (Apr 18, 2026): <!-- ollama-issue-orchestrator:v1 issue:15594 --> ## 🤖 Automated Triage & Analysis Report **Issue**: #15594 **Analyzed**: 2026-04-18T18:19:26.135310 ### Analysis - **Type**: unknown - **Severity**: medium - **Components**: unknown ### Implementation Plan - **Effort**: medium - **Steps**: *This issue has been triaged and marked for implementation.*
Author
Owner

@andr0s commented on GitHub (Apr 19, 2026):

This MUST be high priority issue.

<!-- gh-comment-id:4275692134 --> @andr0s commented on GitHub (Apr 19, 2026): This MUST be high priority issue.
Author
Owner

@liefeld commented on GitHub (Apr 21, 2026):

Also a problem for me

<!-- gh-comment-id:4291277767 --> @liefeld commented on GitHub (Apr 21, 2026): Also a problem for me
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#35711