arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.16947cs.SE
收藏

使用自定义变异合成对MLIR编译器进行模糊测试

Fuzzing MLIR Compilers with Custom Mutation Synthesis

Ben Limpanukorn, Jiyuan Wang, Hong Jin Kang, Eric Zitong Zhou, Miryung Kim

AI总结:

针对MLIR自定义方言测试生成器手动编写困难的问题,提出SYNTHFUZZ模糊测试器,结合语法模糊与自定义变异合成,自动推断上下文相关变异,显著提升覆盖率和有效测试比例。

摘要:

深度学习和特定领域硬件加速中的编译器技术正越来越多地采用可扩展的编译器框架,如 Multi-Level Intermediate Representation (MLIR),以促进更高效的开发。通过 MLIR,编译器开发者可以轻松地以 MLIR 方言的形式定义自己的自定义 IR。然而,这种自定义 IR 的多样性和快速演进使得为每种方言手动编写自定义测试生成器变得不切实际。为了解决这个问题,我们设计了一种名为 SYNTHFUZZ 的新型测试生成器,它将基于语法的模糊测试与自定义变异合成相结合。SYNTHFUZZ 的关键本质有两个方面:(1) 它自动从现有测试用例中推断参数化的、上下文相关的自定义变异。(2) 然后,它根据目标上下文具体化变异内容,并通过执行 k-ancestor 和 pre(post)fix 匹配来减少插入无效编辑的机会。SYNTHFUZZ 免除了为每种方言手动定义自定义变异算子的需要。我们将 SYNTHFUZZ 与三个基线进行比较:Grammarinator、MLIRSmith 和 NeuRI。我们在四个不同的 MLIR 项目上进行了这项全面比较。每个项目都定义了一组新的 MLIR 方言,其中手动编写自定义测试生成器需要数周的工作量。我们的评估表明,SYNTHFUZZ 平均将 MLIR 方言对覆盖率提高了 1.75 倍,从而将分支覆盖率提高了 1.22 倍。此外,我们表明我们上下文相关的自定义变异将有效测试的比例最高提高了 1.11 倍,这表明 SYNTHFUZZ 正确地根据目标上下文具体化了其参数化变异。变异的参数化将违反基本 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 pre(post)fix matching. SYNTHFUZZ obviates the need to manually define custom mutation operators for each dialect. We compare SYNTHFUZZ to three baselines: Grammarinator, MLIRSmith, and NeuRI. 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 times, which increases branch coverage by 1.22 times. Further, we show that our context dependent custom mutation increases the proportion of valid tests by up to 1.11 times, 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 times, increasing the time spent fuzzing dialect-specific code.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