一句话:提出 SynthFuzz,从已有测试自动推断参数化上下文相关自定义变异,用于 MLIR 方言编译器模糊测试。
MLIR 允许开发者以自定义方言定义 IR,但方言多样且快速演化,手工为每个方言编写测试生成器不切实际。本文提出 SynthFuzz,将语法模糊测试与自定义变异合成结合:从已有测试自动推断参数化上下文相关变异,并按目标上下文具体化,通过 k-祖先及前后缀匹配减少无效编辑。在四个 MLIR 项目上与 Grammarinator、MLIRSmith、NeuRI 对比,SynthFuzz 平均提升方言对覆盖率 1.75 倍、分支覆盖率 1.22 倍;上下文相关变异将有效测试比例最高提升 1.11 倍,参数化使违反基础 MLIR 约束的测试比例降至 0.57 倍,从而将更多时间用于方言特定代码模糊测试。
Compiler technologies in deep learning and domain-specific hardware acceleration are increasingly adopting extensible compiler frameworks such as Multi-Level Intermediate Representation (MLIR) to facilitate more efficient development. With MLIR, compiler developers can easily define their own custom IRs in the form of MLIR dialects. However, the diversity and rapid evolution of such custom IRs make it impractical to manually write a custom test generator for each dialect. To address this problem, we design a new test generator called SynthFuzz that combines grammar-based fuzzing with custom mutation synthesis. The key essence of SynthFuzz is two fold: (1) It automatically infers parameterized context-dependent custom mutations from existing test cases. (2) It then concretizes the mutation's content depending on the target context and reduces the chance of inserting invalid edits by performing$k$- ancestor and prefix/postfix matching. It obviates the need to manually define custom mutation operators for each dialect. We compare SynthFuzz to three baselines: Grammarinator-a grammar-based fuzzer without custom mutations, MLIRSmith-a custom test generator for MLIR core dialects, and NeuRI-a custom test generator for ML models with parameterization of tensor shapes. We conduct this comprehensive comparison on four different MLIR projects. Each project defines a new set of MLIR dialects where manually writing a custom test generator would take weeks of effort. Our evaluation shows that SynthFuzz on average improves MLIR dialect pair coverage by 1.75 ×, which increases branch coverage by 1.22 ×. Further, we show that our context dependent custom mutation increases the proportion of valid tests by up to 1.11 ×, indicating that SynthFuzz correctly concretizes its parameterized mutations with respect to the target context. Parameterization of the mutations reduces the fraction of tests violating the base MLIR constraints by 0.57 ×, increasing the time spent fuzzing dialect-specific code.
DOI 原文 ·
@inproceedings{paperbot8804,
title = {Fuzzing MLIR Compilers with Custom Mutation Synthesis},
author = {Ben Limpanukorn and Jiyuan Wang and Hong Jin Kang and Zitong Zhou and Miryung Kim},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00037}
}