Skip to content

Commit 2d33315

Browse files
singularity-s0ggerganov
authored andcommitted
llama.swiftui : fix build of ggml.metallib (#4754)
* metal: fix metal backend init failure in swiftui * metal: build ggml.metallib instead of copy src * llama.swift : remove debug flags from metallib build --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 2f4c8ab commit 2d33315

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

examples/llama.swiftui/llama.swiftui.xcodeproj/project.pbxproj

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
542376082B0D9BFB008E6A1C /* ggml-quants.c in Sources */ = {isa = PBXBuildFile; fileRef = 542376072B0D9BFB008E6A1C /* ggml-quants.c */; settings = {COMPILER_FLAGS = "-O3"; }; };
1111
5423760B2B0D9C4B008E6A1C /* ggml-backend.c in Sources */ = {isa = PBXBuildFile; fileRef = 5423760A2B0D9C4B008E6A1C /* ggml-backend.c */; settings = {COMPILER_FLAGS = "-O3"; }; };
12-
542378792ACE3F3500834A7B /* ggml-metal.metal in Resources */ = {isa = PBXBuildFile; fileRef = 549479C82AC9E10B00E0F78B /* ggml-metal.metal */; };
1312
542EA09D2AC8723900A8AEE9 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = 542EA09B2AC8723900A8AEE9 /* ggml.c */; settings = {COMPILER_FLAGS = "-DGGML_USE_ACCELERATE -DGGML_USE_METAL -DGGML_USE_K_QUANTS -O3"; }; };
1413
542EA0A02AC8725700A8AEE9 /* ggml-alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 542EA09F2AC8725700A8AEE9 /* ggml-alloc.c */; settings = {COMPILER_FLAGS = "-O3"; }; };
1514
542EA0A32AC8729100A8AEE9 /* llama.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 542EA0A12AC8729100A8AEE9 /* llama.cpp */; settings = {COMPILER_FLAGS = "-DGGML_USE_K_QUANTS -DGGML_USE_METAL -O3"; }; };
@@ -24,8 +23,25 @@
2423
8A3F84242AC4C891005E2EE8 /* models in Resources */ = {isa = PBXBuildFile; fileRef = 8A3F84232AC4C891005E2EE8 /* models */; };
2524
8A907F332AC7138A006146EA /* LibLlama.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A907F322AC7134E006146EA /* LibLlama.swift */; };
2625
8A9F7C4D2AC332EE008AE1EA /* LlamaState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9F7C4C2AC332EE008AE1EA /* LlamaState.swift */; };
26+
F1FE20DC2B465C4500B45541 /* ggml-metal.metal in Resources */ = {isa = PBXBuildFile; fileRef = 549479C82AC9E10B00E0F78B /* ggml-metal.metal */; };
2727
/* End PBXBuildFile section */
2828

29+
/* Begin PBXBuildRule section */
30+
F1FE20DB2B465C2100B45541 /* PBXBuildRule */ = {
31+
isa = PBXBuildRule;
32+
compilerSpec = com.apple.compilers.proxy.script;
33+
fileType = sourcecode.metal;
34+
inputFiles = (
35+
);
36+
isEditable = 1;
37+
outputFiles = (
38+
"${DERIVED_FILES_DIR}/ggml-metal.air",
39+
"${DERIVED_FILES_DIR}/ggml.metallib",
40+
);
41+
script = "# metal\nxcrun metal -c \"${INPUT_FILE_PATH}\" -o \"${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.air\"\nxcrun metallib -o \"${DERIVED_FILES_DIR}/${INPUT_FILE_BASE%-metal}.metallib\" \"${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.air\"\n";
42+
};
43+
/* End PBXBuildRule section */
44+
2945
/* Begin PBXFileReference section */
3046
542376062B0D9BEA008E6A1C /* ggml-quants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-quants.h"; path = "../../ggml-quants.h"; sourceTree = "<group>"; };
3147
542376072B0D9BFB008E6A1C /* ggml-quants.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-quants.c"; path = "../../ggml-quants.c"; sourceTree = "<group>"; };
@@ -190,6 +206,7 @@
190206
8A1C83712AC328BD0096AF73 /* Resources */,
191207
);
192208
buildRules = (
209+
F1FE20DB2B465C2100B45541 /* PBXBuildRule */,
193210
);
194211
dependencies = (
195212
);
@@ -241,7 +258,7 @@
241258
isa = PBXResourcesBuildPhase;
242259
buildActionMask = 2147483647;
243260
files = (
244-
542378792ACE3F3500834A7B /* ggml-metal.metal in Resources */,
261+
F1FE20DC2B465C4500B45541 /* ggml-metal.metal in Resources */,
245262
8A3F84242AC4C891005E2EE8 /* models in Resources */,
246263
8A1C837E2AC328BE0096AF73 /* Preview Assets.xcassets in Resources */,
247264
8A1C837B2AC328BE0096AF73 /* Assets.xcassets in Resources */,

0 commit comments

Comments
 (0)