Inferensys

Glossary

Fusion-Aware Scheduling

Fusion-aware scheduling is a compiler technique that makes high-level loop and memory mapping decisions with the explicit goal of enabling profitable operator fusion to reduce kernel launch overhead and improve data locality.
Cinematic overhead of a WeWork creative suite room with multiple curved monitors showing AI decision dashboards, executives in casual attire reviewing data, dramatic pendant lighting.
COMPILER OPTIMIZATION

What is Fusion-Aware Scheduling?

A compiler technique that integrates operator fusion decisions into high-level loop and memory transformations.

Fusion-aware scheduling is a compiler optimization technique that makes high-level decisions about loop tiling, parallelization, and memory mapping while explicitly considering the potential for operator fusion. Unlike a traditional two-phase approach, it unifies the fusion planner and the loop scheduler to produce a globally optimal execution plan. This ensures that fusion decisions, such as creating a fused kernel, directly inform how data is partitioned across the memory hierarchy and computational units.

The scheduler evaluates fusion profitability using a cost model that balances reduced kernel launch overhead and improved data locality against potential downsides like increased register pressure. By being fusion-aware, it can strategically apply vertical fusion or horizontal fusion to transform memory-bound operations into compute-bound ones, maximizing hardware utilization. This technique is foundational in compilers like XLA, TVM, and MLIR for generating high-performance code for neural networks.

COMPILER OPTIMIZATION

Key Objectives of Fusion-Aware Scheduling

Fusion-aware scheduling is a compiler technique that strategically plans high-level execution decisions—like loop tiling and parallelization—with the explicit goal of enabling profitable operator and kernel fusion. Its objectives are to maximize hardware efficiency by minimizing data movement and computational overhead.

01

Maximize Data Locality

The primary objective is to restructure computation to keep intermediate tensor data within fast, on-chip memory hierarchies (e.g., GPU shared memory or L1/L2 caches). By fusing producer and consumer operators, the scheduler eliminates expensive round-trips to global memory (DRAM). This is critical for memory-bound operations where data transfer, not computation, is the bottleneck.

  • Example: Fusing an element-wise activation (ReLU) directly after a matrix multiplication allows the activation to be computed on the multiplication's output while it's still in registers or cache, preventing a write and subsequent read from DRAM.
02

Amortize Kernel Launch Overhead

Each independent GPU kernel launch incurs fixed scheduling and dispatch latency. Fusion-aware scheduling aims to reduce the total number of kernel launches by grouping many small, sequential operations into fewer, larger fused kernels. This amortizes the launch overhead over more useful work, improving overall throughput, especially for networks with many light-weight layers.

  • Technical Detail: On modern GPUs, kernel launch overhead can be on the order of microseconds. For models with hundreds of small ops (e.g., activations, biases), this overhead can dominate execution time if not fused.
03

Increase Arithmetic Intensity

This objective focuses on making better use of the hardware's raw compute power (FLOPS). The scheduler combines compute-bound operations (like convolutions) with adjacent memory-bound operations (like biases or scaling) into a single kernel. This increases the arithmetic intensity (FLOPs per byte of DRAM access) of the fused kernel, moving the workload closer to the hardware's peak computational throughput.

  • Result: A fused Conv-BN-ReLU kernel performs the convolution, batch normalization scaling/shifting, and ReLU in one pass, maximizing FLOPs utilization compared to three separate, memory-intensive kernels.
04

Enable Aggressive Loop Transformations

Fusion-aware scheduling uses loop transformations—tiling, unrolling, vectorization—not just for a single operation, but across fused operator boundaries. The scheduler can tile a loop nest that encompasses multiple fused ops, allowing shared data to be staged in a tile and reused across all operations within that tile. This is more effective than optimizing each op in isolation.

  • Mechanism: When ops A and B are fused, the scheduler can create a single, complex loop structure that loads input data, computes A, immediately consumes its output for B, and then writes the final result, all within a tailored tile size that fits the cache.
05

Balance Parallelism with Fusion Profitability

There is a fundamental tension between fusion and parallelism. Fusing too many operators can create monolithic kernels that limit parallel execution opportunities (e.g., by reducing independent work for GPU thread blocks). A key objective of the scheduler is to model this trade-off.

  • The Scheduler's Decision: It uses a cost model to evaluate whether fusing a group of ops will improve performance more than executing them in parallel. It must consider register pressure, shared memory usage, and available parallelism on the target hardware (SM count on GPU).
06

Generate Hardware-Specific Fused Kernels

The scheduler's decisions are tightly coupled to the target accelerator's architecture. Its objective is to produce a fusion plan that allows the downstream fusion compiler (e.g., in XLA, TVM, or MLIR) to generate an optimal fused kernel for that specific hardware.

  • Hardware Awareness: The schedule for an NVIDIA A100 (with Tensor Cores) will differ from one for an AMD MI250X or an Intel CPU. The scheduler considers factors like memory bandwidth, cache sizes, vector unit width, and supported instruction sets (e.g., DP4A for INT8) when making fusion decisions to enable the most efficient final kernel code.
FUSION-AWARE SCHEDULING

Frequently Asked Questions

Fusion-aware scheduling is a compiler technique that considers the potential for operator fusion when making high-level decisions about loop tiling, parallelization, and memory hierarchy mapping. This FAQ addresses its core mechanisms, benefits, and relationship to other optimization techniques.

Fusion-aware scheduling is a compiler optimization pass that makes high-level loop and memory mapping decisions with explicit consideration for subsequent operator fusion and kernel fusion opportunities. It works by analyzing the computational graph and its loop nests to schedule operations—such as tiling, parallelization, and memory promotion—in a way that maximizes the fusion profitability of resulting fusion groups. For example, it might decide to tile two loops to the same size or promote certain tensors to shared memory to enable a profitable vertical fusion that would otherwise be impossible due to mismatched iteration spaces or memory access patterns. This proactive coordination ensures that later fusion passes can generate highly efficient fused kernels that minimize kernel launch overhead and maximize data locality.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.