Understanding FlashAttention-3 on NVIDIA Hopper
The attention mechanism in transformer models is notoriously memory-bound. While calculating self-attention, a model must compute query, key, and value matrices, a process that scales quadratically with sequence length. On modern GPUs, the math itself runs incredibly fast on specialized Tensor Cores. Slowdowns happen when the GPU must constantly write intermediate attention matrices back to its high-bandwidth memory (HBM) and read them back in for the next step. The original FlashAttention algorithm resolved a massive portion of this overhead by tiling: loading blocks of data into the GPU's fast, local Static RAM (SRAM), computing attention locally, and writing only the final output back to HBM. FlashAttention-2 optimized this further by tuning work distribution among the GPU's warp schedulers. However, modern silicon like the NVIDIA Hopper architecture (H100) introduced new physical capabilities that required a complete rethink of how software interacts with hardware. FlashAttention-3 adapts directly to these microarchitectural shifts, unlocking near-theoretical maximum speeds on Hopper GPUs.
Read More
| Share
