-
Notifications
You must be signed in to change notification settings - Fork 568
268 lines (225 loc) · 8.06 KB
/
Copy pathruvllm-benchmarks.yml
File metadata and controls
268 lines (225 loc) · 8.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
name: RuvLLM Benchmarks
on:
pull_request:
paths:
- 'crates/ruvllm/**'
- '.github/workflows/ruvllm-benchmarks.yml'
push:
branches:
- main
- develop
paths:
- 'crates/ruvllm/**'
workflow_dispatch:
inputs:
run_ane_benchmarks:
description: 'Run ANE benchmarks (macOS only)'
required: false
default: 'true'
type: boolean
run_full_suite:
description: 'Run full benchmark suite (takes longer)'
required: false
default: 'false'
type: boolean
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions:
contents: read
pull-requests: write
issues: write
jobs:
# macOS ARM64 benchmarks (Apple Silicon with ANE)
macos-arm64-benchmarks:
name: macOS ARM64 Benchmarks (M-series)
runs-on: macos-14 # M1/M2 runner
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-ruvllm-bench-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-ruvllm-bench-
${{ runner.os }}-cargo-build-
- name: Build ruvllm with ANE support
run: |
cargo build --release -p ruvllm --features "coreml,accelerate"
- name: Run ANE vs NEON benchmarks
if: github.event.inputs.run_ane_benchmarks != 'false'
working-directory: crates/ruvllm
run: |
# Run the ANE comparison benchmarks
cargo bench --features "coreml,accelerate" --bench ane_bench -- \
--output-format bencher 2>&1 | tee ../../ane_bench_results.txt
- name: Run crossover detection benchmark
if: github.event.inputs.run_full_suite == 'true'
working-directory: crates/ruvllm
run: |
cargo bench --features "coreml,accelerate" --bench ane_bench -- \
crossover_detection --output-format bencher 2>&1 | tee -a ../../ane_bench_results.txt
- name: Run hybrid pipeline benchmark
if: github.event.inputs.run_full_suite == 'true'
working-directory: crates/ruvllm
run: |
cargo bench --features "coreml,accelerate" --bench ane_bench -- \
hybrid_pipeline --output-format bencher 2>&1 | tee -a ../../ane_bench_results.txt
- name: Run matmul benchmarks
working-directory: crates/ruvllm
run: |
cargo bench --features "coreml,accelerate" --bench matmul_bench -- \
--output-format bencher 2>&1 | tee ../../matmul_bench_results.txt
- name: Run attention benchmarks
working-directory: crates/ruvllm
run: |
cargo bench --features "coreml,accelerate" --bench attention_bench -- \
--output-format bencher 2>&1 | tee ../../attention_bench_results.txt
- name: Generate benchmark summary
run: |
cat > benchmark_summary.md << 'EOF'
# RuvLLM Benchmark Results (macOS ARM64 with ANE)
## System Information
- Runner: macOS 14 (Apple Silicon M-series)
- Features: coreml, accelerate
## ANE vs NEON Performance
The ANE (Apple Neural Engine) benchmarks measure:
- Matrix multiplication at various sizes
- Activation functions (SiLU, GELU, Softmax)
- Normalization (LayerNorm, RMSNorm)
- Hybrid pipeline (ANE + GPU coordination)
### Expected Performance Characteristics (M4 Pro)
| Matrix Size | ANE Advantage |
|-------------|---------------|
| < 512 | +30-50% faster |
| 512-1024 | +10-30% faster |
| 1024-1536 | ~Similar |
| 1536-2048 | GPU preferred |
| > 2048 | GPU wins 30-50%|
## Results
### ANE Benchmark Results
```
EOF
head -n 100 ane_bench_results.txt >> benchmark_summary.md
cat >> benchmark_summary.md << 'EOF'
```
### Matrix Multiplication Results
```
EOF
head -n 50 matmul_bench_results.txt >> benchmark_summary.md
cat >> benchmark_summary.md << 'EOF'
```
### Attention Results
```
EOF
head -n 50 attention_bench_results.txt >> benchmark_summary.md
echo '```' >> benchmark_summary.md
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: ruvllm-macos-arm64-benchmarks
path: |
ane_bench_results.txt
matmul_bench_results.txt
attention_bench_results.txt
benchmark_summary.md
retention-days: 30
- name: Comment PR with results
if: github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync('benchmark_summary.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
# Linux benchmarks (NEON only baseline)
linux-benchmarks:
name: Linux Benchmarks (NEON baseline)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-ruvllm-bench-${{ hashFiles('**/Cargo.lock') }}
- name: Run matmul benchmarks (NEON simulation)
working-directory: crates/ruvllm
run: |
cargo bench --bench matmul_bench -- --output-format bencher 2>&1 | tee ../../linux_matmul_bench.txt
- name: Run attention benchmarks
working-directory: crates/ruvllm
run: |
cargo bench --bench attention_bench -- --output-format bencher 2>&1 | tee ../../linux_attention_bench.txt
- name: Upload Linux benchmark results
uses: actions/upload-artifact@v4
with:
name: ruvllm-linux-benchmarks
path: |
linux_matmul_bench.txt
linux_attention_bench.txt
retention-days: 30
# Benchmark comparison job
benchmark-comparison:
name: Compare Benchmarks
runs-on: ubuntu-latest
needs: [macos-arm64-benchmarks, linux-benchmarks]
if: github.event_name == 'pull_request'
steps:
- name: Download macOS results
uses: actions/download-artifact@v4
with:
name: ruvllm-macos-arm64-benchmarks
path: macos-results
- name: Download Linux results
uses: actions/download-artifact@v4
with:
name: ruvllm-linux-benchmarks
path: linux-results
- name: Generate comparison report
run: |
cat > comparison.md << 'EOF'
# Cross-Platform Benchmark Comparison
## macOS ARM64 (Apple Silicon with ANE)
```
EOF
head -n 30 macos-results/ane_bench_results.txt >> comparison.md
cat >> comparison.md << 'EOF'
```
## Linux x86_64 (Baseline)
```
EOF
head -n 30 linux-results/linux_matmul_bench.txt >> comparison.md
echo '```' >> comparison.md
- name: Upload comparison
uses: actions/upload-artifact@v4
with:
name: benchmark-comparison
path: comparison.md
retention-days: 30