Skip to content

Commit 63a83ff

Browse files
committed
metal: fix regression when no metal devices are present
Otherwise, metal initialization segfaults. This situation was fixed before in acd38ef. Regression was introduced in bf9087f.
1 parent 710dfc4 commit 63a83ff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml/src/ggml-metal/ggml-metal.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@
9292

9393
if (ctx->mtl_device == nil) {
9494
ctx->mtl_device = MTLCreateSystemDefaultDevice();
95+
}
9596

97+
// There may be still no Metal device available
98+
if (ctx->mtl_device) {
9699
ctx->has_simdgroup_reduction = [ctx->mtl_device supportsFamily:MTLGPUFamilyApple7];
97100
ctx->has_simdgroup_reduction |= [ctx->mtl_device supportsFamily:MTLGPUFamilyMetal3_GGML];
98101

0 commit comments

Comments
 (0)