From 661777d636bf71181f2c8dff9ca2f7eadeee09d4 Mon Sep 17 00:00:00 2001 From: Iwan Kawrakow Date: Mon, 12 Jun 2023 13:07:10 +0300 Subject: [PATCH] metal : fix failure to load model 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. --- ggml-metal.m | 1 + 1 file changed, 1 insertion(+) diff --git a/ggml-metal.m b/ggml-metal.m index 16a362fd75865..b73f51f24ebeb 100644 --- a/ggml-metal.m +++ b/ggml-metal.m @@ -86,6 +86,7 @@ @implementation GGMLMetalClass ctx->device = MTLCreateSystemDefaultDevice(); ctx->queue = [ctx->device newCommandQueue]; + ctx->n_buffers = 0; // determine if we can use MPS if (MPSSupportsMTLDevice(ctx->device)) {