Roofline numbers by hand from spec sheets
CPU · your Macdesign60 minrequiredGoal · A hand-drawn or matplotlib roofline for the T4 and A100 with four kernels placed on it, including Llama-2-7B decode at batch 1.
- 1From the datasheets, record peak FP16 tensor TFLOPS and memory bandwidth for T4 and A100-80GB; compute the ridge point in FLOPs per byte.
- 2Compute arithmetic intensity for float32 vector add (n=1e7), float16 square matmul with N=4096, and float16 softmax over a 4096 x 4096 matrix.
- 3For Llama-2-7B decode at batch 1 in FP16, estimate bytes moved per token (about 13.5 GB) and FLOPs per token (about 2 x 7e9), and compute intensity.
- 4Plot both rooflines on log-log axes in matplotlib and mark the four points.
- 5For each point write whether it is memory- or compute-bound and the attainable GFLOP/s.
- 6Compute the theoretical maximum tokens per second for batch-1 decode on each GPU.
- Deliverable
- roofline.png plus a short table of intensities and bounds.
- Check
- Vector add, softmax and batch-1 decode land left of the ridge point on both GPUs; matmul at N=4096 lands right of it; T4 decode ceiling is roughly 320 GB/s / 13.5 GB, about 24 tokens per second.