Performance modeling tool
LLM latency, throughput, and roofline calculator
Estimate first-token prefill time (TTFT), per-token decode time (TPOT), and aggregate throughput from first principles using GPU Tensor Core FLOPs and HBM memory bandwidth.
Hardware, model, and batch shape
Compare across data-center GPUs at batch size 1
| GPU | Dense peak TFLOPS | Est. prefill TTFT | Est. decode TPOT | Total output tok/s | Decode bottleneck |
|---|---|---|---|---|---|
| NVIDIA RTX 4090 | 165.2 (BF16) | 406.1 ms | 22.09 ms | 45 tok/s | Memory-bandwidth-bound |
| NVIDIA L40S | 362.1 (BF16) | 185.3 ms | 25.77 ms | 39 tok/s | Memory-bandwidth-bound |
| NVIDIA A100 80GB SXM | 312 (BF16) | 215 ms | 10.92 ms | 92 tok/s | Memory-bandwidth-bound |
| NVIDIA H100 SXM | 989.5 (BF16) | 67.8 ms | 6.65 ms | 150 tok/s | Memory-bandwidth-bound |
| NVIDIA H200 SXM | 989.5 (BF16) | 67.8 ms | 4.64 ms | 216 tok/s | Memory-bandwidth-bound |
| AMD Instinct MI300X | 1,307.4 (BF16) | 51.3 ms | 4.2 ms | 238 tok/s | Memory-bandwidth-bound |
Roofline formulas explained
Ridge point (FLOPs/byte) = Peak Tensor Core FLOP/s ÷ HBM bandwidth (bytes/s)
Prefill FLOPs ≈ 2 × active_parameters × prompt_tokens × batch_size
Decode step FLOPs ≈ 2 × active_parameters × batch_size
Decode step bytes read ≈ weight_bytes + batch_size × context_len × kv_bytes_per_token
Step time = max(FLOPs ÷ effective_FLOP/s, bytes_read ÷ effective_bandwidth)At batch size 1, every decode step reads all active model weights once to produce a single token, yielding ~1–2 FLOPs per byte—far below an H100’s ~295 FLOPs/byte BF16 ridge point. Increasing batch size reuses the same weight read across many requests until arithmetic intensity crosses the ridge point or KV-cache reads dominate.
Peak TFLOPS use dense datasheet Tensor Core figures (without 2:4 structured sparsity). Real servers also pay kernel launch overhead (mitigated by CUDA graphs and torch.compile), scheduler queueing, and attention quadratic terms on very long contexts.
Related lessons, problems, and guides
Frequently asked questions
What is the GPU roofline ridge point for LLM serving?
The ridge point is peak Tensor Core FLOPs per second divided by HBM memory bandwidth in bytes per second. Workloads below this FLOP-to-byte ratio are memory-bandwidth-bound; workloads above it are compute-bound.
Why do prefill and decode hit different bottlenecks?
Prefill processes hundreds or thousands of prompt tokens in parallel, reusing loaded weights across the whole prompt and pushing arithmetic intensity above the ridge point. Decode appends one token per sequence per step, so it reads all weights and KV tensors for very little arithmetic per request.
What values should I use for MFU and memory bandwidth efficiency?
For well-tuned FlashAttention and CUDA-graph kernels on dense models, 35% to 55% model FLOPs utilization (MFU) during prefill and 60% to 80% memory bandwidth efficiency during decode are realistic starting assumptions.
Does this roofline model include multi-GPU communication overhead?
No. This estimator models single-device compute and HBM traffic. Tensor parallelism across NVLink or PCIe adds AllReduce synchronization latency after attention and MLP blocks.