Update ggml/src/ggml-metal/ggml-metal.m

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Robert Ormandi 2024-12-06 11:10:37 -06:00 committed by GitHub
parent 2df2d52d15
commit bcf86a9d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -509,9 +509,9 @@ static struct ggml_backend_metal_context * ggml_metal_init(ggml_backend_dev_t de
NSString * path_lib = [bundle pathForResource:@"default" ofType:@"metallib"]; NSString * path_lib = [bundle pathForResource:@"default" ofType:@"metallib"];
if (path_lib == nil) { if (path_lib == nil) {
// Try to find the resource in the directory where the current binary located. // Try to find the resource in the directory where the current binary located.
NSString *current_binary = [[NSProcessInfo processInfo] arguments][0]; NSString * current_binary = [[NSProcessInfo processInfo] arguments][0];
NSString *bin_dir = [current_binary stringByDeletingLastPathComponent]; NSString * bin_dir = [current_binary stringByDeletingLastPathComponent];
NSString *default_metallib_path = [NSString pathWithComponents:@[bin_dir, @"default.metallib"]]; NSString * default_metallib_path = [NSString pathWithComponents:@[bin_dir, @"default.metallib"]];
if ([[NSFileManager defaultManager] isReadableFileAtPath:default_metallib_path]) { if ([[NSFileManager defaultManager] isReadableFileAtPath:default_metallib_path]) {
GGML_LOG_INFO("%s: found '%s'\n", __func__, [default_metallib_path UTF8String]); GGML_LOG_INFO("%s: found '%s'\n", __func__, [default_metallib_path UTF8String]);
NSDictionary *atts = [[NSFileManager defaultManager] attributesOfItemAtPath:default_metallib_path error:&error]; NSDictionary *atts = [[NSFileManager defaultManager] attributesOfItemAtPath:default_metallib_path error:&error];