mirage-project/mirage

Mirage Persistent Kernel: Compiling LLMs into a MegaKernel

What it solves

Mirage Persistent Kernel (MPK) addresses the latency issues associated with multi-GPU LLM inference. It reduces inference latency by 1.2x to 6.7x by eliminating the overhead of multiple kernel launches and communication between GPUs.

How it works

MPK is a compiler and runtime system that transforms LLM inference into a single "megakernel"—a fused GPU kernel that handles all computation and communication within a single launch. Users define the computation graph by chaining fused operations (such as combining RMSNorm and Linear layers) and specifying tensor allocations. The system then compiles this graph into a high-performance, persistent kernel that executes on the GPU.

Who it’s for

Developers and researchers working on LLM inference optimization, specifically those looking to reduce latency in multi-GPU environments using CUDA and PyTorch.

Highlights

  • End-to-end GPU fusion: Fuses all necessary computation and communication into one kernel launch.
  • Significant latency reduction: Achieves 1.2x to 6.7x speedups over native Triton and FlashInfer kernels.
  • Automatic transformation: Automatically transforms models from the Hugging Face model zoo into megakernels.
  • Integrated profiling: Includes tools to visualize the execution timeline of each task within the megakernel.

Related

  • Project
  • Project
  • Project
  • Project
  • Project