Researchers from UC Berkeley's UCCL project have introduced mKernel, an open-source library of persistent CUDA kernels that fuses intra-node NVLink communication, inter-node RDMA, and compute into a single kernel. This approach aims to address the growing bottleneck of GPU communication in AI workloads, where data movement can consume up to 47% of execution time in mixture-of-experts models.
Traditional multi-GPU communication is host-driven, relying on the CPU to orchestrate collective operations via libraries like NCCL. However, as GPU compute power scales faster than CPU performance, microsecond-level host overhead—such as kernel launch delays and inter-stream synchronization—leads to pipeline bubbles. Moreover, host-driven systems can only overlap compute and communication at coarse kernel boundaries, missing finer-grained opportunities.
mKernel flips this model by making the GPU itself control transfers. It uses persistent kernels where thread blocks self-assign roles: compute, intra-communication (NVLink), inter-node send, and inter-node reduction. This allows compute and data movement to overlap at the tile or chunk level within a single kernel, covering both intra-node and inter-node communication.
The library includes five fused kernel patterns:
- AllGather + GEMM: Gathers matrix shards while simultaneously performing matrix multiplication on arriving tiles.
- GEMM + AllReduce: Computes a matrix product and reduces partial results across ranks in one launch.
- MoE Dispatch + GEMM: Routes tokens to expert ranks via all-to-all communication and runs per-expert grouped GEMM without staging buffers.
- Ring Attention: Exchanges KV chunks in a ring while computing attention on the previously received chunk.
- GEMM + ReduceScatter: Computes a matrix product and reduce-scatters the output, reducing each tile as it is produced.
mKernel was evaluated on two 2-node clusters, each with 8 NVIDIA H200 GPUs per node, using either AWS EFA or InfiniBand (ConnectX-7) interconnects. It was benchmarked against NCCL, Triton-distributed, Flux, Mercury, and other tools, though larger-scale results are pending.
Built on GPU-initiated RDMA writes via libibverbs, mKernel avoids dependency on NCCL or NVSHMEM. It requires NVIDIA Hopper GPUs (sm_90a), CUDA 12.9, and PyTorch, with specific setup for each networking backend.
By eliminating host orchestration and enabling fine-grained overlap, mKernel promises to reduce communication overhead in distributed AI training, particularly for large-scale models where data movement dominates.