From: Georgi Gerganov Date: Wed, 17 Jan 2024 16:38:39 +0000 (+0200) Subject: metal : create autorelease pool during library build (llama/4970) X-Git-Tag: upstream/1.7.4~1100 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=2fe5fbfcc22516ccd40e71d0e389ad5738386f21;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp metal : create autorelease pool during library build (llama/4970) * metal : create autorelease pool during library build ggml-ci * test : simplify ggml-ci --- diff --git a/ggml-metal.m b/ggml-metal.m index 44134d1d..4482cb0e 100644 --- a/ggml-metal.m +++ b/ggml-metal.m @@ -306,22 +306,21 @@ static struct ggml_metal_context * ggml_metal_init(int n_cb) { return NULL; } - // dictionary of preprocessor macros - NSMutableDictionary * prep = [NSMutableDictionary dictionary]; + @autoreleasepool { + // dictionary of preprocessor macros + NSMutableDictionary * prep = [NSMutableDictionary dictionary]; #ifdef GGML_QKK_64 - prep[@"QK_K"] = @(64); + prep[@"QK_K"] = @(64); #endif - MTLCompileOptions* options = [MTLCompileOptions new]; - options.preprocessorMacros = prep; + MTLCompileOptions* options = [MTLCompileOptions new]; + options.preprocessorMacros = prep; - //[options setFastMathEnabled:false]; + //[options setFastMathEnabled:false]; - ctx->library = [ctx->device newLibraryWithSource:src options:options error:&error]; - - [options release]; - [prep release]; + ctx->library = [ctx->device newLibraryWithSource:src options:options error:&error]; + } } if (error) {