Skip to content

Commit bf9e87e

Browse files
authored
Merge pull request #5 from SharpAI/feature/api-parity-roadmap
Feature/api parity roadmap
2 parents 50b6e71 + 01df003 commit bf9e87e

File tree

1,862 files changed

+577438
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,862 files changed

+577438
-616
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, develop, feature/*]
66
pull_request:
77
branches: [main]
88

@@ -11,24 +11,43 @@ jobs:
1111
runs-on: macos-15
1212
steps:
1313
- uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
1416

1517
- name: Install Metal Toolchain
1618
run: xcodebuild -downloadComponent MetalToolchain || true
1719

20+
- name: Cache Swift packages
21+
uses: actions/cache@v4
22+
with:
23+
path: .build
24+
# Key includes product name so any rename (e.g. mlx-server→SwiftLM)
25+
# automatically busts the cache and prevents stale PCH errors.
26+
key: ${{ runner.os }}-spm-SwiftLM-${{ hashFiles('Package.resolved') }}
27+
restore-keys: |
28+
${{ runner.os }}-spm-SwiftLM-
29+
1830
- name: Resolve dependencies
1931
run: swift package resolve
2032

33+
- name: Clear stale module cache
34+
# Prevents: "PCH was compiled with module cache path '…mlx-server…'
35+
# but the path is currently '…SwiftLM…'" after repo rename.
36+
run: find .build -type d -name ModuleCache -exec rm -rf {} + 2>/dev/null || true
37+
2138
- name: Build (Release)
2239
run: swift build -c release
2340

2441
- name: Verify binary
2542
run: |
26-
ls -lh .build/release/mlx-server
27-
file .build/release/mlx-server
43+
ls -lh .build/release/SwiftLM
44+
file .build/release/SwiftLM
2845
29-
- name: Upload binary
30-
uses: actions/upload-artifact@v4
31-
with:
32-
name: mlx-server-arm64
33-
path: .build/release/mlx-server
34-
retention-days: 30
46+
- name: TurboQuant unit tests
47+
run: |
48+
# Compile and run standalone C++ unit tests for the TurboQuant
49+
# KV cache compression algorithm (ported from TheTom/llama-cpp-turboquant).
50+
# Tests: centroids, WHT self-inverse, rotation orthogonality,
51+
# 3-bit pack/unpack, V-cache SNR, K-cache IP SNR, fp16 round-trip.
52+
clang++ -std=c++17 -O2 -o /tmp/tq_test tests/test_turbo_quant.cpp
53+
/tmp/tq_test

.github/workflows/e2e-test.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches: [main, feature/*]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: e2e-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
e2e:
15+
runs-on: macos-15
16+
timeout-minutes: 30
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- name: Cache Swift packages
24+
uses: actions/cache@v4
25+
with:
26+
path: .build
27+
key: ${{ runner.os }}-spm-SwiftLM-${{ hashFiles('Package.resolved') }}
28+
restore-keys: |
29+
${{ runner.os }}-spm-SwiftLM-
30+
31+
- name: Clear stale module cache
32+
# Prevents: "PCH was compiled with module cache path '…mlx-server…'
33+
# but the path is currently '…SwiftLM…'" after repo rename.
34+
run: find .build -type d -name ModuleCache -exec rm -rf {} + 2>/dev/null || true
35+
36+
- name: Build (Release)
37+
run: swift build -c release
38+
39+
- name: Install MLX Metal library
40+
run: |
41+
python3 -m venv /tmp/mlx_venv
42+
/tmp/mlx_venv/bin/pip install --quiet mlx
43+
cp /tmp/mlx_venv/lib/python*/site-packages/mlx/lib/mlx.metallib .build/release/
44+
45+
- name: Cache MLX model
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/huggingface
49+
key: mlx-model-qwen2.5-0.5b-4bit
50+
51+
- name: TurboQuant unit tests
52+
run: |
53+
# Fast pre-flight: verify compression math before expensive model download.
54+
# Tests: Lloyd-Max centroids, WHT correctness, rotation orthogonality,
55+
# 3-bit pack/unpack, V-cache SNR (14.6 dB), K-cache IP SNR (13.7 dB), fp16.
56+
# No external deps — compiles standalone with clang++.
57+
clang++ -std=c++17 -O2 -o /tmp/tq_test tests/test_turbo_quant.cpp
58+
/tmp/tq_test
59+
60+
- name: Run E2E tests
61+
env:
62+
HF_HUB_DOWNLOAD_TIMEOUT: "600"
63+
run: |
64+
chmod +x tests/test-server.sh
65+
# Retry up to 2 times for transient HuggingFace download failures
66+
for attempt in 1 2 3; do
67+
echo "Attempt $attempt of 3..."
68+
if tests/test-server.sh .build/release/SwiftLM 15413; then
69+
exit 0
70+
fi
71+
if [ "$attempt" -lt 3 ]; then
72+
echo "Test failed, retrying in 10s..."
73+
sleep 10
74+
fi
75+
done
76+
echo "All attempts failed"
77+
exit 1
78+
79+
- name: Upload test logs on failure
80+
if: failure()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: e2e-test-logs
84+
path: /tmp/SwiftLM-test-*.log
85+
retention-days: 7

