From 4af03de2a6e962aaa9984a156ebf44cde60b0f86 Mon Sep 17 00:00:00 2001 From: Paul Tsochantaris Date: Mon, 7 Oct 2024 12:21:28 +0100 Subject: [PATCH] Release encode block when re-setting encoding buffer count if needed --- ggml/src/ggml-metal.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ggml/src/ggml-metal.m b/ggml/src/ggml-metal.m index f1b4b8e87..923bcf0b4 100644 --- a/ggml/src/ggml-metal.m +++ b/ggml/src/ggml-metal.m @@ -3428,6 +3428,10 @@ static void ggml_backend_metal_set_n_cb(ggml_backend_t backend, int n_cb) { } } + if(ctx->encode_async) { + Block_release(ctx->encode_async); + } + ctx->encode_async = Block_copy(^(size_t iter) { const int cb_idx = iter; const int n_cb_l = ctx->n_cb;