Optimizing compilers are essential for the efficient and correct execution of software across various scientific fields. Domain-specific languages (DSL) typically use higher level intermediate representations (IR) in their compiler pipelines for domain-specific optimizations. As these IRs add to complexity, it is crucial to test them thoroughly. Random program generators have proven to be an effective tool to test compilers through differential and fuzz testing. However, developing specialized program generators for compiler IRs is not straightforward and demands considerable resources. We introduce MLIR-Forge, a novel random program generator framework that leverages the flexibility of MLIR, aiming to simplify the creation of specialized program generators. MLIR-Forge achieves this by splitting the generation process into fundamental building blocks that are language specific, and reusable program creation logic that constructs random programs from these building blocks. This hides complexity and furthermore, even the language specific components can be defined using a set of common tools. We demonstrate MLIR-Forge's capabilities by generating MLIR with built-in dialects, WebAssembly, and a data-centric program representation, DaCe -- requiring less than a week of development time in total for each of them. Using the generated programs we conduct differential testing and find 9 MLIR, 15 WebAssembly, and 774 DaCe groups of bugs with the corresponding program generators, after running them until the rate of new bugs stagnates.


翻译:优化编译器对于确保软件在各个科学领域中的高效与正确执行至关重要。领域特定语言(DSL)通常在其编译器流水线中使用更高层次的中间表示(IR)来实现领域特定的优化。随着这些IR的增加,复杂性也随之上升,因此对其进行全面测试显得尤为关键。随机程序生成器已被证明是通过差异测试和模糊测试来验证编译器的有效工具。然而,为编译器IR开发专门的程序生成器并非易事,且需要投入大量资源。本文介绍MLIR-Forge,一个新颖的随机程序生成器框架,它充分利用了MLIR的灵活性,旨在简化专门程序生成器的创建过程。MLIR-Forge通过将生成过程分解为语言特定的基础构建块,以及从这些构建块构造随机程序的可复用程序创建逻辑,来实现这一目标。这隐藏了复杂性,此外,即使是语言特定的组件也可以使用一组通用工具进行定义。我们通过生成内置方言的MLIR、WebAssembly以及以数据为中心的程序表示DaCe,展示了MLIR-Forge的能力——其中每一项的开发总时间均不足一周。利用生成的程序,我们进行了差异测试,并在运行至新错误发现率趋于停滞时,使用相应的程序生成器分别发现了9组MLIR错误、15组WebAssembly错误和774组DaCe错误。

0
下载
关闭预览

相关内容

生成器是一次生成一个值的特殊类型函数。可以将其视为可恢复函数。调用该函数将返回一个可用于生成连续 x 值的生成【Generator】,简单的说就是在函数的执行过程中,yield语句会把你需要的值返回给调用生成器的地方,然后退出函数,下一次调用生成器函数的时候又从上次中断的地方开始执行,而生成器内的所有变量参数都会被保存下来供下一次使用。
【ETZH博士论文】语言模型编程
专知会员服务
25+阅读 · 2025年6月14日
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
NLG ≠ 机器写作 | 专家专栏
量子位
13+阅读 · 2018年9月10日
NLP通用模型诞生?一个模型搞定十大自然语言常见任务
人工智能头条
10+阅读 · 2018年6月29日
从语言学到深度学习NLP,一文概述自然语言处理
人工智能学家
13+阅读 · 2018年1月28日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员