Skip to content

M5 Macs: llama.cpp runtime 2.21 fails Metal tensor-API check — Neural Accelerators unused, 2–3× prefill lost (GGUF; MLX nax pack unaffected) #2040

Description

@oooseun

Summary

On M5-generation Macs, LM Studio's llama.cpp runtime never enables the Metal 4 tensor API (GPU Neural Accelerators), even though the runtime's binaries contain the upstream tensor-API code. Every GGUF model load logs:

ggml_metal_device_init: - the tensor API is not supported in this environment - disabling

The same GGUF files on the same machine with an upstream llama.cpp release binary (b9592) pass the tensor-API check (has tensor = true) and deliver 2–3× faster prompt processing at identical generation speed. The MLX side is fine — the mlx-llm-mac-arm64-apple-metal-nax-advsimd pack targets M5 and uses the accelerators. Only the GGUF/llama.cpp runtime misses them.

Environment

  • MacBook Pro, M5 Max (40-core GPU), 128 GB, macOS 26.5 (25F71)
  • LM Studio / lms 0.4.14+4
  • Runtime: llama.cpp-mac-arm64-apple-metal-advsimd@2.21.0 (newest on stable and beta as of 2026-06-11)

Evidence

1. The runtime contains the tensor-API codestrings on the shipped libggml-metal.dylib includes GGML_METAL_TENSOR_DISABLE, testing tensor API for f16 support, tensor API disabled for pre-M5 and pre-A19 devices, etc. So this is not an old llama.cpp snapshot; the runtime runs the environment self-test and fails it. A plausible cause is the bundled/prebuilt Metal library being compiled against a pre-Metal-4 SDK or deployment target, so the tensor-op test kernels fail to compile at init.

2. Upstream llama.cpp on the same machine passes the check. Release b9592 (stock macOS arm64 binary, no rebuild) logs has tensor = true on M5 Max.

3. A/B on the same model files (llama-bench -fa 1 -p 2048 -n 128 -r 2; tensor API toggled via GGML_METAL_TENSOR_DISABLE=1):

Model (GGUF) tensor OFF (≈ LM Studio behavior) tensor ON delta
gpt-oss-120b MXFP4 — pp2048 877 t/s 1,833 t/s 2.09×
gpt-oss-120b — tg128 104.9 105.1 unchanged
Step-3.7-Flash IQ3_XXS — pp2048 342 t/s 833 t/s 2.44×
Step-3.7-Flash — tg128 58.2 56.0 unchanged (within noise)

LM Studio's own serving path measures in line with the "tensor OFF" column or below (e.g. ~270 t/s prefill for Step-3.7-Flash via the REST API at ~3.3k-token prompts).

Generation speed is unaffected (memory-bandwidth-bound), so this is invisible in casual chat — but time-to-first-token on long prompts, RAG, and agentic/tool-call workloads is 2–3× slower than the hardware can do.

Expected behavior

The llama.cpp runtime enables the Metal tensor API on M5-family devices running macOS ≥ 26.2, matching upstream llama.cpp defaults (upstream PR ggml-org/llama.cpp#16634) — or ships an M5-targeted pack the way the MLX nax pack already does.

Repro

  1. Any M5/M5 Pro/M5 Max Mac on macOS ≥ 26.2, LM Studio with llama.cpp runtime 2.21.0.
  2. Load any GGUF model; check the server log for ggml_metal_device_init.
  3. Observe the tensor API is not supported in this environment - disabling.
  4. Compare prompt-processing speed against upstream llama-bench b9592 on the same file.

Happy to provide full logs or run diagnostics on this machine if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions