Skip to content

Commit f134d64

Browse files
committed
metal : use SWIFT_PACKAGE def instead of define GGML_SWIFT
1 parent 1b88cba commit f134d64

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*.gcno
1111
*.gcda
1212
*.dot
13+
*.metallib
1314
.DS_Store
1415
.build/
1516
.cache/

Package.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ let resources: [Resource] = [
1616
let additionalSources: [String] = ["ggml-metal.m"]
1717
let additionalSettings: [CSetting] = [
1818
.unsafeFlags(["-fno-objc-arc"]),
19-
.define("GGML_SWIFT"),
2019
.define("GGML_USE_METAL")
2120
]
2221
#else
2322
let platforms: [SupportedPlatform]? = nil
2423
let exclude: [String] = ["ggml-metal.metal"]
25-
let resources: [String] = []
24+
let resources: [Resource] = []
2625
let additionalSources: [String] = []
2726
let additionalSettings: [CSetting] = []
2827
#endif

ggml-metal.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void ggml_metal_log(enum ggml_log_level level, const char* format, ...){
186186
// load library
187187
{
188188
NSBundle * bundle = nil;
189-
#ifdef GGML_SWIFT
189+
#ifdef SWIFT_PACKAGE
190190
bundle = SWIFTPM_MODULE_BUNDLE;
191191
#else
192192
bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
@@ -204,7 +204,7 @@ static void ggml_metal_log(enum ggml_log_level level, const char* format, ...){
204204
GGML_METAL_LOG_INFO("%s: loading '%s'\n", __func__, [sourcePath UTF8String]);
205205
NSString * src = [NSString stringWithContentsOfFile:sourcePath encoding:NSUTF8StringEncoding error:&error];
206206
if (error) {
207-
GGML_METAL_LOG_INFO("%s: error: %s\n", __func__, [[error description] UTF8String]);
207+
GGML_METAL_LOG_ERROR("%s: error: %s\n", __func__, [[error description] UTF8String]);
208208
return NULL;
209209
}
210210

@@ -215,9 +215,9 @@ static void ggml_metal_log(enum ggml_log_level level, const char* format, ...){
215215
#endif
216216
ctx->library = [ctx->device newLibraryWithSource:src options:options error:&error];
217217
}
218-
218+
219219
if (error) {
220-
GGML_METAL_LOG_INFO("%s: error: %s\n", __func__, [[error description] UTF8String]);
220+
GGML_METAL_LOG_ERROR("%s: error: %s\n", __func__, [[error description] UTF8String]);
221221
return NULL;
222222
}
223223
}

0 commit comments

Comments
 (0)