metal : create autorelease pool during library build (#4970)

* metal : create autorelease pool during library build

ggml-ci

* test : simplify

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-01-17 18:38:39 +02:00 committed by GitHub
parent 0f83e727af
commit c918fe8dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 45 additions and 11 deletions

View file

@ -303,22 +303,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) {