Spaces:
Running
Running
metal : create autorelease pool during library build (llama/4970)
Browse files* metal : create autorelease pool during library build
ggml-ci
* test : simplify
ggml-ci
- 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 |
-
|
| 310 |
-
|
|
|
|
| 311 |
|
| 312 |
#ifdef GGML_QKK_64
|
| 313 |
-
|
| 314 |
#endif
|
| 315 |
|
| 316 |
-
|
| 317 |
-
|
| 318 |
|
| 319 |
-
|
| 320 |
|
| 321 |
-
|
| 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) {
|