GPUs & Accelerators
SMs, HBM, tensor cores, and the memory hierarchy that decides your kernel's speed — plus why every accelerator vendor is fighting the same battle against memory bandwidth.
#What a GPU is, structurally
A CPU is optimised for latency on one thread: deep pipelines, huge caches, aggressive branch prediction and speculation, all to finish a single instruction stream as fast as possible.
A GPU is optimised for throughput across tens of thousands of threads. It gives up per-thread speed almost entirely and spends the transistor budget on parallel arithmetic units and memory bandwidth.
CPU (a modern server socket) GPU (a datacenter accelerator)
16-128 complex cores 100-150 streaming multiprocessors
~5 GHz, deep OoO pipelines ~1.5-2 GHz, in-order, simple
large L1/L2/L3 per core small caches, huge register file
~100-400 GB/s memory bandwidth ~2-8 TB/s HBM bandwidth
latency-optimised throughput-optimised
The GPU hides slow memory by keeping ~2,000 threads per unit
ready to go: the instant one group of threads stops to wait
for data, another runs. There is no big cache to save you —
there is only more parallelism.That last sentence is the design philosophy. A CPU avoids memory stalls with caches and prefetching. A GPU accepts them and covers them with concurrency.
#The memory hierarchy that matters
Two abbreviations run through the rest of this page. An SM (streaming multiprocessor) is one of the ~100 independent processing units a GPU is built from — the rough equivalent of a CPU core, except each one runs thousands of threads. HBM (high-bandwidth memory) is the GPU's main memory, stacked physically next to the chip; it's where your model weights live, and it's the slowest tier that still counts as "on the GPU".
Shared memory is the one that distinguishes GPU programming. It is a software-managed scratchpad — you explicitly stage data into it, and it's roughly 100× faster than HBM. Every high-performance GPU kernel is fundamentally an exercise in tiling work so that each tile fits in shared memory and gets reused many times before being written back.
This is exactly what FlashAttention does. Standard attention computes a score for every pair of tokens — an n × n matrix — writes the whole thing out to HBM, then reads it back for the next step. FlashAttention never builds that full matrix. It works through attention in small tiles that fit in shared memory (the on-chip SRAM), and when it needs a value again later it recomputes it rather than storing it and fetching it from HBM. The arithmetic is higher and the runtime is much lower, because HBM traffic — not FLOPs — was what was actually slowing things down.
#Tensor cores
An ordinary GPU core multiplies and adds a few numbers at a time. A tensor core is dedicated hardware that multiplies two small matrices and adds a third, all as a single instruction — because that operation is essentially the only thing neural networks do, and doing it in one step rather than hundreds is where the order-of-magnitude speedup comes from.
CUDA core: one fused multiply-add per cycle per lane
Tensor core: D = A × B + C for small matrices (e.g. 16×8×16)
in one instruction
→ roughly an order of magnitude more FLOP/s for
matrix-shaped work
Consequences that bite:
· Only matrix multiplication benefits. Elementwise
operations, softmax, normalisation, and activations
run on the ordinary cores and are usually
memory-bound anyway.
· Dimensions must align to the tensor core tile (multiples
of 8 or 16). A hidden size of 4,096 is fast; 4,090 may
not fill the tiles evenly, so the work gets padded or
falls back to the slower ordinary cores.
· Lower precision means more throughput: FP8 is typically
2× FP16, which is ~2× FP32.#Reading a spec sheet
The comparison that matters, in rough current-generation terms:
| Property | What it determines | Typical range |
|---|---|---|
| HBM capacity | Model size + KV cache = concurrency | 80–192 GB |
| HBM bandwidth | Decode latency, directly | 2–8 TB/s |
| BF16/FP8 dense TFLOPS | Prefill and training speed | 500–5,000 |
| NVLink bandwidth | Tensor-parallel scaling within a node | 400–1,800 GB/s |
| Network per GPU | Multi-node training scaling | 200–800 Gb/s |
| Power | Datacenter density and cost | 400–1,200 W |
#Power, cooling, and why they became architectural
A modern accelerator draws up to ~1,200 W. Eight in a node is ~10 kW before CPUs, networking, and storage.
Traditional air-cooled datacenter rack: 6-15 kW
One 8-GPU AI node: ~10-14 kW
→ ONE node fills a conventional rack.
Consequences:
· liquid cooling is no longer exotic, it's required
· power delivery is a hard constraint on how many
GPUs fit in a building
· you cannot simply add GPUs to an existing datacenter
· "GPU shortage" is frequently a power and cooling
shortage wearing a different nameThe newest systems go further and treat the rack as the unit. NVIDIA's GB200 NVL72 (2025) puts 72 GPUs in one liquid-cooled rack drawing roughly 120 kW, all joined by NVLink (NVIDIA's fast GPU-to-GPU link) into a single high-bandwidth domain. That changes parallelism as well as plumbing. Some ways of splitting a model across GPUs — tensor and expert parallelism, covered in model parallelism — make GPUs exchange data constantly, so they only work over NVLink. They used to stop at the 8 GPUs inside one server; now they can span all 72 in the rack.
This is why capacity planning for AI infrastructure involves megawatts and lead times measured in quarters, not an autoscaling group. It's also why autoscaling GPU capacity is slow in a way that has no equivalent in stateless web serving.
#Multi-instance GPU and sharing
A whole accelerator is wasteful for a small model. Three sharing mechanisms, with real differences:
| Mechanism | Isolation | Notes |
|---|---|---|
| MIG (hardware partitioning) | Strong — separate SMs, cache slices, and memory paths | Fixed partition sizes; must be configured before workloads start; genuine QoS |
| Time slicing | Weak — contexts swap on the same hardware | Easy, no config; noisy neighbours affect each other's latency badly |
| MPS (multi-process service) | Medium — concurrent kernels, shared memory space | Better utilisation than time slicing, no memory protection |
For multi-tenant inference where you must guarantee latency, MIG is the only one that actually isolates. For a research cluster where fairness matters more than predictability, time slicing is fine.
#The other accelerators
| Accelerator | Distinguishing idea |
|---|---|
| TPU | Systolic array rather than SMs — a big grid of multiply units that pass partial results directly to their neighbours, so data is reused without going back to memory; very high matmul density; 2D/3D torus interconnect that scales to thousands of chips without a switch fabric |
| Trainium / Inferentia | AWS silicon; cost-optimised per unit of throughput; requires its own compiler stack |
| AMD Instinct | Competitive hardware, particularly on memory capacity; the gap is software maturity, and ROCm has been closing it |
| Groq / Cerebras | Bet on enormous on-chip SRAM instead of HBM — eliminating the bandwidth bottleneck entirely for models that fit |
That last row is the interesting architectural bet. If decode is bandwidth-bound because weights live in HBM, then putting the weights in SRAM — hundreds of megabytes of it, or a whole wafer's worth — removes the bottleneck rather than optimising around it. The constraint becomes total on-chip memory, so it works for models that fit and not at all for models that don't.
#Exercise
#Check yourself
How does a GPU hide slow memory?Show answer
What are SMs and HBM?Show answer
Why is shared memory the lever in GPU programming?Show answer
What do tensor cores accelerate, and what are the gotchas?Show answer
What utilisation do real workloads reach?Show answer
Why are power and cooling architectural constraints?Show answer
Which GPU sharing mechanism gives real isolation?Show answer
What is the bet behind Groq and Cerebras, and what is CUDA's moat?Show answer
#What to carry forward
- GPUs are throughput machines that hide memory latency with thousands of threads, not caches.
- Shared memory is the lever — high-performance kernels tile work to stay out of HBM. FlashAttention is the canonical example.
- Tensor cores only accelerate matmul, and want aligned dimensions.
- For inference, judge on bandwidth, capacity, interconnect — not peak TFLOPS.
- Power and cooling are hard constraints; one 8-GPU node fills a conventional rack.
- MIG is the only sharing mechanism with real isolation.
- CUDA is the moat; a cheaper accelerator has an engineering bill attached.