一句话:提出 MCS,用多智能体强化学习结合记忆化搜索探索测试配置,生成更易触发编译器缺陷的测试程序。
编译器测试中,测试程序生成是核心任务,但已有配置探索方法要么依赖历史缺陷,要么成本效益不佳。本文提出 MCS:在即时编译器测试过程中,对已探索的测试配置进行记忆化,并借助多智能体强化学习引导有效测试配置的构造,同时学习配置选项之间的精细协同关系。具体而言,MCS 一方面利用测试配置之间的多样性高效探索输入空间,另一方面依据各配置下的测试结果学习哪些空间区域更易触发缺陷。在 GCC 与 LLVM 上的大量实验表明,MCS 在缺陷检测上显著优于当前最优的测试程序生成方法;它在 GCC 和 LLVM 最新 trunk 版本上发现 16 个新缺陷,均已被开发者确认或修复。MCS 已被华为部署用于测试其内部编译器,发现 10 个新缺陷(覆盖对比方法发现的全部 5 个),且全部得到确认。
To ensure compilers' quality, compiler testing has received more and more attention, and test-program generation is the core task. In recent years, some approaches have been proposed to explore test configurations for generating more effective test programs, but they either are restricted by historical bugs or suffer from the cost-effectiveness issue. Here, we propose a novel test-program generation approach (called MCS) to further improving the performance of compiler testing. MCS conducts memoized search via multi-agent reinforcement learning (RL) for guiding the construction of effective test configurations based on the memoization for the explored test configurations during the on-the-fly compiler-testing process. During the process, the elaborate coordination among configuration options can be also well learned by multi-agent RL, which is required for generating bug-triggering test programs. Specifically, MCS considers the diversity among test configurations to efficiently explore the input space and the testing results under each explored configuration to learn which portions of space are more bug-triggering. Our extensive experiments on GCC and LLVM demonstrate the performance of MCS, significantly outperforming the state-of-the-art test-program generation approaches in bug detection. Also, MCS detects 16 new bugs on the latest trunk revisions of GCC and LLVM, and all of them have been confirmed or fixed by developers. MCS has been deployed by a global IT company (i.e., Huawei) for testing their in-house compiler, and detects 10 new bugs (covering all the 5 bugs detected by the compared approaches), all of which have been confirmed.