Eval bug: Metal BF16 shader fails to compile on macOS 15.5: invalid constexpr
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp, macos
- Domain
- backend, machine-learning
Research direction
Start by locating the two bfloat4 conversion specializations for ggml_metal_unary_cast in the Metal shader sources and review how they use constexpr. The report says removing constexpr from both specializations lets the Metal library compile and the model generate output; verify this on macOS 15.5 with the listed model, then confirm the Metal build and inference succeed.
Written by the indexing model from the issue text.
Description
Name and Version
macOS 15.5 (24F74) and your Mac’s chip.
llama.cpp commit 522021325546ea322b0b1e58a50f9dbf03a5f197.
Model: LiquidAI LFM3-1.7B-BF16.gguf.
error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)
ggml_metal_init: error: failed to initialize the Metal library
Workaround tested: Removed constexpr from the two bfloat4 conversion specializations, keeping inline and both function bodies unchanged. Rebuilt llama-server.
Result: The model loaded with Metal and successfully generated READY in a short inference test.
Operating systems
Mac
GGML backends
Metal
Hardware
Model | MacBook Pro (Mac14,9)
Chip | Apple M2 Pro
CPU | 10 cores: 6 performance + 4 efficiency
GPU | 16 cores, Metal supported
Memory | 16 GB unified memory
Architecture | ARM64 / Apple Silicon
macOS | 15.5 (24F74)
Models
LiquidAI/LFM3-1.7B-GGUF
Problem description & steps to reproduce
Failure: Loading the model failed while compiling the Metal shader:
error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)
ggml_metal_init: error: failed to initialize the Metal library
First Bad Commit
No response
Relevant log output
Logs
constexpr function never produces a constant expression
[-Winvalid-constexpr]
inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)
ggml_metal_init: error: failed to initialize the Metal library
- Dominant language
- C++
- Stars
- 133k
- Forks
- 24.9k
- Avg merge
- 2d 52m
- Merged PRs (30d)
- 496
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ggml-org/llama.cpp
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Eval bug: Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every threadPossibly taken @SG-Amadeus claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ggml-org/llama.cpp#31163 · 3 comments ·
Maintainers usually reply within 1 day
-
Misc. bug: docs mention --spec-draft-conf-min, but that flag doesn't existPossibly taken @jajamabhijith claimed this 3 days ago. Openbug-unconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
All issues in ggml-org/llama.cpp
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 66/100
madskristensen/FileIcons#385 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/SysmonCommon#26 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
espressif/esp-matter#1913 ·
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
chipsalliance/verible#2644 ·