Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
./run_tests.sh

build-ios-from-source:
runs-on: macos-latest
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
npm run build:ios

build-ios-frameworks:
runs-on: macos-latest
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

publish:
needs: build-android
runs-on: macos-latest
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -70,5 +70,5 @@ jobs:
- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_1Y }}
SKIP_ANDROID_BUILD: "1"
SKIP_ANDROID_BUILD: '1'
run: npm publish
2 changes: 1 addition & 1 deletion .github/workflows/sync-llama-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
sync:
runs-on: macos-15
runs-on: macos-26

steps:
- name: Checkout repository
Expand Down
4 changes: 4 additions & 0 deletions cpp/ggml-metal/ggml-metal-device.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ lm_ggml_metal_library_t lm_ggml_metal_library_init(lm_ggml_metal_device_t dev) {
#endif

#if TARGET_OS_SIMULATOR
NSString *lib_name = @"ggml-llama-sim";
if (lm_ggml_metal_device_get_props(dev)->has_tensor) lib_name = @"ggml-llama-sim-metal4";
NSString * path_lib = [bundle pathForResource:@"ggml-llama-sim" ofType:@"metallib"];
#else
NSString *lib_name = @"ggml-llama";
if (lm_ggml_metal_device_get_props(dev)->has_tensor) lib_name = @"ggml-llama-metal4";
NSString * path_lib = [bundle pathForResource:@"ggml-llama" ofType:@"metallib"];
#endif
if (path_lib == nil) {
Expand Down
10 changes: 10 additions & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,21 @@ if [ "$OS" = "Darwin" ]; then
xcrun --sdk iphoneos metallib ggml-metal.air -o ggml-llama.metallib
rm ggml-metal.air
mv ./ggml-llama.metallib "$CPP_DIR/ggml-metal/ggml-llama.metallib"
# metal4
xcrun --sdk iphoneos metal -O3 -std=metal4.0 -mios-version-min=26.0 -c ggml-metal.metal -o ggml-metal.air -DGGML_METAL_HAS_BF16=1 -DGGML_METAL_HAS_TENSOR=1
xcrun --sdk iphoneos metallib ggml-metal.air -o ggml-llama-metal4.metallib
rm ggml-metal.air
mv ./ggml-llama-metal4.metallib "$CPP_DIR/ggml-metal/ggml-llama-metal4.metallib"

xcrun --sdk iphonesimulator metal -O3 -std=metal3.2 -mios-version-min=16.0 -c ggml-metal.metal -o ggml-metal.air -DGGML_METAL_HAS_BF16=1
xcrun --sdk iphonesimulator metallib ggml-metal.air -o ggml-llama.metallib
rm ggml-metal.air
mv ./ggml-llama.metallib "$CPP_DIR/ggml-metal/ggml-llama-sim.metallib"
# metal4
xcrun --sdk iphonesimulator metal -O3 -std=metal4.0 -mios-version-min=26.0 -c ggml-metal.metal -o ggml-metal.air -DGGML_METAL_HAS_BF16=1 -DGGML_METAL_HAS_TENSOR=1
xcrun --sdk iphonesimulator metallib ggml-metal.air -o ggml-llama-metal4.metallib
rm ggml-metal.air
mv ./ggml-llama-metal4.metallib "$CPP_DIR/ggml-metal/ggml-llama-sim-metal4.metallib"

# Remove the symbolic link
rm ggml-common.h
Expand Down
2 changes: 2 additions & 0 deletions scripts/build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function build_framework() {
# TODO: May need to re-build metallib for tvOS
if [ "$4" == "ios-arm64_x86_64-simulator" ] || [ "$4" == "tvos-arm64_x86_64-simulator" ]; then
cp ../cpp/ggml-metal/ggml-llama-sim.metallib ../ios/rnllama.xcframework/$4/rnllama.framework/ggml-llama-sim.metallib
cp ../cpp/ggml-metal/ggml-llama-sim-metal4.metallib ../ios/rnllama.xcframework/$4/rnllama.framework/ggml-llama-sim-metal4.metallib
else
cp ../cpp/ggml-metal/ggml-llama.metallib ../ios/rnllama.xcframework/$4/rnllama.framework/ggml-llama.metallib
cp ../cpp/ggml-metal/ggml-llama-metal4.metallib ../ios/rnllama.xcframework/$4/rnllama.framework/ggml-llama-metal4.metallib
fi

rm -rf ./*
Expand Down
10 changes: 7 additions & 3 deletions scripts/patches/ggml-metal-device.m.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
--- ggml-metal-device.m.orig 2025-09-18 14:50:43
+++ ggml-metal-device.m 2025-09-18 14:50:16
@@ -171,7 +171,11 @@
--- ggml-metal-device.m.orig 2025-11-10 17:26:40
+++ ggml-metal-device.m 2025-11-10 17:22:40
@@ -181,7 +181,15 @@
NSBundle * bundle = [NSBundle bundleForClass:[LMGGMLMetalClass class]];
#endif

- NSString * path_lib = [bundle pathForResource:@"default" ofType:@"metallib"];
+#if TARGET_OS_SIMULATOR
+ NSString *lib_name = @"ggml-llama-sim";
+ if (lm_ggml_metal_device_get_props(dev)->has_tensor) lib_name = @"ggml-llama-sim-metal4";
+ NSString * path_lib = [bundle pathForResource:@"ggml-llama-sim" ofType:@"metallib"];
+#else
+ NSString *lib_name = @"ggml-llama";
+ if (lm_ggml_metal_device_get_props(dev)->has_tensor) lib_name = @"ggml-llama-metal4";
+ NSString * path_lib = [bundle pathForResource:@"ggml-llama" ofType:@"metallib"];
+#endif
if (path_lib == nil) {
Expand Down
Loading