Manuscript Offprint

arXiv:2610.37200

PipeLink: Contract-Guided Linking of GPU Kernel Components

Jize Guo, Xupeng Miao

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

The fastest machine-learning kernels are compositions of components, such as loaders, matrix-multiply mainloops, epilogues and communication stages, that run concurrently on one GPU streaming multiprocessor and share its on-chip memory, barriers, warps and registers. Because these components hard-code where they sit in this shared space, they cannot be compiled, shipped or replaced on their own: combining components from different sources means forking them by hand or keeping them in separate kernels. We present PipeLink, a contract-guided linker for GPU kernel components. Each component is compiled separately into an LTO object that carries a contract stating what it requires and what it promises; PipeLink checks the contracts against each other, relocates every component by solving one joint placement of the SM's resources, and generates the transfers between them, and the vendor LTO backend folds the result into constants. Across 51 configurations on Hopper and Blackwell GPUs, linked kernels run within 0.2% of the same sources compiled as one unit. Linking makes new compositions practical: a CuTe attention operator inside a ThunderKittens decode megakernel speeds up decoding by 2.16×2.16\times, a four-owner MoE training megakernel matches the original monolith, one unchanged attention core yields sparse and context-parallel variants that outperform FlexAttention, vLLM and Transformer Engine, and a GEMM + SwiGLU composition whose consumer serves three GPU architectures runs 1.2×1.2\times faster on Blackwell than cuBLAS with a compiled activation.

1 INTRODUCTION

The fastest machine-learning kernels on modern GPUs are no longer single operators. An attention kernel in the FlashAttention family runs a tile loader, a matrix-multiply mainloop, a softmax stage and an epilogue as groups of warps that execute concurrently and hand tiles to each other through on-chip memory (Shah et al., 2024; Zadouri et al., 2026). Megakernels go further and run an entire decode step or training pass inside one persistent kernel (Spector et al., 2025a; Cheng et al., 2026; Jin et al., 2026; Sul et al., 2026b), and communication-overlapped kernels move data between GPUs while they compute (Chang et al., 2024; Zheng et al., 2025b; Sul et al., 2026a). Each such kernel is a composition of components that cooperate at fine grain on the same streaming multiprocessor (SM).

Yet these components cannot be built, shipped or replaced as components. They agree on physical facts that no interface records: which bytes of shared memory each one owns, which barriers and warps it uses, how many registers it may hold, and which tile sizes its neighbors schedule against. Whoever wants to combine components from different sources therefore faces a dilemma: fork the sources and re-derive these facts by hand, or keep the components in separate kernels. Megakernels take the first path: they are written as one translation unit, by one team, in one library, so adopting a faster operator from another library, such as a CuTe (Thakkar et al., 2023) attention in a ThunderKittens (Spector et al., 2025b) megakernel (Spector et al., 2025a), means porting it to the megakernel's conventions by hand. New attention variants also start as forks of an expert kernel, and systems that move context-parallel communication into the kernel write or modify their own attention kernel (Sul et al., 2026a; Qiang et al., 2026). Production context-parallel attention takes the second path: it calls an unmodified FlashAttention kernel once per key/value block and runs the transfers between GPUs and the correction of partial outputs as separate operations around it (NVIDIA, f; zhuzilin; Fang & Zhao, 2024), paying for every kernel boundary in launches, memory traffic and lost overlap.

Existing tools compose kernels either before or below this boundary. Template libraries, domain-specific languages and warp-specialization compilers compose operations within one source program that they own (Thakkar et al., 2023; Dong et al., 2025; Wang et al., 2026; Chen et al., 2026b; Soi et al., 2026; Yadav et al., 2025). Device linking with link-time optimization (LTO) does combine separately compiled code into one kernel at no runtime cost (Sundaram et al., 2023), but it links by symbol: it records which names

1^{1}School of Computer Science, Peking University, Beijing, China. Correspondence to: Xupeng Miao xupeng.miao@pku.edu.cn.

Preprint. Under review.

Figure

Figure 1. PipeLink overview. Separately compiled components carry contracts at their interfaces (left). PipeLink checks the contracts, relocates the components and generates the code between them, so the same compiled attention core lands at different shared-memory offsets in two kernels (right). Lane widths are schematic.

each fragment defines and needs, and nothing about the resources it occupies or the facts its neighbors compiled against. When one owner of a mixture-of-experts (MoE) training kernel changes a tile size and recompiles alone, device linking accepts the stale combination, and the kernel hangs or silently leaves outputs unwritten (Section 2.4).

We argue that kernel components need what object files gave whole programs: a contract that states what crosses the component boundary, and a linker that relocates each component into the kernel it joins. Today's components are, in effect, absolute-addressed: they hard-code their positions in a small on-chip address space that every other component shares. A relocatable component instead declares what it requires and what it promises, and reads its placement through bindings fixed only at link time. Our thesis is that such contracts, checked and bound at link time, let separately compiled components share one SM as efficiently as if their sources had been merged by hand.

This paper presents PipeLink, a contract-guided linker for GPU kernel components. Each component is compiled separately into an LTO object that carries its contract. PipeLink checks the contracts against each other, solves one joint placement of all components' on-chip resources for the composition at hand, generates the code that moves tensors between components, and binds the memory that communication components share across GPUs. The vendor LTO backend then folds the placement into constants, so linking costs nothing at run time.

We evaluate PipeLink on Hopper and two generations of Blackwell GPUs. Across 51 timed configurations, linked kernels run within 0.2% of the same sources compiled as a single unit, and compositions that previously required a fork become practical:

• a CuTe attention operator inside a ThunderKittens Llama-1B decode megakernel decodes 2.16×2.16 \times faster at a 4096-token context;

• an MoE training megakernel split among four owners matches the original monolith (0.99−1.01×)(0.99-1.01\times) and survives every stale-owner upgrade;

• one unchanged attention core yields sparse attention up to 38×38 \times faster than FlexAttention and context-parallel attention 1.20−1.31×1.20-1.31 \times faster than Transformer Engine;

• a fused GEMM and SwiGLU for Qwen3-32B, whose consumer links with producers on three GPU architectures, runs 1.20×1.20 \times faster on B300 than cuBLAS followed by a compiled SwiGLU.

In summary, this paper makes the following contributions:

• Component contracts, which state what a concurrently running GPU kernel component requires and promises, so that it can be compiled, distributed and replaced on its own, without its source (Section 3).

• A contract-guided linker that checks contracts against each other, relocates components by jointly solving their placement, and generates the data transfers between them (Section 4).

• Zero-cost composition of real ML kernels across libraries, owners and GPU architectures (Section 5).

References (67)