Skip to content

Commit e6556fc

Browse files
committed
fix(release): correct metallib source — it ships in mlx-swift submodule, not built by swift build
default.metallib is a pre-built artifact inside the mlx-swift submodule at LocalPackages/mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/kernels/. It is not produced by swift build. Update CI search path from .build/ to LocalPackages/ (with full-repo fallback), and update README to reflect the correct clone and copy steps for building from source.
1 parent 2d6b174 commit e6556fc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ jobs:
7171
7272
- name: Find and copy default.metallib
7373
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)
74+
# default.metallib is a pre-built artifact shipped inside the
75+
# mlx-swift submodule — it is NOT produced by `swift build`.
76+
# Search the submodule tree for it (fallback to anywhere in repo).
77+
METALLIB=$(find LocalPackages -name "default.metallib" | head -1)
7878
if [ -z "$METALLIB" ]; then
79-
echo "ERROR: default.metallib not found in build artifacts!"
79+
METALLIB=$(find . -name "default.metallib" -not -path "./.git/*" | head -1)
80+
fi
81+
if [ -z "$METALLIB" ]; then
82+
echo "ERROR: default.metallib not found — is mlx-swift submodule checked out?"
8083
exit 1
8184
fi
8285
echo "Found metallib: $METALLIB"

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,19 @@ tar -xzf SwiftLM-<version>-macos-arm64.tar.gz
111111
### Build from Source
112112

113113
```bash
114+
# Must clone recursively — default.metallib ships inside the mlx-swift submodule
115+
git clone --recursive https://github.com/SharpAI/SwiftLM
116+
cd SwiftLM
114117
swift build -c release
115118
```
116119

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:
120+
`default.metallib` is a pre-built artifact inside the `mlx-swift` submodule at:
121+
`LocalPackages/mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/kernels/default.metallib`
122+
123+
Copy it next to the binary before running:
118124

119125
```bash
126+
cp LocalPackages/mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/kernels/default.metallib .build/release/
120127
.build/release/SwiftLM \
121128
--model mlx-community/Qwen3.5-122B-A10B-4bit \
122129
--stream-experts \

0 commit comments

Comments
 (0)