# mlirSynth: Automatic, Retargetable Program Raising in Multi-Level IR using Program Synthesis

arXiv: https://arxiv.org/abs/2310.04196 · HTML: https://mlsanity.com/paper/2310.04196/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 18 of its 62 references that are in the map.
- First posted on arXiv 6 Oct 2023.

## Builds on (most cited first, 18 of 18)

- [PyTorch: An Imperative Style, High-Performance Deep Learning Library](https://mlsanity.com/paper/1912.01703/) (2019)
- [In-Datacenter Performance Analysis of a Tensor Processing Unit](https://mlsanity.com/paper/1704.04760/) (2017)
- [DeepCoder: Learning to Write Programs](https://mlsanity.com/paper/1611.01989/) (2016)
- [NVIDIA Tensor Core Programmability, Performance & Precision](https://mlsanity.com/paper/1803.04014/) (2018)
- [Tiramisu: A Polyhedral Compiler for Expressing Fast and Portable Code](https://mlsanity.com/paper/1804.10694/) (2018)
- [Learning to Infer Program Sketches](https://mlsanity.com/paper/1902.06349/) (2019)
- [Survey of Machine Learning Accelerators](https://mlsanity.com/paper/2009.00993/) (2020)
- [TF-Coder: Program Synthesis for Tensor Manipulations](https://mlsanity.com/paper/2003.09040/) (2020)
- [Automatic Program Synthesis of Long Programs with a Learned Garbage Collector](https://mlsanity.com/paper/1809.04682/) (2018)
- [Just-in-Time Learning for Bottom-Up Enumerative Synthesis](https://mlsanity.com/paper/2010.08663/) (2020)
- [Modeling Black-Box Components with Probabilistic Synthesis](https://mlsanity.com/paper/2010.04811/) (2020)
- [M3: Semantic API Migrations](https://mlsanity.com/paper/2008.12118/) (2020)
- [Predictive Synthesis of API-Centric Code](https://mlsanity.com/paper/2201.03758/) (2022)
- [Polly's Polyhedral Scheduling in the Presence of Reductions](https://mlsanity.com/paper/1505.07716/) (2015)
- [Automatically Leveraging MapReduce Frameworks for Data-Intensive Applications](https://mlsanity.com/paper/1801.09802/) (2018)
- [Matching Linear Algebra and Tensor Code to Specialized Hardware Accelerators](https://mlsanity.com/paper/2301.11659/) (2023)
- [Leveraging Parallel Data Processing Frameworks with Verified Lifting](https://mlsanity.com/paper/1611.07623/) (2016)
- [Type-Directed Program Synthesis and Constraint Generation for Library Portability](https://mlsanity.com/paper/1908.04546/) (2019)

## Abstract (arXiv)

MLIR is an emerging compiler infrastructure for modern hardware, but existing programs cannot take advantage of MLIR's high-performance compilation if they are described in lower-level general purpose languages. Consequently, to avoid programs needing to be rewritten manually, this has led to efforts to automatically raise lower-level to higher-level dialects in MLIR. However, current methods rely on manually-defined raising rules, which limit their applicability and make them challenging to maintain as MLIR dialects evolve. We present mlirSynth -- a novel approach which translates programs from lower-level MLIR dialects to high-level ones without manually defined rules. Instead, it uses available dialect definitions to construct a program space and searches it effectively using type constraints and equivalences. We demonstrate its effectiveness reviby raising C programs to two distinct high-level MLIR dialects, which enables us to use existing high-level dialect specific compilation flows. On Polybench, we show a greater coverage than previous approaches, resulting in geomean speedups of 2.5x (Intel) and 3.4x (AMD) over state-of-the-art compilation flows for the C programming language. mlirSynth also enables retargetability to domain-specific accelerators, resulting in a geomean speedup of 21.6x on a TPU.
