Fusion's Core Power: Eliminating LLM Memory Bottlenecks

Fused kernels dramatically reduce memory traffic by keeping intermediate results in fast on-chip memory (registers or shared memory), avoiding costly trips to High Bandwidth Memory (HBM) that often make LLMs memory-bound rather than compute-bound.

The top 3

  1. Why LLMs Hit the Memory Wall: Large Language Models are often memory-bound, not compute-bound; naive execution of operations like `y = gelu(x + bias)` involves multiple expensive trips to global memory (HBM) for intermediate results, rather than keeping data in fast on-chip memory.
  2. Top Fusion Techniques for LLM Memory Savings: Kernel fusion combines multiple operations into one GPU kernel, reducing memory traffic by keeping intermediate results in fast on-chip memory; FlashAttention fuses all attention operations, while other fusions target common patterns like LayerNorm, Softmax, and Linear + Cross-Entropy, achieving up to 84% memory reduction for the latter.
  3. Advanced Fusion: Beyond Element-wise Ops: Aggressive operator fusion extends beyond simple element-wise chains (e.g., Add-ReLU) to combine compute-intensive operations like matrix multiplication with subsequent element-wise ops, or even entire decoding stages such as QKV Projection, Attention, and Output Projection into a single kernel, maximizing on-chip data locality and reducing latency by up to 37.44%.

Sources

Open the full topic