mirror of https://gitee.com/namelin2022/ollama
Browse Source
Support for bf16 was added in MacOS v14+ and attempting to enable on older versions causes runtime failures.mxyng/create-stdin
committed by
GitHub
3 changed files with 34 additions and 3 deletions
@ -0,0 +1,27 @@ |
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
|||
From: Daniel Hiltgen <daniel@ollama.com> |
|||
Date: Wed, 30 Jul 2025 08:43:46 -0700 |
|||
Subject: [PATCH] BF16 macos version guard |
|||
|
|||
Only enable BF16 on supported MacOS versions (v14+) |
|||
---
|
|||
ggml/src/ggml-metal/ggml-metal.m | 6 +++++- |
|||
1 file changed, 5 insertions(+), 1 deletion(-) |
|||
|
|||
diff --git a/ggml/src/ggml-metal/ggml-metal.m b/ggml/src/ggml-metal/ggml-metal.m
|
|||
index 110c9ece..ab46f6e3 100644
|
|||
--- a/ggml/src/ggml-metal/ggml-metal.m
|
|||
+++ b/ggml/src/ggml-metal/ggml-metal.m
|
|||
@@ -89,7 +89,11 @@
|
|||
ctx->has_bfloat |= [ctx->mtl_device supportsFamily:MTLGPUFamilyApple6]; |
|||
|
|||
#if defined(GGML_METAL_USE_BF16) |
|||
- ctx->use_bfloat = ctx->has_bfloat;
|
|||
+ if (@available(macOS 14.0, *)) {
|
|||
+ ctx->use_bfloat = ctx->has_bfloat;
|
|||
+ } else {
|
|||
+ ctx->use_bfloat = false;
|
|||
+ }
|
|||
#else |
|||
ctx->use_bfloat = false; |
|||
#endif |
|||
Loading…
Reference in new issue