TL;DR
ComFuse is an automated GPU compilation system designed to break down the rigid execution boundaries between compute-intensive operators (like matrix multiplications) and complex, dependency-rich memory-intensive subgraphs (like reductions). By introducing a novel Stage-Stream Execution Model and a cluster-cooperative dataflow scheduling paradigm, ComFuse maximizes on-chip data reuse and successfully hides memory-intensive overheads behind tensor computation.
What Problem Does This Paper Address?
In modern deep learning workloads—especially large language models (LLMs) and recommendation systems—computation graphs are highly heterogeneous. They consist of compute-intensive operators like Matrix Multiplication (MatMul) alongside memory-intensive operators like ElementWise transformations and Reductions (e.g., LayerNorm, RMSNorm).
Existing deep learning compilers typically optimize these two classes of operators separately. This creates a rigid "materialization boundary" where intermediate results from a MatMul must be written out to Global Memory (GMEM) and then immediately reloaded by downstream reduction kernels. This off-chip data movement wastes massive amounts of memory bandwidth.
Fusing these operators together is notoriously difficult because they differ fundamentally in execution granularity, data organization, and synchronization requirements. Reductions, in particular, introduce complex data dependencies that span multiple elements and execution units, disrupting the simple element-to-element pipelining that traditional compilers rely on.
Methods
The authors introduce ComFuse, an automated compilation framework built on top of CUTLASS that implements two primary scheduling innovations:
- Stage-Stream Execution Model: Instead of materializing an entire intermediate tensor for a reduction, ComFuse recognizes that synchronization boundaries are actually confined to local subsets of tiles. It uses reduction operations as stage boundaries, decomposing a complex memory-intensive subgraph into sequentially executed Directed Acyclic Graphs (DAGs). Within a stage, data streams at a fine-grained "Fragment" level (register-file channels), and cross-thread block communication is handled entirely on-chip using Distributed Shared Memory (DSMEM) via modern GPU Thread Block Clusters.
- B2BGEMM Scheduling Paradigm: For back-to-back GEMM patterns separated by an intermediate epilogue subgraph, ComFuse introduces a cluster-cooperative dataflow mechanism. Intermediate tiles are kept entirely resident in thread registers and on-chip data paths, completely bypassing GMEM or Shared Memory (SMEM) write-backs. It also restructures execution into a four-stage pipeline ($ML_1 \rightarrow Epi_1 \rightarrow ML_2 \rightarrow Epi_2$) to overlap the two compute-heavy phases with their respective epilogy processing.
Datasets
As a compiler optimization paper, evaluation is performed using representative deep learning workload subgraphs (microbenchmarks) rather than static datasets:
- Stage-Stream Workloads: MatMul-BiasAdd-RMSNorm (MBR), MatMul-BiasAdd-LayerNorm-ReLU (MBLR), and MatMul-Scale-TanhSoftcap-Softmax (MSTS).
- B2BGEMM Workloads: Self-Attention, Target-Attention, and DLRM Bottom MLP.
Key Insights and Ideas
- Hardware Complementarity: Compute-intensive kernels primarily rely on specialized matrix units (Tensor Cores), while memory-intensive subgraphs utilize general-purpose CUDA cores. ComFuse exploits this by overlapping the two, effectively hiding the memory-bound epilogue "under the shadow" of the MatMul execution.
- Localizing the Boundary: By partitioning tensors into two-dimensional tile subsets, the synchronization required for a reduction is confined locally. This insight allows the compiler to avoid global tensor materialization entirely.
- The Fusion Trap: The authors discover that blindly fusing operators does not always guarantee better performance. If there is a severe workload imbalance—such as in standard Self-Attention where the Softmax stage dominates the small MatMul stage—the pipeline becomes imbalanced, and specialized hand-optimized libraries (like FlashAttention) will still win.
Key Results
ComFuse was evaluated against PyTorch's default compiler (TorchInductor) and NVIDIA's TensorRT:
- End-to-End Speedups: ComFuse consistently outperformed TorchInductor across post-norm workloads, achieving up to a 1.24$\times$ speedup.
- Residual Time Reduction: When isolating the time spent purely on the memory-intensive epilogue, ComFuse achieved up to a 9.93$\times$ speedup for complex subgraphs like MSTS by successfully hiding the latency behind the MatMul.
- B2BGEMM Performance: In the Target-Attention scenario, ComFuse achieved up to a 1.97$\times$ speedup over TorchInductor, matching or exceeding the performance of TensorRT without relying on rigid, fragile graph-level pattern matching.
Limitations and Future Work
A key limitation occurs at small computational scales (small batch or problem sizes). Here, the limited number of tiles prevents the pipeline from reaching a steady state, meaning the scheduling and coordination overhead can outweigh the benefits of joint fusion. Additionally, ComFuse currently lacks sophisticated optimization strategies tailored specifically for the core compute-intensive operators themselves.
Future work will focus on deepening the analysis of hardware architectural features to allow the system to adaptively select the best optimization strategies across highly diverse and imbalanced workloads.
Summary updated