Optimal Software Pipelining and Warp Specialization for Tensor Core GPUs

Rupanshu Soi, Rohan Yadav, Fredrik Kjolstad, Alex Aiken, Maryam Mehri Dehnavi, Michael Garland, Michael BauerarXiv 2025 · DOI

Abstract

Modern GPU architectures, such as NVIDIA’s Hopper and Blackwell, have introduced significant complexity in achieving peak performance. Developers must manually balance software pipelining (SWP) and warp specialization (WS), a process that often takes months of expert effort. This paper introduces Twill, a system that treats these two techniques as a joint optimization problem solved via Satisfiability Modulo Theories (SMT). Twill is the first system to automatically generate optimal execution schedules that match or exceed hand-tuned libraries like cuDNN and FlashAttention-3/4.

Introduction: The Complexity of Modern GPU Scheduling

To maximize throughput on Tensor Core GPUs, two interdependent techniques are essential:

  1. Software Pipelining (SWP): This technique overlaps data movement from one loop iteration with the computation of another, ensuring that functional units do not sit idle while waiting for memory.
  2. Warp Specialization (WS): This involves assigning distinct roles to different groups of threads (warps). For instance, "loader" warps handle data movement while "compute" warps execute matrix multiplications.

On newer architectures like Hopper, hardware instruction issue is "in-order," meaning a single warp cannot effectively hide latencies in a complex pipeline. Warp specialization becomes a requirement rather than an optimization. However, the interdependence between SWP and WS—where a specific pipeline depth might exceed register limits or cause synchronization stalls—makes manual scheduling extremely difficult.

Software pipelining overlaps operations (S, P, O) across the Tensor Core (TC) and Special Function Unit (SFU) to achieve a steady-state execution pattern.

Methods: Joint Optimization via Twill

Twill automates the discovery of optimal schedules by formulating the task as a joint optimization problem. The system takes Triton IR as input and performs the following steps:

Modulo Scheduling and SMT Formulation

Twill adapts classic modulo scheduling to find the minimum initiation interval (II)—the number of cycles between starting consecutive loop iterations. It translates hardware constraints, including functional unit capacity, register limits (255 per thread), and synchronization requirements, into a system of logic equations. An SMT solver (Yices2) then searches for a valid schedule and warp assignment simultaneously.

Cost Normalization

To handle the high cycle counts of GPU operations (e.g., a 1000-cycle GEMM) without overwhelming the solver, Twill uses Integer Linear Programming (ILP) to scale these costs into manageable ratios. This preserves the performance bottlenecks while simplifying the mathematical search space.

The Twill framework maps input code to a dependency graph and uses SMT solvers to generate a modular Resource Reservation Table (RRT) that respects hardware constraints.

Key Insights

  • Realizable Schedules: By including register pressure as a hard constraint in the SMT solver, Twill ensures that the generated schedules do not exceed the physical limits of the GPU hardware.
  • Non-Intuitive Strategies: Twill discovered "ping-pong" schedules where warps switch roles or interleave work in ways that human experts rarely consider, yet these strategies maximize hardware utilization.

Results and Evaluation

Twill was evaluated on computationally intensive kernels, specifically Fused Multi-Head Attention (FMHA) on NVIDIA H100 (Hopper) and B200 (Blackwell) GPUs.

  • Expert-Level Performance: Twill automatically rediscovered the complex scheduling strategies used in Flash Attention 3 and 4. The generated schedules achieved performance within 1% to 2% of these hand-tuned, state-of-the-art libraries.
  • Search Efficiency: Despite the vast search space, Twill found optimal schedules in 19 to 269 seconds.
  • Blackwell Optimization: On the new Blackwell architecture, Twill successfully managed the new Tensor Memory hierarchy, significantly outperforming standard Triton-generated code.

Conclusion and Future Work

Twill demonstrates that formal logic can replace human intuition in the design of high-performance GPU kernels. While currently limited to singly-nested loops and requiring manual integration into CUDA to avoid sub-optimal compiler heuristics, Twill represents a major step toward fully automated, provably optimal GPU programming. Future work will focus on handling nested loops and integrating Twill directly into production compiler backends.

Summary updated

BibTeX
@misc{soi2025optimal,
  author = {Rupanshu Soi and Rohan Yadav and Fredrik Kjolstad and Alex Aiken and Maryam Mehri Dehnavi and Michael Garland and Michael Bauer},
  title = {{Optimal Software Pipelining and Warp Specialization for Tensor Core GPUs}},
  year = {2025},
  eprint = {2512.18134},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.18134},
}
Figure