一句话:提出首个利用 LLM 与编译器源码信息的白盒编译器模糊测试器 WhiteFox,用于检测深度学习编译器的深层逻辑缺陷。
编译器错误会颠覆程序行为,但编译器模糊测试仍难:黑盒/灰盒方法缺乏对内部行为的理解,难以触发复杂优化;符号执行等白盒技术又因编译器代码库庞大而不可行。本文提出 WhiteFox,首个用大语言模型(LLM)结合编译器源码信息进行白盒模糊测试的工作,聚焦深度学习编译器的深层逻辑缺陷。其多智能体框架中,分析智能体阅读底层优化源码并总结触发优化所需的高层测试程序需求,生成智能体据此生成程序,并以触发优化的测试为反馈动态改进提示。在 PyTorch Inductor、TensorFlow-XLA 与 TensorFlow Lite 上,它触发的优化最多为现有模糊测试器的 8 倍,共发现 101 个缺陷(92 个未知、70 个已修复),已被 PyTorch 团队采纳,也可用于 LLVM。
Compiler correctness is crucial, as miscompilation can falsify program behaviors, leading to serious consequences over the software supply chain. In the literature, fuzzing has been extensively studied to uncover compiler defects. However, compiler fuzzing remains challenging: Existing arts focus on black- and grey-box fuzzing, which generates test programs without sufficient understanding of internal compiler behaviors. As such, they often fail to construct test programs to exercise intricate optimizations. Meanwhile, traditional white-box techniques, such as symbolic execution, are computationally inapplicable to the giant codebase of compiler systems. Recent advances demonstrate that Large Language Models (LLMs) excel in code generation/understanding tasks and even have achieved state-of-the-art performance in black-box fuzzing. Nonetheless, guiding LLMs with compiler source-code information remains a missing piece of research in compiler testing. To this end, we propose W hite F ox , the first white-box compiler fuzzer using LLMs with source-code information to test compiler optimization, with a spotlight on detecting deep logic bugs in the emerging deep learning (DL) compilers. W hite F ox adopts a multi-agent framework: (i) an LLM-based analysis agent examines the low-level optimization source code and produces requirements on the high-level test programs that can trigger the optimization; (ii) an LLM-based generation agent produces test programs based on the summarized requirements. Additionally, optimization-triggering tests are also used as feedback to further enhance the test generation prompt on the fly. Our evaluation on the three most popular DL compilers ( i.e ., PyTorch Inductor, TensorFlow-XLA, and TensorFlow Lite) shows that W hite F ox can generate high-quality test programs to exercise deep optimizations requiring intricate conditions, practicing up to 8 times more optimizations than state-of-the-art fuzzers. To date, W hite F ox has found in total 101 bugs for the compilers under test, with 92 confirmed as previously unknown and 70 already fixed. Notably, W hite F ox has been recently acknowledged by the PyTorch team, and is in the process of being incorporated into its development workflow. Finally, beyond DL compilers, W hite F ox can also be adapted for compilers in different domains, such as LLVM, where WHiteFox has already found multiple bugs.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{YangDLY0J024,
title = {WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models},
author = {Chenyuan Yang and Yinlin Deng and Runyu Lu and Jiayi Yao and Jiawei Liu and Reyhaneh Jabbarvand and Lingming Zhang},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {OOPSLA2},
year = {2024},
doi = {10.1145/3689736}
}