Home Knowledge Base Kernel Fusion

Kernel fusion is a GPU optimization technique that combines multiple sequential operations into a single kernel execution, reducing memory bandwidth consumption and kernel launch overhead. Bandwidth bottleneck: loading data from global memory is expensive; fusing ops (e.g., Conv+Bias+ReLU) keeps data in registers/cache between steps. Launch overhead: CPU launching a kernel takes time (microseconds); fusion reduces total launches. Implementation: operator fusion in compilers (XLA, TensorRT, Torch.compile) automatically identifies fuseable patterns. Common patterns: element-wise ops (add, mul, activation) following matrix multiplication or convolution. Vertical fusion: fuse producer and consumer into one loop. Horizontal fusion: fuse independent kernels acting on same data. Trade-off: fused kernel may use more registers, potentially reducing occupancy; compiler must balance bandwidth savings vs. occupancy. Framework support: PyTorch 2.0 (Inductor) and JAX rely heavily on fusion for performance. Custom kernels: writing fused CUDA/Triton kernels manually gives maximum control. Kernel fusion is often the single largest source of speedup for memory-bound deep learning workloads.

kernel fusionoptimization

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.