arXiv:2611.07477cs.DCNov 2026

Manuscript Offprint

arXiv:2611.07477

KOSMOS: Self-scheduling Persistent Kernels for Communication-Compute Overlap

Alexander Magro, Aristotle Martin, Ye Wang, Wen Chen

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

ABSTRACT

Tensor and sequence parallelism (TP+SP) and expert parallelism (EP) put collectives on the critical path of transformer layers. State-of-the-art fused kernels mitigate this with fixed roles or schedules, but this rigidity leaves large idle windows. Predicting a communication-computation split does not remove them either; a predetermined split cannot follow data readiness. We present KOSMOS, a library for self-scheduling persistent kernels whose workgroups use queues ordered by consumer demand to switch between communication and computation roles as data become ready, with no scheduler, per-call cost model, or tuned split. KOSMOS fuses every TP+SP collective of a transformer layer with its GEMM, and runs an entire expert layer, from router to fold, in one launch per direction. Evaluated on AMD Instinct™ MI350X and AMD Instinct™ MI355X GPUs, KOSMOS speeds up TP+SP end-to-end training in Megatron-LM by 1.10–1.28× in BF16 and 1.10–1.25× in MXFP8. KOSMOS accelerates end-to-end training of DeepSeek-V3 and Qwen3-235B proxies by 1.29–1.83× over DeepEP.

1 INTRODUCTION

Training frontier large language models (LLMs) requires parallelism strategies that trade memory for communication. Memory reduction strategies such as tensor and sequence parallelism (TP+SP) and expert parallelism (EP) in Mixture-of-Experts (MoE) put collectives on the critical path. TP+SP wraps every transformer block in all-gather (AG) and reduce-scatter (RS) collectives, whereas EP in MoE models adds all-to-alls (A2A) around each expert layer. To keep matrix cores and links saturated, overlapping communication and computation is critical to training throughput.

Fusing communication into general matrix multiplication (GEMM) avoids hardware-scheduler contention and moves data at tile granularity, overlapping with the GEMM's tile-based computation. Prior fused kernels dedicate a fixed number of compute units (CUs) to communication (Zheng et al., 2025a; Awad et al., 2025; Sul et al., 2026a) or assign each workgroup (WG) its tasks with a scheduler (Aimuyo et al., 2025; Cheng et al., 2026). However, communication demand is not fixed: In dense collectives it shifts as the kernel progresses, and in MoE it shifts with each batch's routing. Predicting a split of communication and computation WGs does not solve this issue. A planned split from a cost model before each call is slower than a fixed split in our measurements (Table 2). Even adapting splits at runtime, as mKernel does with a kernel controller, leaves their kernel

1.18× slower than the best fixed split (Mao et al., 2026).

We present KOSMOS (Kernel-Overlapped Self-scheduling Megakernels On Symmetric-memory), a library of persistent kernels in which WGs dynamically change roles as the kernel runs. A WG is either a mover, which mainly communicates, or a builder, which mainly computes GEMM tiles. A WG selects its role from data readiness, with no scheduler or per-call cost model. Scheduling is implicit: Data is produced in the order consumers claim it. Builders start on local data while movers gather; reductions are produced, ordered by groups of tiled rows (band-major), so every rank's movers start after one step, and dispatch delivers experts in the order each GEMM consumes them.

The switching policy is set by each collective-GEMM pair (Figure 1). In AG+GEMM and MoE dispatch, movers become builders once their transfers are done; in GEMM+RS (Figure 1(A)), builders join the reduction when the GEMM work queue is exhausted; in MoE combine (Figure 1(B)) WGs switch both ways, pushing whenever data is ready and building otherwise. The policy is designed around the shape of the demand: Two-way switching is slower for TP+SP and A2A dispatch collectives whose demand is monotonic; one-way switching leaves combine gaps larger than needed.

KOSMOS provides broad coverage, including, to our knowledge, the first readiness-driven TP+SP fused kernels and MoE megakernels for training. Our contributions are:

  1. Self-scheduling persistent kernels, with producer and consumer queues co-designed per collective around data readiness. WGs may then switch roles from local

¹Advanced Micro Devices Inc., Austin, TX, USA. Correspondence to: Alexander Magro alex.magro@amd.com.

Preprint.

A

B

Figure

Figure

t

Figure

Figure 1. CU timelines and work queues on eight GPUs for (A) fused AG and RS and (B) the MoE forward and backward. Each CU runs one persistent WG; queues hold GEMM output tiles, and hatched segments are transfers (color = rank or expert). (A) The AG queue holds local tiles first, then peer tiles interleaved row by row; the RS queue is band-major (pattern = band). AG movers (CUs 0–1 of m) become builders once their transfers finish; in RS, builders become movers when the GEMM queue empties. (B) The forward queue is expert-major; GEMM1 before GEMM2; the backward queue holds GEMM2 then GEMM1 gradient tiles, interleaving dG and dV. All CUs first route and plan (purple); dispatchers push, then build; combine movers (CUs d, d + 1) build until a combine unit is ready, then interleave pushes with GEMM2 tiles. Backward: dY is dispatched first and the dX combine overlaps the GEMM1 gradients.

tile-level checks. Switching lets a shape-only heuristic replace per-shape tuning: within 1% of, and up to 15% faster than, the best single fixed split. A fixed split in turn beats a split predicted per call.

  1. A characterization of where idle time falls in fused communication kernels and a policy rule that reduces it: one-way switching for monotonic demand, two-way switching for interleaved demand.

  2. Complete kernel coverage for training: persistent fused kernels for every TP+SP collective, forward and backward, in BF16 and MXFP8, and the first role-switching MoE layer with a single launch per direction, from router to fold, including gradients, evaluated end-to-end in Megatron-LM on two GPU models.

  3. Communications optimized for bytes/CU/s: collectives for fully connected meshes that saturate the bandwidth while maintaining fine grained access, and measurements showing that on power-capped GPUs the CUs lent to communication cost the GEMM little.

We demonstrate KOSMOS on MI350-series GPUs and expect many of its findings to generalize to other systems: On AMD Instinct™ MI350X and AMD Instinct™ MI355X GPUs, KOSMOS speeds up end-to-end Llama 3 training by up to 1.28× over Transformer Engine (TE), and its MoE layers speed up training by up to 1.83× over DeepEP.

References (41)