Build a roofline calculator and check it against real numbers
CPU · your Macnotebook90 minrequiredGoal · Predict prefill time, decode step time and the crossover batch size for three models on a T4, A100 and H100 and compare with published benchmark figures.
- 1Enter specs for T4, A100-80GB and H100-SXM (HBM bandwidth, FP16 dense tensor-core TFLOPs) from the NVIDIA datasheets.
- 2For Llama-2-7B, Llama-3-8B and a 70B model compute weight bytes in FP16 and FP8 and KV bytes per token from config.json.
- 3Write decode_step_time(batch, context) = max(weight_bytes + batch*context*kv_bytes_per_token, ...) / bandwidth versus 2*params*batch / peak_flops, taking the max.
- 4Write prefill_time(prompt_len) using the same roofline and compute TTFT for prompts of 128, 1024 and 8192 tokens.
- 5Plot decode tokens/s versus batch size for each GPU and mark the crossover batch where it bends.
- 6Compare your A100 Llama-2-7B batch-1 decode prediction with a published vLLM or TensorRT-LLM number and explain the gap in percent.
- Deliverable
- A notebook with the calculator, the tokens/s-versus-batch plot and a short comparison with published numbers.
- Check
- Your batch-1 FP16 decode prediction for Llama-2-7B on A100 is in the 7-10 ms per token range, and the crossover batch is in the hundreds.