metal : try to fix BF16 support check

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-11-06 19:19:06 +02:00
parent ad1226982f
commit 69698299ee
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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<bfloat, 4, 4> bfloat4x4;
#endif