Improve collection of performance/throughput metrics#113
Open
orionpapadakis wants to merge 5 commits intomainfrom
Open
Improve collection of performance/throughput metrics#113orionpapadakis wants to merge 5 commits intomainfrom
orionpapadakis wants to merge 5 commits intomainfrom
Conversation
…formance metrics across inference stages
…ranularity across plan creation, JIT, and weight transfer stages
mikepapadim
approved these changes
May 5, 2026
… JSON, and GitHub Step Summary formats
72ce770 to
e966ed1
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses #104 .
Introduces a
RunMetricssingleton that accumulates timing data across the full inference stack and prints a unified performance summary, replacing the previous ad-hocLastRunMetricsrecord.Metrics collected
Core (aligned with Ollama-style reporting):
load_duration— model file load time, measured inModelLoader(both overloads)prompt_eval_count/prompt_eval_duration— prefill token count and wall-clock timeeval_count/eval_duration— decode token count and wall-clock timetotal_duration— full inference wall-clock timeTornadoVM-specific:
tornado_task_graph_compile_duration— plan/graph construction timetornado_task_graph_warmup_duration— JIT compilation (withPreCompilation())read_only_weights_copy_in_duration— first-execution weight upload (forceCopyInReadOnlyData())All values stored in nanoseconds.
Derived throughput printed at end of run
--verbose-initis set — no new flags introducedHow to test
All commands below use Llama-3.2-1B-Instruct-F16.gguf. Each should print a
==== Performance Metrics ====block at the end.Standard engine — CPU
./llama-tornado --model <model> --prompt "Tell me a joke"Expected: single "achieved tok/s" line (no prefill/decode split)
Standard engine — GPU
./llama-tornado --gpu --ptx --model <model> --prompt "Tell me a joke"Expected: single "achieved tok/s" line
Standard engine — GPU + --verbose-init
./llama-tornado --gpu --ptx --model <model> --prompt "Tell me a joke" --verbose-initExpected: throughput line + "Compilation & CodeGen / Warmup / Read-only weights Copy-in" lines
Prefill-decode — CPU
./llama-tornado --model <model> --prompt "Tell me a joke" --with-prefill-decodeExpected: Total + ¬Prefill + ¬Decode tok/s lines
Prefill-decode — GPU
./llama-tornado --gpu --ptx --model <model> --prompt "Tell me a joke" --with-prefill-decode --verbose-initExpected: per-phase throughput + TornadoVM init breakdown
Batch prefill-decode — GPU + CUDA graphs
./llama-tornado --gpu --ptx --model <model> --prompt "Tell me a joke" \ --with-prefill-decode --batch-prefill-size 32 --cuda-graphs --verbose-initExpected: per-phase throughput + TornadoVM init breakdown