Skip to content

Commit 2d6b174

Browse files
committed
fix(release): bundle default.metallib in release tarball
- Add 'Find and copy default.metallib' step to capture the freshly compiled metallib from .build/ artifacts (built against macOS 15 SDK) - Package step now includes default.metallib alongside the binary so the tarball is fully self-contained on any Apple Silicon Mac - Hard-fail the release if metallib is not found in build artifacts - Update README Quick Start: document metallib co-location requirement, add Metal GPU error callout with fix, correct --stream-experts flag syntax - Fix release notes Quick Start snippet to reflect bundled metallib
1 parent 11e7078 commit 2d6b174

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,29 @@ jobs:
6969
file .build/release/SwiftLM
7070
.build/release/SwiftLM --help || true
7171
72+
- name: Find and copy default.metallib
73+
run: |
74+
# The Metal shader library is compiled as part of mlx-swift during
75+
# `swift build`. Find it in the build artifacts and copy it to the
76+
# repo root so the package step can pick it up.
77+
METALLIB=$(find .build -name "default.metallib" | head -1)
78+
if [ -z "$METALLIB" ]; then
79+
echo "ERROR: default.metallib not found in build artifacts!"
80+
exit 1
81+
fi
82+
echo "Found metallib: $METALLIB"
83+
cp "$METALLIB" default.metallib
84+
file default.metallib
85+
7286
- name: Package binary
7387
run: |
7488
mkdir -p release
7589
cp .build/release/SwiftLM release/
90+
cp default.metallib release/
7691
cp LICENSE README.md release/
7792
cd release
93+
# Verify the tarball will be self-contained before archiving
94+
ls -lh
7895
tar -czvf ../SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz .
7996
8097
- name: Upload artifact
@@ -110,10 +127,11 @@ jobs:
110127
### Quick Start
111128
```bash
112129
tar -xzf SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
130+
# default.metallib is included — run from the extracted directory
113131
./SwiftLM --model mlx-community/Qwen2.5-3B-Instruct-4bit --port 5413
114132
```
115133
116-
> **Note:** Requires `mlx.metallib` next to the binary for GPU compute. See [README](https://github.com/SharpAI/SwiftLM#metal-shader-library) for setup.
134+
> **Note:** `default.metallib` is bundled in this archive. Keep it in the same directory as the `SwiftLM` binary — Metal GPU compute will fail if it is missing.
117135
RELEASE_EOF
118136
119137
- name: Create release

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,35 @@ Then in Xcode:
9595
## 🛠️ Quick Start (macOS Server)
9696

9797
### Fastest: Download Pre-built Binary
98-
The absolute fastest way to get started is to [download the latest pre-compiled macOS binary](https://github.com/SharpAI/SwiftLM/releases) directly from the Releases page. Just extract it and run!
98+
99+
Download the latest release tarball from the [Releases page](https://github.com/SharpAI/SwiftLM/releases).
100+
The archive is **self-contained**`default.metallib` is bundled alongside the binary.
101+
102+
```bash
103+
tar -xzf SwiftLM-<version>-macos-arm64.tar.gz
104+
105+
# Run from the extracted directory — default.metallib must be co-located with the binary
106+
./SwiftLM --model mlx-community/Qwen2.5-3B-Instruct-4bit --port 5413
107+
```
108+
109+
> **⚠️ Metal GPU Error?** If you see `Failed to load the default metallib`, it means `default.metallib` is missing from the directory you are running `SwiftLM` from. Make sure you run the binary **from the extracted folder** and do not move the binary without also moving `default.metallib` alongside it.
99110
100111
### Build from Source
101112

102113
```bash
103114
swift build -c release
104115
```
105116

106-
### Run (Downloads model natively on first launch)
117+
When building from source the Metal shader library is compiled automatically by the Swift build system and placed next to the binary in `.build/release/`. Run from that directory:
107118

108119
```bash
109120
.build/release/SwiftLM \
110-
--model Qwen3.5-122B-A10B-4bit \
111-
--stream-experts true \
121+
--model mlx-community/Qwen3.5-122B-A10B-4bit \
122+
--stream-experts \
112123
--port 5413
113124
```
114125

115-
*(Note: Add `--stream-experts=true` if you are attempting to run oversized MoE models like Qwen3.5 122B to bypass macOS virtual memory swapping!)*
126+
*(Add `--stream-experts` when running oversized MoE models like Qwen3.5 122B to bypass macOS virtual memory swapping and stream expert layers directly from NVMe.)*
116127

117128
---
118129

0 commit comments

Comments
 (0)