Spaces:
Running
Running
metal : switch back to default.metallib (ggml/681)
Browse files- extra/sync-ggml.last +1 -1
- ggml-metal.m +3 -3
extra/sync-ggml.last
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
f96711108d55bdbbd277e6be07204dce6a94fb93
|
ggml-metal.m
CHANGED
|
@@ -258,14 +258,14 @@ struct ggml_metal_context * ggml_metal_init(int n_cb) {
|
|
| 258 |
bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
|
| 259 |
#endif
|
| 260 |
NSError * error = nil;
|
| 261 |
-
NSString * libPath = [bundle pathForResource:@"
|
| 262 |
if (libPath != nil) {
|
| 263 |
// pre-compiled library found
|
| 264 |
NSURL * libURL = [NSURL fileURLWithPath:libPath];
|
| 265 |
GGML_METAL_LOG_INFO("%s: loading '%s'\n", __func__, [libPath UTF8String]);
|
| 266 |
ctx->library = [ctx->device newLibraryWithURL:libURL error:&error];
|
| 267 |
} else {
|
| 268 |
-
GGML_METAL_LOG_INFO("%s:
|
| 269 |
|
| 270 |
NSString * sourcePath;
|
| 271 |
NSString * ggmlMetalPathResources = [[NSProcessInfo processInfo].environment objectForKey:@"GGML_METAL_PATH_RESOURCES"];
|
|
@@ -295,7 +295,7 @@ struct ggml_metal_context * ggml_metal_init(int n_cb) {
|
|
| 295 |
#endif
|
| 296 |
// try to disable fast-math
|
| 297 |
// NOTE: this seems to have no effect whatsoever
|
| 298 |
-
// instead, in order to disable fast-math, we have to build
|
| 299 |
// using xcrun -sdk macosx metal -fno-fast-math -c ggml-metal.metal -o ggml-metal.air
|
| 300 |
// and go through the "pre-compiled library found" path above
|
| 301 |
//[options setFastMathEnabled:false];
|
|
|
|
| 258 |
bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
|
| 259 |
#endif
|
| 260 |
NSError * error = nil;
|
| 261 |
+
NSString * libPath = [bundle pathForResource:@"default" ofType:@"metallib"];
|
| 262 |
if (libPath != nil) {
|
| 263 |
// pre-compiled library found
|
| 264 |
NSURL * libURL = [NSURL fileURLWithPath:libPath];
|
| 265 |
GGML_METAL_LOG_INFO("%s: loading '%s'\n", __func__, [libPath UTF8String]);
|
| 266 |
ctx->library = [ctx->device newLibraryWithURL:libURL error:&error];
|
| 267 |
} else {
|
| 268 |
+
GGML_METAL_LOG_INFO("%s: default.metallib not found, loading from source\n", __func__);
|
| 269 |
|
| 270 |
NSString * sourcePath;
|
| 271 |
NSString * ggmlMetalPathResources = [[NSProcessInfo processInfo].environment objectForKey:@"GGML_METAL_PATH_RESOURCES"];
|
|
|
|
| 295 |
#endif
|
| 296 |
// try to disable fast-math
|
| 297 |
// NOTE: this seems to have no effect whatsoever
|
| 298 |
+
// instead, in order to disable fast-math, we have to build default.metallib from the command line
|
| 299 |
// using xcrun -sdk macosx metal -fno-fast-math -c ggml-metal.metal -o ggml-metal.air
|
| 300 |
// and go through the "pre-compiled library found" path above
|
| 301 |
//[options setFastMathEnabled:false];
|