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

Prefill TTFT67.8 ms
Decode TPOT6.65 ms
Total throughput150 tok/s
Per-stream speed150.4 tok/s
Decode regime: Memory-bandwidth-bound1 vs. effective ridge 197 FLOPs/byte (end-to-end 1.76 s)

Compare across data-center GPUs at batch size 1

GPUDense peak TFLOPSEst. prefill TTFTEst. decode TPOTTotal output tok/sDecode bottleneck
NVIDIA RTX 4090165.2 (BF16)406.1 ms22.09 ms45 tok/sMemory-bandwidth-bound
NVIDIA L40S362.1 (BF16)185.3 ms25.77 ms39 tok/sMemory-bandwidth-bound
NVIDIA A100 80GB SXM312 (BF16)215 ms10.92 ms92 tok/sMemory-bandwidth-bound
NVIDIA H100 SXM989.5 (BF16)67.8 ms6.65 ms150 tok/sMemory-bandwidth-bound
NVIDIA H200 SXM989.5 (BF16)67.8 ms4.64 ms216 tok/sMemory-bandwidth-bound
AMD Instinct MI300X1,307.4 (BF16)51.3 ms4.2 ms238 tok/sMemory-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.