mirage-project/mirage
Mirage Persistent Kernel: Compiling LLMs into a MegaKernel
What it solves
Mirage Persistent Kernel (MPK) addresses the high latency associated with multi-GPU LLM inference. It eliminates the overhead of launching multiple GPU kernels and the communication bottlenecks between them by fusing the entire inference process into a single "megakernel."
How it works
MPK acts as a compiler and runtime system that transforms the LLM's computation graph into a single fused GPU kernel. Instead of launching separate kernels for each operation, it performs all necessary computation and communication within one launch. Developers define the kernel's inputs, outputs, and the computation graph by chaining fused operations (such as rmsnorm_linear_layer) and then compile the graph into an optimized executable kernel.
Who it’s for
ML engineers and researchers focusing on low-latency LLM inference and GPU optimization who want to reduce inference latency without requiring extensive manual CUDA programming.
Highlights
- Significant Latency Reduction: Reduces LLM inference latency by 1.2x to 6.7x.
- End-to-End Fusion: Fuses computation and communication into a single GPU kernel launch.
- Automatic Compilation: Allows compiling Hugging Face models into megakernels using a high-level Python API.
- Integrated Profiling: Includes tools to visualize the execution timeline of each task within the megakernel.
Related
- Project
- Project
- Project
- Project
- Project