aboutsummaryrefslogtreecommitdiff
path: root/ggml-metal.m
diff options
context:
space:
mode:
authorAndrei <abetlen@gmail.com>2023-06-10 10:47:34 -0400
committerGitHub <noreply@github.com>2023-06-10 17:47:34 +0300
commit303f5809f1b4ec49823dbe70cacd2124ec1d0df0 (patch)
tree0e1e6532b4b33e05a53453ed2093ad0a1a4dafef /ggml-metal.m
parent059e99066d95d73d1ca26c3375d47c0e35596229 (diff)
metal : fix issue with ggml-metal.metal path. Closes #1769 (#1782)
* Fix issue with ggml-metal.metal path * Add ggml-metal.metal as a resource for llama target * Update flake.nix metal kernel substitution
Diffstat (limited to 'ggml-metal.m')
-rw-r--r--ggml-metal.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/ggml-metal.m b/ggml-metal.m
index 167ebd4..16a362f 100644
--- a/ggml-metal.m
+++ b/ggml-metal.m
@@ -73,6 +73,12 @@ struct ggml_metal_context {
// for now it is easier to work in a separate file
static NSString * const msl_library_source = @"see metal.metal";
+// Here to assist with NSBundle Path Hack
+@interface GGMLMetalClass : NSObject
+@end
+@implementation GGMLMetalClass
+@end
+
struct ggml_metal_context * ggml_metal_init(void) {
fprintf(stderr, "%s: allocating\n", __func__);
@@ -108,7 +114,8 @@ struct ggml_metal_context * ggml_metal_init(void) {
NSError * error = nil;
//NSString * path = [[NSBundle mainBundle] pathForResource:@"../../examples/metal/metal" ofType:@"metal"];
- NSString * path = [[NSBundle mainBundle] pathForResource:@"ggml-metal" ofType:@"metal"];
+ NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
+ NSString * path = [bundle pathForResource:@"ggml-metal" ofType:@"metal"];
fprintf(stderr, "%s: loading '%s'\n", __func__, [path UTF8String]);
NSString * src = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];