macOS: bump pinned llama.cpp to ≥ b10734 so the Metal tensor API works on M5 (prefill ~2.7× slower today)

未关闭
#1,107 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, go, macos
领域
backend

调研方向

The version pin lives in pkg/inference/backends/llamacpp/download.go (pinnedServerVersion) and the .versions file; the upstream fix is ggml-org/llama.cpp#27461, shipped in b10734. Confirm the newest published docker/docker-model-backend-llamacpp Metal tag is at or above b10734, since the bump depends on that build existing. Done means the pin is updated and the M5 log no longer shows the tensor-API disabled warning, which likely needs a maintainer to publish the build.

由索引模型根据 Issue 内容生成。

描述

Title: macOS: bump pinned llama.cpp to ≥ b10734 so the Metal tensor API works on M5 (prefill ~2.7× slower today)

Summary

On Apple M5 hosts, Docker Model Runner's pinned llama.cpp (b9879-metal) fails to enable the Metal tensor API (GPU Neural Accelerators) and falls back to the general-purpose shader path. Prompt processing runs at roughly ⅓ of what the same model file achieves with a current llama.cpp build on the same machine.

This is upstream llama.cpp issue ggml-org/llama.cpp#27473: the runtime Metal compile never sets MTLCompileOptions.languageVersion to 4.0, so the tensor-API probe fails with use of undeclared identifier 'mpp'. It was fixed in ggml-org/llama.cpp#27461, released in b10734.

#1104 bumps the vendored llama.cpp submodule to b12211, but pinnedServerVersion in pkg/inference/backends/llamacpp/download.go (and .versions) is still b9879. The newest Metal tag on docker/docker-model-backend-llamacpp is b9879-metal (latest-metal is older), so LLAMA_SERVER_VERSION cannot be used as a workaround.

Environment
  • Apple M5 Pro (16-core GPU), 48 GB, macOS 27.2.1
  • Docker Desktop 4.98.0, Docker Model Runner v1.2.9
  • Backend: llama.cpp b9879-metal (sha256:b70706f473b4043ca3e0c32704a7fda3412b83bceef0564684187b8011230de8), build 1 (72874f5) with AppleClang 17.0.0.17000013
  • Model: ai/llama3.1 8B Q4_K_M (sha256:c2d45031ad77…)
Observed

On every model load, ~/Library/Containers/com.docker.docker/Data/log/host/inference-llama.cpp-server.log:

E ggml_metal_library_init_from_source: error compiling source
W ggml_metal_device_init: - the tensor API is not supported in this environment - disabling
Measurements (same GGUF file, same host)

llama-bench -b 2048 -ub 2048 with Homebrew llama.cpp (build 12359, b1b770d90) against the GGUF in ~/.docker/models/bundles/sha256/c2d45031…/model/model.gguf, with DMR idle:

Test Native, tensor API on Native, GGML_METAL_TENSOR_DISABLE=1 DMR b9879-metal (server log)
Prefill, 2,048 tokens 1,055 tok/s 385 tok/s ~380 tok/s
Prefill, 7,168 tokens 905 tok/s 346 tok/s —
Decode, 128 tokens 55 tok/s — ~52–55 tok/s

Disabling the tensor API on the current build reproduces DMR's numbers exactly, so the gap is the tensor API alone.

End to end, on a prompt-heavy summarization workload (OpenAI-compatible /chat/completions, ~10:1 prompt:completion tokens), swapping DMR for a tensor-enabled llama-server serving the same GGUF with the same slot layout (-c 32768 -np 4 -kvu) cut wall time 1.49× at 1 concurrent request and 1.64× at 4.

Request

Publish a docker/docker-model-backend-llamacpp Metal build at ≥ b10734 and bump pinnedServerVersion so Docker Desktop on M5 picks it up. Pre-M5 Apple Silicon is unaffected (ggml disables the tensor path by chip name on those devices).

主要语言
Go
星标
662
派生
156
平均合并
15 小时 26 分钟
30 天内合并 PR
17

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

docker/model-runner 的其他 Issue

查看 docker/model-runner 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。