Abstract
Current deep learning compilers rely on greedy operator fusion heuristics that often miss global optimization opportunities and fail to exploit the high compute-to-memory-bandwidth ratio of modern GPUs. This paper introduces Korch, a novel tensor program optimizer that employs operator fission to decompose high-level operators into fine-grained primitives. By formalizing kernel selection as a Binary Linear Programming (BLP) problem, Korch identifies mathematically optimal orchestration strategies, including redundant computation to bypass memory bottlenecks. Evaluated on NVIDIA V100 and A100 GPUs, Korch achieves speedups of up to 1.7× over state-of-the-art frameworks like TensorRT and TVM.
Introduction
Deep Neural Networks (DNNs) are typically represented as directed acyclic graphs of high-level operators. To execute these efficiently on GPUs, compilers map operators to hardware-specific kernels. The standard optimization, operator fusion, reduces kernel launch overhead and intermediate memory traffic. However, existing compilers like TensorFlow, TensorRT, and TVM use hand-written greedy rules that suffer from two primary limitations: coarse granularity and suboptimal search. Fusing at the operator level often ignores internal components with distinct memory access patterns, while greedy algorithms miss global optima and rarely consider the benefits of redundant computation.
Methodology: The Korch Pipeline
Korch addresses these limitations through a systematic three-stage approach to kernel orchestration.
1. Operator Fission
Instead of treating operators as monolithic blocks, Korch decomposes them into basic tensor algebra primitives: Elementwise, Reduce/Broadcast, Layout Transformation, and Linear Transformation. This creates a "primitive graph" that offers significantly higher flexibility for fusion. For instance, a Softmax operator can be split, allowing its components to fuse with preceding or succeeding operators independently.
2. Kernel Identification and Profiling
Using a depth-first search (DFS), Korch identifies all valid "convex subgraphs" of primitives that can form a single GPU kernel. These candidate kernels are then profiled on the target hardware to obtain accurate latency measurements.
3. Optimal Orchestration via Binary Linear Programming (BLP)
Korch formalizes the selection of kernels as a BLP problem. The objective is to select a set of candidate kernels that covers the entire computation graph while minimizing total execution time.
Crucially, the formulation allows for redundant computation. If re-calculating a value in two different kernels is faster than storing and loading it from global memory, the BLP solver will select that strategy, directly exploiting the high floating-point throughput of modern hardware.
Evaluation and Results
The authors evaluated Korch on NVIDIA V100 and A100 GPUs using diverse workloads, including CNNs (Candy, YOLOv4, YOLOX-Nano) and Vision Transformers (Segformer, EfficientViT).
Korch consistently outperformed existing optimizers, providing an average speedup of 1.39× on V100 and 1.30× on A100. Peak speedups reached 1.7×. A key finding was the value of operator fission alone; when Korch’s decomposed primitive graph was fed into TensorRT, it still yielded a 1.24× speedup. In a specific case study of an EfficientViT attention block, Korch reduced the kernel count from 12 to 7, resulting in a 3.29× speedup for that subgraph.
Key Insights
- Compute vs. Memory: Modern GPUs have massive compute throughput but limited bandwidth. Korch exploits this by choosing redundant computation to bypass memory bottlenecks.
- Layout Awareness: Korch automatically discovers when layout changes (e.g., Transpose) facilitate faster downstream operations, even if the change itself incurs overhead.
- Mathematical Optimality: Moving from heuristics to BLP allows Korch to find non-obvious strategies that human experts might overlook.
Conclusion and Future Work
Korch demonstrates that moving beyond greedy operator fusion to a mathematically optimized orchestration of fine-grained primitives yields significant performance gains. While the current implementation requires substantial tuning time (e.g., 12.2 hours for YOLOv4) and is limited to single-output kernels, future work aims to expand the search space to multi-output kernels and exploit multi-streaming for parallel execution.
Summary updated