Skip to content

Commit

Permalink
fix: fix metal build
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Mar 1, 2024
1 parent 807ee66 commit 64a36f1
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 21,438 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if (LLAMA_METAL)

message(STATUS "Metal framework found")
set(GGML_HEADERS_METAL ggml-metal.h)
set(GGML_SOURCES_METAL ggml-metal.m ggml_metal_file.c)
set(GGML_SOURCES_METAL ggml-metal.m)

add_compile_definitions(GGML_USE_METAL)
if (LLAMA_METAL_NDEBUG)
Expand Down
52 changes: 0 additions & 52 deletions embedfile.c

This file was deleted.

18 changes: 0 additions & 18 deletions ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@
bool should_capture_next_compute;
};

extern const char ggml_metal_file[];
extern const size_t ggml_metal_file_len;

// MSL code
// TODO: move the contents here when ready
// for now it is easier to work in a separate file
Expand Down Expand Up @@ -281,20 +278,6 @@ static void ggml_metal_log(enum ggml_log_level level, const char * format, ...){
id<MTLLibrary> metal_library;

// load library
#if 1
NSString * const msl_library_source = [[NSString alloc] initWithBytes: ggml_metal_file length: ggml_metal_file_len encoding: NSASCIIStringEncoding];
// compile from source string and show compile log
{
NSError * error = nil;

ctx->library = [ctx->device newLibraryWithSource:msl_library_source options:nil error:&error];
if (error) {
GGML_METAL_LOG_INFO("%s: error: %s\n", __func__, [[error description] UTF8String]);
return NULL;
}
}
[msl_library_source release];
#elif GGML_SWIFT
{
NSBundle * bundle = nil;
#ifdef SWIFT_PACKAGE
Expand Down Expand Up @@ -367,7 +350,6 @@ static void ggml_metal_log(enum ggml_log_level level, const char * format, ...){
}
}
}
#endif

// print MTL GPU family:
GGML_METAL_LOG_INFO("%s: GPU name: %s\n", __func__, [[ctx->device name] UTF8String]);
Expand Down
Loading

0 comments on commit 64a36f1

Please sign in to comment.