Repository navigation
🔄 Auto-Sync: Upstream changes from ml-explore/mlx-swift #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SwiftLM Integration Tests | |
| on: [pull_request, push] | |
| jobs: | |
| integration-test: | |
| name: Build & Test SwiftLM | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout mlx-swift (this repository) | |
| uses: actions/checkout@v4 | |
| with: | |
| path: mlx-swift | |
| submodules: recursive | |
| - name: Checkout SwiftLM | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: SharpAI/SwiftLM | |
| path: SwiftLM | |
| submodules: recursive | |
| - name: Redirect Dependencies to Local Form | |
| run: | | |
| # Point SwiftLM to the local checkout of mlx-swift PR branch | |
| sed -i '' -E 's|\.package\(url: "https://github.com/SharpAI/mlx-swift\.git".*|\.package(path: "../mlx-swift"),|' SwiftLM/Package.swift | |
| sed -i '' -E 's|\.package\(url: "https://github.com/ml-explore/mlx-swift\.git".*|\.package(path: "../mlx-swift"),|' SwiftLM/Package.swift | |
| # Point the inner mlx-swift-lm submodule to the local checkout of mlx-swift PR branch | |
| sed -i '' -E 's|\.package\(url: "https://github.com/SharpAI/mlx-swift\.git".*|\.package(path: "../../mlx-swift"),|' SwiftLM/mlx-swift-lm/Package.swift | |
| sed -i '' -E 's|\.package\(url: "https://github.com/ml-explore/mlx-swift\.git".*|\.package(path: "../../mlx-swift"),|' SwiftLM/mlx-swift-lm/Package.swift | |
| - name: Build SwiftLM | |
| run: | | |
| cd SwiftLM | |
| swift build -c release | |
| - name: Compile MLX Metal library from source | |
| run: | | |
| KERNELS_DIR="mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/kernels" | |
| OUT_DIR="SwiftLM/.build/release" | |
| mkdir -p /tmp/mlx_air | |
| # Compile every .metal file to .air | |
| find "$KERNELS_DIR" -name "*.metal" | while read f; do | |
| name=$(basename "$f" .metal) | |
| xcrun metal -sdk macosx \ | |
| -I "mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/kernels" \ | |
| -c "$f" -o "/tmp/mlx_air/${name}.air" 2>/dev/null || true | |
| done | |
| # Link all .air files into mlx.metallib | |
| AIR_FILES=$(find /tmp/mlx_air -name "*.air") | |
| if [ -n "$AIR_FILES" ]; then | |
| xcrun metallib $AIR_FILES -o "$OUT_DIR/mlx.metallib" | |
| echo "Built mlx.metallib -> $OUT_DIR/mlx.metallib" | |
| else | |
| echo "ERROR: No .air files produced — Metal compilation failed" | |
| exit 1 | |
| fi | |
| - name: Run Speculative Decoding Tests | |
| run: | | |
| cd SwiftLM | |
| bash tests/test-speculative-eval.sh |