ggerganov commited on
Commit
9027276
·
unverified ·
1 Parent(s): d8bb9d8

metal : create autorelease pool during library build (llama/4970)

Browse files

* metal : create autorelease pool during library build

ggml-ci

* test : simplify

ggml-ci

Files changed (1) hide show
  1. ggml-metal.m +9 -10
ggml-metal.m CHANGED
@@ -306,22 +306,21 @@ static struct ggml_metal_context * ggml_metal_init(int n_cb) {
306
  return NULL;
307
  }
308
 
309
- // dictionary of preprocessor macros
310
- NSMutableDictionary * prep = [NSMutableDictionary dictionary];
 
311
 
312
  #ifdef GGML_QKK_64
313
- prep[@"QK_K"] = @(64);
314
  #endif
315
 
316
- MTLCompileOptions* options = [MTLCompileOptions new];
317
- options.preprocessorMacros = prep;
318
 
319
- //[options setFastMathEnabled:false];
320
 
321
- ctx->library = [ctx->device newLibraryWithSource:src options:options error:&error];
322
-
323
- [options release];
324
- [prep release];
325
  }
326
 
327
  if (error) {
 
306
  return NULL;
307
  }
308
 
309
+ @autoreleasepool {
310
+ // dictionary of preprocessor macros
311
+ NSMutableDictionary * prep = [NSMutableDictionary dictionary];
312
 
313
  #ifdef GGML_QKK_64
314
+ prep[@"QK_K"] = @(64);
315
  #endif
316
 
317
+ MTLCompileOptions* options = [MTLCompileOptions new];
318
+ options.preprocessorMacros = prep;
319
 
320
+ //[options setFastMathEnabled:false];
321
 
322
+ ctx->library = [ctx->device newLibraryWithSource:src options:options error:&error];
323
+ }
 
 
324
  }
325
 
326
  if (error) {