← All questions
Inference & ServingMedium· GPU Architecture· CUDA· Performance

What is a warp and why does its size matter?

A warp consists of 32 threads executing the same instruction on different data. The size is critical for two reasons: first, it is the unit of instruction dispatch, meaning thread block sizes that are not multiples of 32 result in wasted compute resources. Second, if threads within a warp take different paths (branches), the hardware executes these paths serially (warp divergence). This reduces throughput by the fraction of threads that fall into the minority branch.

Code playground (Python)