For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL.
GPU architecture
Before writing or tuning GPU kernels, you need a working model of how a GPU runs code. Without it, suggestions like “increase occupancy” or "reduce shared memory bank conflicts" are just a set of rules to memorize. You don't fully understand when they apply and when they don't.
This section explains modern GPU architecture at the level needed for kernel work. The details lean toward NVIDIA hardware because CUDA dominates much of the LLM inference ecosystem today. However, the core concepts apply broadly to AMD GPUs and other parallel accelerators as well.
Hardware and the execution model
The hardware is what physically exists on the GPU: streaming multiprocessors (SMs), Tensor Cores, and the registers, caches, shared memory, and high bandwidth memory (HBM) that form the GPU memory hierarchy. These resources determine how much work and data the GPU can keep close to the compute units.
The execution model is the abstraction used to write a kernel. Code creates threads and organizes them into warps, blocks, and grids. The GPU schedules that work across the available hardware.
Kernel optimization connects these two views. A fast kernel maps the execution model onto the hardware and respects limits on compute, memory bandwidth, registers, shared memory, and scheduling capacity.
GPU execution and memory map
The visual below follows work from individual threads to an SM, then shows the memory layers that feed the compute units. Four terms establish the execution hierarchy:
- A thread is the smallest logical unit of work and usually handles one element or a small group of elements.
- A warp is a group of 32 threads that an NVIDIA SM schedules together.
- A thread block groups threads that can cooperate through shared memory and synchronization.
- A streaming multiprocessor (SM) is the on-chip compute unit that accepts blocks and issues instructions from ready warps.
(H100 SXM)
What's next
The four pages below separate the execution model from the physical hardware, then show how the two views meet during kernel execution.
GPU threads, warps, blocks, and grids
Learn how GPU kernels organize work into threads, warps, thread blocks, and grids.
Streaming multiprocessors
Understand streaming multiprocessor internals, warp scheduling, block residency, and GPU occupancy.
GPU memory hierarchy
Understand GPU registers, shared memory, caches, bank conflicts, HBM, and the trade-offs across the memory hierarchy.
Tensor Cores
Learn how Tensor Cores execute tiled matrix operations and what precision, shape, and layout constraints kernels must satisfy.