Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

1.2 KB
Raw Blame
A40 (GH #259, 3.1.2): upstream llama.cpp PR 31360, merge commit
c9daee149d606adc30b4c5b7a3254697c9771e2b (29.10.2026), backported onto b11960.
The Metal compiler of macOS 14 and 15 rejects these two constexpr bfloat
specializations (-Winvalid-constexpr), so the embedded unary library does not
build there and every model load dies in ggml_metal_init. macOS 26 accepts
them, which is why it only shows on older systems. Drop this patch once
LLAMA_COMMIT is at or past c9daee1.

--- a/ggml/src/ggml-metal/kernels/unary.metal
+++ b/ggml/src/ggml-metal/kernels/unary.metal
@@ -11,12 +11,12 @@ inline constexpr T ggml_metal_unary_cast(U x) {
 #if defined(GGML_METAL_HAS_BF16)
 // MSL has no C-style cast from float vectors to bfloat vectors
 template <>
-inline constexpr bfloat4 ggml_metal_unary_cast<bfloat4, float4>(float4 x) {
+inline bfloat4 ggml_metal_unary_cast<bfloat4, float4>(float4 x) {
     return bfloat4(bfloat(x[0]), bfloat(x[1]), bfloat(x[2]), bfloat(x[3]));
 }
 
 template <>
-inline constexpr bfloat4 ggml_metal_unary_cast<bfloat4, float>(float x) {
+inline bfloat4 ggml_metal_unary_cast<bfloat4, float>(float x) {
     return bfloat4(bfloat(x), bfloat(x), bfloat(x), bfloat(x));
 }
 #endif