First-Class Verification Dialects for MLIR
Mathieu Fehr, Yuyou Fan, Hugo Pompougnac, John Regehr, Tobias Grosser
Abstract
MLIR is a toolkit supporting the development of extensible and composable intermediate representations (IRs) called dialects; it was created in response to rapid changes in hardware platforms, programming languages, and application domains such as machine learning. MLIR supports development teams creating compilers and compiler-adjacent tools by factoring out common infrastructure such as parsers and printers. A major limitation of MLIR is that it is syntax-focused: it has no support for directly encoding the semantics of operations in its dialects. Thus, at present, the parts of MLIR tools that depend on semantics-optimizers, analyzers, verifiers, transformers-must all be engineered by hand.
Our work makes formal semantics a first-class citizen in the MLIR ecosystem. We designed and implemented a collection of semantics-supporting MLIR dialects for encoding the semantics of compiler IRs. These dialects support a separation of concerns between three domains of expertise when building formal-methods-based tooling for compilers. First, compiler developers define their dialect's semantics as a lowering (compilation transformation) from their dialect to one or more of ours. Second, SMT solver experts provide tools to optimize domain-specific high-level semantics and lower them to SMT queries. Third, tool builders create dialect-independent verification tools.
We validate our work by defining semantics for five key MLIR dialects, defining a state-of-the-art SMT encoding for memory-based semantics, and building three dialect-agnostic tools, which we used to find five miscompilation bugs in upstream MLIR, verify a canonicalization pass, and also formally verify transfer functions for two dataflow analyses: "known bits" (that finds individual bits that are always zero or one in all executions) and "demanded bits" (that finds don't-care bits). The transfer functions that we verify are improved versions of those in upstream MLIR; they detect on average 36.6% more known bits in real-world MLIR programs compared to the upstream implementation.
CCS Concepts: • Software and its engineering → Compilers.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 05e151f5-f7db-4d1b-af38-679ffa175306Cited by top-tier papers2
- Towards Designing Future-Proof Data Processing SystemsMichael Jungmair, Jana GicevaVLDB 2025 · 1 citation
- Nice to Meet You: Synthesizing Practical MLIR Abstract TransformersXuanyu Peng, Dominic Kennedy, Yuyou Fan, Ben Greenman et al.POPL 2026
Builds on7
- Alive2: bounded translation validation for LLVMNuno P. Lopes, Juneyoung Lee, Chung-Kil Hur, Zhengyang Liu et al.PLDI 2021 · 109 citations
- Towards a verified range analysis for JavaScript JITsFraser Brown, John Renner, Andres Nötzli, Sorin Lerner et al.PLDI 2020 · 28 citations
- SMT-Based Translation Validation for Machine Learning CompilerSeongwon Bang, Seunghyeon Nam, Inwhan Chun, Ho Young Jhoo et al.CAV 2022 · 12 citations
- Hydra: Generalizing Peephole Optimizations with Program SynthesisManasij Mukherjee, John RegehrOOPSLA 2024 · 11 citations
- Speeding up SMT Solving via Compiler OptimizationBenjamin Mikek, Qirun ZhangFSE 2023 · 11 citations
Related papers
- Ratte: Fuzzing for Miscompilations in Multi-Level Compilers Using Composable SemanticsPingshi Yu, Nicolas Wu, Alastair F. DonaldsonASPLOS 2025 · 3 citations
- IRDL: an IR definition language for SSA compilersMathieu Fehr, Jeff Niu, River Riddle, Mehdi Amini et al.PLDI 2022 · 13 citations
- MLIRSmith: Random Program Generation for Fuzzing MLIR Compiler InfrastructureHaoyu Wang, Junjie Chen, Chuyue Xie, Shuang Liu et al.ASE 2023 · 16 citations
- DESIL: Detecting Silent Bugs in MLIR Compiler InfrastructureChenyao Suo, Jianrong Wang, Yongjia Wang, Jiajun Jiang et al.OOPSLA 2025 · 2 citations
- Finding Bugs in MLIR Compiler Infrastructure via Lowering Space ExplorationJingjing Liang, Shan Huang, Ting SuASE 2025
