Skip to content
Merged
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
15 changes: 14 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ let package = Package(
.library(name: "DFlash", targets: ["DFlash"]),
.executable(name: "SwiftLM", targets: ["SwiftLM"]),
.executable(name: "SwiftBuddy", targets: ["SwiftBuddy"]),
.executable(name: "DFlashKernelBench", targets: ["DFlashKernelBench"])
.executable(name: "DFlashKernelBench", targets: ["DFlashKernelBench"]),
.executable(name: "Gemma4MTPBench", targets: ["Gemma4MTPBench"])
],
dependencies: [
// Local Apple MLX Swift fork for C++ extensions
Expand Down Expand Up @@ -53,6 +54,18 @@ let package = Package(
],
path: "Sources/DFlashKernelBench"
),
// ── Gemma4 MTP Speculative Decoding Benchmark ───────────────
.executableTarget(
name: "Gemma4MTPBench",
dependencies: [
"MLXInferenceCore",
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXLLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
path: "Sources/Gemma4MTPBench"
),
// ── STFT Audio Profiling Testing Script (macOS only) ───────────
.executableTarget(
name: "SwiftLMTestSTFT",
Expand Down
2 changes: 1 addition & 1 deletion mlx-swift
33 changes: 33 additions & 0 deletions scripts/bootstrap_local_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Makes `swift test` runnable locally without CI's help.
#
# A bare `swift test` aborts with "Failed to load the default metallib"
# because Package.swift links MLX but nothing on a local machine ever builds
# or installs mlx.metallib. CI works around this in .github/workflows/ci.yml
# ("Install MLX Metal library" step) by pip-installing the `mlx` wheel and
# copying its bundled metallib into every built .xctest bundle. This script
# does the same thing locally.
set -eo pipefail

VENV_DIR="${MLX_METALLIB_VENV:-/tmp/swiftlm_mlx_venv}"

echo "=> Building test harness (swift build --build-tests)..."
swift build --build-tests

echo "=> Installing MLX Metal library..."
if [ ! -d "$VENV_DIR" ]; then
python3 -m venv "$VENV_DIR"
fi
"$VENV_DIR/bin/pip" install --quiet --upgrade mlx

METALLIB=$(find "$VENV_DIR" -name "mlx.metallib" | head -1)
if [ -z "$METALLIB" ]; then
echo "error: mlx.metallib not found after pip install mlx" >&2
exit 1
fi

cp "$METALLIB" .build/debug/ 2>/dev/null || true
cp "$METALLIB" .build/release/ 2>/dev/null || true
find .build -type d -name "MacOS" -exec cp "$METALLIB" {}/ \;

echo "=> Done. Run tests with: swift test --skip-build"
Loading