Add llama-bench-style benchmark: llama-tornado --bench (pp/tg/pg matrix, avg±stddev t/s, md/csv/json)#133
Conversation
…-workgroup data race (workgroup 0 combined other groups' partials with no synchronization); NVIDIA path now uses a race-free single-workgroup reduction
…t matrix over multiple models, warmup + repetitions, avg±stddev tok/s, markdown/CSV/JSON output; forward-pass-only timing (no tokenization/sampling) for llama.cpp llama-bench parity
|
@orionpapadakis could you take a look? llama-bench-style benchmark for the GPU forward path ( Maybe, we should add this to CI? |
…(-d, untimed KV prefill, tests named ppN@dK/tgN@dK), jsonl + sql output, -oe second-format-to-stderr, --delay between tests
|
Feature-parity pass against upstream llama-bench (commit 1abee4e): Added (was missing, applicable to GPULlama3):
Already had: multi-model Not applicable to GPULlama3 (llama.cpp-specific), intentionally skipped: Note: use the |
…e batched-prefill tensor-core (MMA) path (compute-bound, ~47x pp on Llama-1B b128), mirroring llama-bench -b; generation stays single-token decode; graceful skip for unsupported models
…odel (avoids the primary model appearing twice in the results)
Model-coverage benchmark sweep + prefill-batch support (
|
| model | quant | size | params | pp128 | tg64 |
|---|---|---|---|---|---|
| Llama-3.2-1B | FP16 | 2.31 GiB | 1.24 B | 107.70 ± 0.86 | 109.60 ± 1.55 |
| Qwen3-1.7B | FP16 | 3.79 GiB | 2.03 B | 54.28 ± 2.56 | 53.30 ± 0.09 |
| Qwen3-4B | FP16 | 7.50 GiB | 4.02 B | 33.10 ± 0.98 | 35.45 ± 0.06 |
| Mistral-7B-v0.3 | FP16 | 13.5 GiB | 7.25 B | 21.14 ± 0.04 | 24.92 ± 0.63 |
| Llama-3.2-3B | Q8_0 | 3.18 GiB | 3.4 B | 56.45 ± 0.32 | 58.04 ± 2.08 |
| Granite-3.3-2B | Q8_0 | 2.51 GiB | 2.5 B | 40.69 ± 0.15 | 42.71 ± 0.77 |
Batched prompt processing (pp512 -b, tensor-core MMA prefill):
| model | test | t/s | vs single-token pp |
|---|---|---|---|
| Llama-3.2-1B | pp512 b128 | 4125.81 ± 42.46 | ~47× |
| Llama-3.2-1B | pp512 b32 | 1194.06 ± 17.59 | ~14× |
| Qwen3-1.7B | pp512 b32 | 719.23 ± 8.00 | ~13× |
| Qwen3-4B | pp512 b32 | 383.53 ± 2.01 | ~11× |
| Mistral-7B | pp512 b32 | — | BATCH_PREFILL_DECODE not yet supported for MISTRAL + F16 (graceful skip) |
Findings
- Single-token decode is memory-bound: t/s tracks 1/size (1B FP16 ~108, 7B FP16 ~25); pp≈tg per model (both single-token matvecs).
- Batched pp is the tensor-core win: turning prefill into a compute-bound GEMM gives ~47× on Llama-1B at b128 — this is what makes GPULlama3's prompt processing competitive, and it's now measurable in the bench.
- Batched prefill = Llama + Qwen3 only today (Mistral/Q8 fall back or are unsupported); the bench reports this cleanly rather than crashing — useful signal for where to extend the MMA path next.
- Q8_0 models run fine on the single-token path (Llama-3B-Q8 56/58, Granite-2B-Q8 41/43).
Full feature parity list vs upstream llama-bench in the earlier comment. @orionpapadakis — review welcome; happy to add more models or wire batched pp for Mistral/Q8 if useful.
llama-tornado --bench— a llama-bench-style benchmark for GPULlama3GPULlama3 equivalent of llama.cpp's
llama-bench: a reproducible, matrix-style performance benchmark for the GPU forward path.What it does
pp N), token generation (tg N), combined (pg pp,tg) — every combination of the values given.-rtimed repetitions, reported as avg t/s ± stddev; timings cover the forward pass only — no tokenization, no sampling, no host argmax.Usage
Example (RTX 4090, TornadoVM 5.0.1-jdk21-dev CUDA backend, r=5)
(t/s here is higher than end-to-end
achieved tok/sbecause tokenization/sampling/echo are excluded — same reason llama-bench numbers exceed llama-cli's.)Files
bench/LlamaBench.java— self-contained bench main (arg parsing, matrix, stats, 3 output formats).llama-tornado—--bench/--bench-argsflags (swaps the main class; inference path untouched).README.md— new "Benchmarking" section.Stacked on #132 (Qwen3 RMS-norm race fix) so Qwen3 rows are meaningful; the two commits before the bench commit are that fix.
🤖 Generated with Claude Code