# Compute and Systems

> GPU compute and bandwidth, the roofline model, numerical precision and collective communication. The same algorithm can differ tenfold in speed with another implementation, batch size or precision, so the hardware limits have to be understood first.

- URL: https://dmxsf.com/en/wiki/systems/
- [DMXSF](https://dmxsf.com/en/about/)
- Updated: 2026-11-18

## After this chapter you will be able to

- Use the roofline model to decide whether an operator is limited by compute or by memory bandwidth, and explain why batched decoding is bandwidth-bound.
- Explain the trade-offs between FP32, BF16, FP16 and FP8 in range and precision, and the role of accumulation precision and loss scaling in mixed-precision training.
- Write down the communication volume of all-reduce, all-gather and reduce-scatter, and estimate communication time in multi-GPU training with the alpha-beta model.
- Apply the four walls of compute, bandwidth, capacity and communication to the pretraining and inference chapters, and say which wall each optimization sidesteps.

If CPUs, GPUs, host memory, and device memory are new to you, start with [LLM hardware basics](https://dmxsf.com/en/wiki/systems/hardware-basics/), then use the roofline to compare bottlenecks.

The first three chapters were about algorithms: what a model is and how attention is computed. This chapter looks at the **hardware**. The same algorithm can differ tenfold in speed with a different implementation, batch size or numerical precision. Training a large model costs millions of GPU hours and inference is priced in dollars per million tokens, and both bills are set by the limits that hardware draws around the algorithm.

The chapter answers three questions: what actually limits an operator (compute or memory bandwidth); why both training and inference keep moving to lower precision, and where low precision breaks; and how the communication between the GPUs of a large training job shapes the parallelism strategy. Once you have them, many designs in the [pretraining](https://dmxsf.com/en/wiki/pretraining/) and [inference](https://dmxsf.com/en/wiki/inference/) chapters, such as FlashAttention, GQA, continuous batching, ZeRO and pipeline parallelism, turn into different answers to one question: how to get around one of the walls.

Every page in this chapter comes with experiments you can run. The roofline page measures the same curves on a laptop without a GPU; the experiments on numerical precision and collective communication are fully reproducible.

[GPU kernels](https://dmxsf.com/en/wiki/systems/gpu-kernels/) uses matrix multiplication to connect layout and logical traffic with tile sizes, fusion, and device measurements.

[Chapter labs on GitHub](https://github.com/dmxsf/dmxsf/tree/main/labs/systems)
