]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
metal : fix failure to load model (#1817)
authorKawrakow <redacted>
Mon, 12 Jun 2023 11:31:36 +0000 (14:31 +0300)
committerGitHub <redacted>
Mon, 12 Jun 2023 11:31:36 +0000 (14:31 +0300)
The number of buffers in the ggml context was left unitialized.
This leads to sporadic failures to load the model on
startup. It is actually strange that the failure occurred so
infrequantly.

Co-authored-by: Iwan Kawrakow <redacted>
ggml-metal.m

index 16a362fd758654e82b58ae362f250ab7b3e9339c..b73f51f24ebeb8672e0c7c6bd5b5e987ab51a75a 100644 (file)
@@ -86,6 +86,7 @@ struct ggml_metal_context * ggml_metal_init(void) {
 
     ctx->device = MTLCreateSystemDefaultDevice();
     ctx->queue  = [ctx->device newCommandQueue];
+    ctx->n_buffers = 0;
 
     // determine if we can use MPS
     if (MPSSupportsMTLDevice(ctx->device)) {