.github/workflows/release.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
- uses: actions/checkout@v4
3232
with:
3333
fetch-depth: 0 # Full history for build number
34+
submodules: recursive
3435

3536
- name: Install Metal Toolchain
3637
run: xcodebuild -downloadComponent MetalToolchain || true
@@ -64,31 +65,31 @@ jobs:
6465

6566
- name: Verify binary
6667
run: |
67-
ls -lh .build/release/mlx-server
68-
file .build/release/mlx-server
69-
.build/release/mlx-server --help || true
68+
ls -lh .build/release/SwiftLM
69+
file .build/release/SwiftLM
70+
.build/release/SwiftLM --help || true
7071
7172
- name: Package binary
7273
run: |
7374
mkdir -p release
74-
cp .build/release/mlx-server release/
75+
cp .build/release/SwiftLM release/
7576
cp LICENSE README.md release/
7677
cd release
77-
tar -czvf ../mlx-server-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz .
78+
tar -czvf ../SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz .
7879
7980
- name: Upload artifact
8081
uses: actions/upload-artifact@v4
8182
with:
82-
name: mlx-server-${{ steps.tag.outputs.name }}-macos-arm64
83-
path: mlx-server-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
83+
name: SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64
84+
path: SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
8485
retention-days: 90
8586

8687
- name: Prepare release notes
8788
id: notes
8889
run: |
8990
CHANGELOG=$(cat /tmp/changelog.txt)
9091
cat > /tmp/release_notes.md << 'RELEASE_EOF'
91-
## mlx-server ${{ steps.tag.outputs.full }}
92+
## SwiftLM ${{ steps.tag.outputs.full }}
9293
9394
<details open>
9495
@@ -104,25 +105,25 @@ jobs:
104105
105106
### Download
106107
107-
- [macOS Apple Silicon (arm64)](https://github.com/SharpAI/mlx-server/releases/download/${{ steps.tag.outputs.name }}/mlx-server-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz)
108+
- [macOS Apple Silicon (arm64)](https://github.com/SharpAI/SwiftLM/releases/download/${{ steps.tag.outputs.name }}/SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz)
108109
109110
### Quick Start
110111
```bash
111-
tar -xzf mlx-server-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
112-
./mlx-server --model mlx-community/Qwen2.5-3B-Instruct-4bit --port 5413
112+
tar -xzf SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
113+
./SwiftLM --model mlx-community/Qwen2.5-3B-Instruct-4bit --port 5413
113114
```
114115
115-
> **Note:** Requires `mlx.metallib` next to the binary for GPU compute. See [README](https://github.com/SharpAI/mlx-server#metal-shader-library) for setup.
116+
> **Note:** Requires `mlx.metallib` next to the binary for GPU compute. See [README](https://github.com/SharpAI/SwiftLM#metal-shader-library) for setup.
116117
RELEASE_EOF
117118
118119
- name: Create release
119120
if: ${{ github.event_name == 'push' || github.event.inputs.create_release == 'true' }}
120121
uses: softprops/action-gh-release@v2
121122
with:
122123
tag_name: ${{ steps.tag.outputs.name }}
123-
name: "mlx-server ${{ steps.tag.outputs.name }}"
124+
name: "SwiftLM ${{ steps.tag.outputs.name }}"
124125
body_path: /tmp/release_notes.md
125126
files: |
126-
mlx-server-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
127+
SwiftLM-${{ steps.tag.outputs.name }}-macos-arm64.tar.gz
127128
draft: false
128129
prerelease: false

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ DerivedData/
1313
# IDE
1414
.vscode/
1515
.idea/
16+
17+
# Temporary Artifacts & Logs
18+
*.log
19+
*.metallib
20+
*.pid
21+
curl_out.txt
22+
sample.txt

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "mlx-swift-lm"]
2+
path = mlx-swift-lm
3+
url = https://github.com/SharpAI/mlx-swift-lm.git

0 commit comments

Comments
 (0)