In modern deep learning, the primary bottleneck is rarely the number of floating-point operations (FLOPs) a processor can perform. Instead, performance is dictated by the "memory wall"—the massive disparity between the speed of a GPU's computational cores and the bandwidth of its main memory (High-Bandwidth Memory, or HBM).
When a model executes a sequence of operations, such as a convolution followed by a ReLU activation, standard frameworks typically write the intermediate results of the convolution back to HBM, only to read them again immediately for the activation. This "round-trip" to slow global memory wastes time and energy. Kernel fusion is the architectural solution to this problem: it merges multiple mathematical steps into a single execution unit, keeping data within high-speed, on-chip memory (SRAM or registers) throughout the entire pipeline.
The Intuition: From Round-Trips to On-Chip Pipelines
To understand why fusion works, consider the arithmetic intensity of an operation—the ratio of total FLOPs to total bytes moved. Operations like Softmax, Layer Normalization, and element-wise additions have low arithmetic intensity; they spend more time moving data than calculating.
By using fused kernels, researchers like Marcin Moczulski in the ACDC architecture demonstrate that we can replace "wasteful" layers with structured alternatives that keep intermediate results in low-level GPU memory. This approach doesn't just save time; it enables the training of larger models by reducing the memory footprint of intermediate tensors, as seen in the DeepSpeed4Science initiative, which achieved a 13x memory reduction for protein structure prediction.
Scaling to Long Sequences and Complex Structures
The benefits of fusion are most visible in architectures that handle long sequences or sparse data, where memory overhead scales poorly.
- Long-Sequence Modeling: Hermann Kumbong and Daniel Y. Fu developed FlashFFTConv, which rewrites the Fast Fourier Transform as a series of matrix multiplications. By fusing the forward transform, pointwise multiplication, and inverse transform into a single kernel, they maintain high arithmetic intensity, allowing models to process sequences millions of tokens long.
- State Space Models: As explored in the survey by Lijun Zhang 0001 on Visual Mamba, hardware-aware implementations use fused kernels to manage recurrent states. This prevents the memory bottlenecks typically associated with RNN-like processing, enabling linear-time efficiency on modern accelerators.
- Mixture of Experts (MoE): In sparse models, the "copy-and-pad" steps for routing tokens to different experts are notoriously memory-heavy. Shawn Tan and colleagues introduced ScatterMoE, which fuses token reordering directly into the linear transformation kernels. This eliminates redundant data copies, increasing throughput by 38%.
Overcoming the Portability Crisis
Historically, writing fused kernels required expert-level CUDA programming, creating a "portability vs. performance" crisis. If a researcher invented a new layer, they either suffered a performance penalty using standard libraries or spent weeks writing custom hardware code.
Frameworks like Boda, developed by Ali Jannesari and Matthew W. Moskewicz, and Tensor Comprehensions by Oleksandr Zinenko address this through metaprogramming and Just-In-Time (JIT) compilation. These systems automatically generate optimized, fused code from high-level mathematical descriptions. Similarly, DISC by Wenyi Zhao uses dynamic intermediate representations to fuse operations even when input shapes are unknown at compile time, minimizing the overhead of kernel orchestration.
The Shift from FLOPs to IO
The recurring theme across these 537 papers is a fundamental shift in how we value computational efficiency. In the era of ShiftNets and Channel Local Convolutions, reducing FLOPs is no longer enough. As BoRui Wu notes, the theoretical zero-cost nature of certain operations is only realized when they are fused into the data-loading process of subsequent layers.
By prioritizing I/O-aware design—whether through TokenWeave's fused communication kernels or FlashTP's sparsity-aware tensor products—the field is moving toward a future where the architecture of the model and the architecture of the hardware are inextricably linked. The goal is no longer just to do less math, but to move less data.