Mirage: A Multi-Level Superoptimizer for Tensor Programs

Mengdi Wu, Xinhao Cheng, Shengyu Liu, Chunan Shi, Jianan Ji +5 more
5/9/2024
cs.LGcs.AIcs.PL

Official code: mirage-project/mirage (2,384 stars, Apache-2.0, last commit 2026-05-01).

Abstract

We introduce Mirage, the first multi-level superoptimizer for tensor programs. A key idea in Mirage is $μ$Graphs, a uniform representation of tensor programs at the kernel, thread block, and thread levels of the GPU compute hierarchy. $μ$Graphs enable Mirage to discover novel optimizations that combine algebraic transformations, schedule transformations, and generation of new custom kernels. To navigate the large search space, Mirage introduces a pruning technique based on abstraction that significantly reduces the search space and provides a certain optimality guarantee. To ensure that the optimized $μ$Graph is equivalent to the input program, Mirage introduces a probabilistic equivalence verification procedure with strong theoretical guarantees. Our evaluation shows that Mirage outperforms existing approaches by up to 3.3$\times$ even for DNNs that are widely used and heavily optimized. Mirage is publicly available at https://github.com/mirage-project/mirage.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Mirage Persistent Kernel: Compiling LLMs into a MegaKernel

2,384232C, C++May 8, 20245 months agoApache-2.0

Cite this paper

@article{wu2024mirage,
  title  = {Mirage: A Multi-Level Superoptimizer for Tensor Programs},
  author = {Mengdi Wu and Xinhao Cheng and Shengyu Liu and Chunan Shi and Jianan Ji and Kit Ao and Praveen Velliengiri and Xupeng Miao and Oded Padon and Zhihao Jia},
  year   = {2024},
  eprint = {2405.05751},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.05751v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.05751.svg)](https://codeofpaper.com/paper/2405.05751)

Discussion