Compilers are essential for the performance and correct execution of software and hold universal relevance across various scientific disciplines. Despite this, there is a notable lack of tools for testing and evaluating them, especially within the adaptable Multi-Level Intermediate Representation (MLIR) context. This paper addresses the need for a tool that can accommodate MLIR's extensibility, a feature not provided by previous methods such as Csmith. Here we introduce MLIR-Smith, a novel random program generator specifically designed to test and evaluate MLIR-based compiler optimizations. We demonstrate the utility of MLIR-Smith by conducting differential testing on MLIR, LLVM, DaCe, and DCIR, which led to the discovery of multiple bugs in these compiler pipelines. The introduction of MLIR-Smith not only fills a void in the realm of compiler testing but also emphasizes the importance of comprehensive testing within these systems. By providing a tool that can generate random MLIR programs, this paper enhances our ability to evaluate and improve compilers and paves the way for future tools, potentially shaping the wider landscape of software testing and quality assurance.
翻译:编译器对于软件的性能与正确执行至关重要,在众多科学领域具有普遍意义。尽管如此,目前仍显著缺乏用于测试和评估编译器的工具,尤其是在灵活的多级中间表示(MLIR)框架内。本文针对一种能够适应MLIR可扩展性需求的工具进行了研究,而先前的工具(如Csmith)未能提供此特性。在此,我们介绍MLIR-Smith,这是一种专门设计用于测试和评估基于MLIR的编译器优化的新型随机程序生成器。我们通过对MLIR、LLVM、DaCe和DCIR进行差分测试,展示了MLIR-Smith的实用性,并借此发现了这些编译器流水线中的多个错误。MLIR-Smith的推出不仅填补了编译器测试领域的空白,还强调了在这些系统中进行全面测试的重要性。通过提供一种能够生成随机MLIR程序的工具,本文增强了我们评估和改进编译器的能力,并为未来工具的研发铺平了道路,有望对更广泛的软件测试与质量保障领域产生深远影响。