Up to 9x Speedup & GPU Bandwidth Optimization

By reducing global memory traffic from ~3N to ~2N operations and enabling kernel fusion, online softmax contributes to 2-3x faster execution for softmax functions and allows FlashAttention to achieve 6-9x speedups in LLM inference on GPUs, particularly benefiting bandwidth-bound operations.

The top 3

  1. FlashAttention's Core Breakthrough: Memory Over Compute: The primary performance bottleneck in traditional GPU attention mechanisms is not floating-point operations (FLOPs), but rather the slow data movement between High Bandwidth Memory (HBM) and fast on-chip SRAM; FlashAttention's key innovation is its 'IO-awareness' to minimize these costly transfers.
  2. Online Softmax & Tiling: Memory's Quadratic to Linear Shift: FlashAttention's 'online softmax' algorithm, coupled with a tiling strategy, computes attention scores incrementally within fast on-chip SRAM. This method avoids materializing the massive N x N attention matrix in slower HBM, dramatically reducing VRAM usage and changing memory complexity from quadratic to linear.
  3. Kernel Fusion & Recomputation: Dual Speedup Strategies: FlashAttention boosts speed by fusing multiple attention sub-operations (like matrix multiplication and softmax) into a single GPU kernel, minimizing redundant HBM access. Additionally, it strategically recomputes intermediate gradients during the backward pass instead of storing them, further reducing memory traffic and accelerating processing.

Sources

Open the full topic