diff --git a/ggml/src/ggml-metal.m b/ggml/src/ggml-metal.m index 6cbe88170..620238045 100644 --- a/ggml/src/ggml-metal.m +++ b/ggml/src/ggml-metal.m @@ -496,10 +496,6 @@ static struct ggml_backend_metal_context * ggml_metal_init(ggml_backend_dev_t de // dictionary of preprocessor macros NSMutableDictionary * prep = [NSMutableDictionary dictionary]; - if (!ctx_dev->has_bfloat) { - [prep setObject:@"GGML_METAL_NO_BFLOAT" forKey:@"GGML_METAL_NO_BFLOAT"]; - } - MTLCompileOptions * options = [MTLCompileOptions new]; options.preprocessorMacros = prep; diff --git a/ggml/src/ggml-metal.metal b/ggml/src/ggml-metal.metal index accdaaa6d..2004a6379 100644 --- a/ggml/src/ggml-metal.metal +++ b/ggml/src/ggml-metal.metal @@ -12,6 +12,10 @@ using namespace metal; #define N_SIMDWIDTH 32 // assuming SIMD group size is 32 +#if !defined(__BFLT16_M_PI__) +#define GGML_METAL_NO_BFLOAT +#endif + #if !defined(GGML_METAL_NO_BFLOAT) typedef matrix bfloat4x4; #endif