一句话:提出 lowering 空间探索技术,动态构造多样 lowering 路径并比较执行结果,自动发现 MLIR 中的缺陷。
MLIR 是被广泛采用的编译器基础设施,支持多级 IR 与可复用组件,其正确性至关重要,因为缺陷会传播到下游系统。MLIR 通过可配置的 pass 序列将高层程序逐步 lowering 到低层表示,同一程序往往存在多条合法 lowering 路径,由此产生 lowering 等价性:同一 MLIR 程序的所有合法 lowering 路径应产生语义等价的结果。本文利用该性质提出 lowering 空间探索来有效测试 MLIR 基础设施:方法以自适应、逐步的方式动态构造多样的 lowering 路径,并借助基于反馈的调度机制进行选择,通过比较不同路径的执行结果来发现缺陷,任何不一致都提示 MLIR 基础设施中可能存在 bug。作者将该方法实现为工具 LOBE,并在最新 MLIR 版本上评估,共发现 38 个此前未知的缺陷,其中 8 个为误编译、30 个为崩溃,25 个已被确认或修复。据作者所知,这是首个从探索编译空间角度测试 MLIR 的工作。
MLIR is a widely adopted compiler infrastructure that supports multi-level IRs and reusable components. Ensuring its correctness is critical, as bugs can propagate to downstream systems. MLIR provides a lowering mechanism that transforms high-level programs into low-level representations through configurable sequences of passes, and allows multiple valid lowering paths for a given program. This gives rise to a lowering equivalence property: all valid lowering paths for the same MLIR program should produce semantically equivalent results. In this paper, we leverage this property and propose lowering space exploration, to effectively test the MLIR infrastructure. Our approach dynamically constructs diverse lowering paths in an adaptive, stepwise manner using a feedback-based scheduling mechanism. It finds bugs by comparing the execution results across these paths. Any inconsistencies indicate potential bugs in the MLIR infrastructure. To the best of our knowledge, this is the first work to test MLIR from the perspective of exploring its compilation space. We implement our approach in a tool named LOBE and evaluate it on latest MLIR versions. LOBE discovers 38 previously unknown bugs, including 8 miscompilations and 30 crash bugs, with 25 confirmed/fixed.
DOI 原文 ·
@inproceedings{paperbot9325,
title = {Finding Bugs in MLIR Compiler Infrastructure via Lowering Space Exploration},
author = {Jingjing Liang and Shan Huang and Ting Su},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00059}
}