TL;DR
FlashFuser is the first compiler framework to leverage Distributed Shared Memory (DSM) on modern GPUs to break the memory capacity bottleneck in kernel fusion. By utilizing high-speed inter-core connections, it expands the scope of fusible operators to large-scale chains like Transformer Feed-Forward Networks, reducing global memory access by 58% and achieving up to a 4.1x kernel speedup over state-of-the-art compilers.
What Problem Does This Paper Address?
In modern hardware, GPU compute power is growing much faster than memory bandwidth. For instance, the NVIDIA H100 provides a 3.3x boost in FP16 compute capability over the previous-generation A100, but its global memory (HBM) bandwidth only increased by 1.5x. This disparity—often called the "memory wall"—makes deep learning workloads heavily memory-bound, particularly during General Matrix Multiplications (GEMMs) in Feed-Forward Networks (FFNs).
Kernel fusion is the standard optimization technique to combat this. It combines multiple operations into a single GPU kernel so that intermediate results can be kept in fast, on-chip local shared memory (SMEM) instead of making slow round-trips to global memory. However, traditional compilers are constrained by the tiny capacity of a single Streaming Multiprocessor's (SM) local SMEM. When intermediate data exceeds this threshold (typically ~227KB on an H100), traditional fusion fails and falls back to slow global memory round-trips.
Modern GPUs introduce Distributed Shared Memory (DSM) to link SMs together via an inter-core network-on-chip, but existing software frameworks lack the abstractions and compiler machinery to exploit this for complex, multi-stage kernel fusion.
Methods
FlashFuser bridges this gap by introducing a three-part compiler architecture designed to exploit DSM:
dsm_commPrimitives: A set of communication abstractions (such asdsm_shuffle,dsm_all_exchange, anddsm_reduce_scatter) that formalize data movement across SM clusters. This allows the compiler to support both standard FFNs and structurally complex variants like Gated FFNs (SwiGLU).- Dataflow Analyzer: A component that maps out how data should be staged and progressively spilled across the multi-level memory hierarchy (registers $\rightarrow$ SMEM $\rightarrow$ DSM $\rightarrow$ L2/Global memory) based on loop scheduling and tile sizes.
- Fusion Search Engine: Because considering DSM expands the search space exponentially (from roughly $10^4$ to $10^6$ possibilities for large models), FlashFuser uses an analytical cost model combined with hardware-aware pruning rules (e.g., cluster size constraints, activation alignment rules) to efficiently discover the optimal execution plan.
Datasets
The authors evaluated FlashFuser on compute-intensive operator chains extracted from mainstream Large Language Models (LLMs), Recommendation Systems, and Convolutional Neural Networks (CNNs). Workloads included GEMM and Gated FFN configurations from GPT-2, GPT-6.7B, LLaMA (1B, 2-7B, 3.2-3B), OPT-1.3B, BERT, DLRM, Qwen (2.5, 3), and convolution chains from ResNet.
Key Insights and Ideas
- Breaking the Single-SM Prison: Traditional fusion treats each SM as an isolated island. FlashFuser re-imagines the GPU as a cluster of interconnected cores, turning fragmented local memory into a cooperative, shared on-chip pool.
- The Double-Edged Sword of Cluster Scaling: Increasing cluster size provides more aggregate memory but can increase latency and degrade bandwidth. FlashFuser realizes that choosing cluster size is a non-trivial optimization problem that requires strict analytical modeling rather than simple heuristics.
- Progressive Spilling: Instead of an all-or-nothing approach to fusion, FlashFuser gracefully spills data down the memory hierarchy, maximizing the use of the fastest tiers (registers and SMEM) before utilizing DSM.
Key Results
- Massive Kernel Speedups: On an NVIDIA H100 GPU, FlashFuser achieved average kernel speedups of 3.1x over PyTorch/cuBLAS and 4.1x over state-of-the-art compilers like Chimera (which fails on large models due to SMEM limits).
- Drastic Memory Traffic Reduction: Global memory access was reduced by 58% on average compared to non-fused baselines, directly addressing the memory wall bottleneck.
- End-to-End Impact: Integrated into the SGLang inference framework, FlashFuser delivered an overall 1.24x end-to-end speedup for LLM inference workloads.
Limitations and Future Work
- Hardware Specifics: The current implementation is heavily optimized for NVIDIA's Hopper architecture (H100) and its crossbar-based DSM interconnect.
- Mesh Architectures: Adapting FlashFuser to mesh-based architectures (like Cerebras WSE) remains future work, requiring different physical mapping strategies for shuffle groups.
- Dynamic Shapes: The search engine operates offline, relying on table look-ups for varying dimensions (like batch size $M$), which might face challenges if all tensor dimensions become highly dynamic at runtime.
Summary updated