Skip to content

Commit ed53db8

Browse files
authored
metal : print error of load pipeline state (#2564)
* metal : print error of load pipeline state * metal : return null if load pipeline failed
1 parent fc8ef54 commit ed53db8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ggml-metal.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,15 @@ @implementation GGMLMetalClass
163163

164164
// load kernels
165165
{
166+
NSError * error = nil;
166167
#define GGML_METAL_ADD_KERNEL(name) \
167168
ctx->function_##name = [ctx->library newFunctionWithName:@"kernel_"#name]; \
168-
ctx->pipeline_##name = [ctx->device newComputePipelineStateWithFunction:ctx->function_##name error:nil]; \
169-
fprintf(stderr, "%s: loaded %-32s %16p\n", __func__, "kernel_"#name, (void *) ctx->pipeline_##name);
169+
ctx->pipeline_##name = [ctx->device newComputePipelineStateWithFunction:ctx->function_##name error:&error]; \
170+
fprintf(stderr, "%s: loaded %-32s %16p\n", __func__, "kernel_"#name, (void *) ctx->pipeline_##name); \
171+
if (error) { \
172+
fprintf(stderr, "%s: load pipeline error: %s\n", __func__, [[error description] UTF8String]); \
173+
return NULL; \
174+
}
170175

171176
GGML_METAL_ADD_KERNEL(add);
172177
GGML_METAL_ADD_KERNEL(add_row);

0 commit comments

Comments
 (0)