From 97d62c1dbad7d9ee1e1f465941a3d334ee97b62f Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 29 Oct 2026 10:07:38 +0200 Subject: [PATCH] ggml-metal : fix unary kernels compile on older Metal toolchains Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB) --- ggml/src/ggml-metal/kernels/unary.metal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-metal/kernels/unary.metal b/ggml/src/ggml-metal/kernels/unary.metal index 8c2c18ebd6b3..9d24f028c399 100644 --- 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(float4 x) { +inline bfloat4 ggml_metal_unary_cast(float4 x) { return bfloat4(bfloat(x[0]), bfloat(x[1]), bfloat(x[2]), bfloat(x[3])); } template <> -inline constexpr bfloat4 ggml_metal_unary_cast(float x) { +inline bfloat4 ggml_metal_unary_cast(float x) { return bfloat4(bfloat(x), bfloat(x), bfloat(x), bfloat(x)); } #endif