paperbot · PL 论文追踪

全部论文 待读 收藏

P1 PolyJuice: Detecting Mis-compilation Bugs in Tensor Compilers with Equality Saturation Based Rewriting

PolyJuice:基于等价饱和重写的张量编译器误编译缺陷检测
OOPSLA 8(OOPSLA2)2024匹配度 5/10 · 论文用等价饱和(PL程序分析/重写技术)检测张量编译器误编译缺陷,属于在机器学习系统中应用程序分析,与用户“PL→AI”方向部分吻合;但完全不涉及LLM/Agent、浮点程序分析或贝叶斯程序分析,因此匹配度中等。引用 17 inbox
Chijin Zhou, Bingzhou Qian, Gwihwan Go, Quan Zhang, Shanshan Li, Yu Jiang
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出 PolyJuice,用等价饱和生成语义等价的多样计算图,通过差异测试发现张量编译器的误编译缺陷。

张量编译器是深度学习应用跨硬件部署的关键,但其优化逻辑复杂,正确性难以保证。本文提出自动检测工具 PolyJuice,核心思想是构造语义等价的 computation graph 来验证张量编译器的正确性。主要挑战在于构造能高效探索编译期多样优化逻辑的等价图。作者从两方面解决:一是提出算术与结构等价的 rewrite rules 改写张量程序的数据流;二是设计高效的基于 equality saturation 的重写框架,为输入图寻找最简化与最复杂的语义等价计算图。由于这些图数据流不同,编译时会经历不同优化过程,从而暴露误编译。作者将工具应用于 PyTorch Inductor、OnnxRuntime、TVM、TensorRT、XLA 五个工业编译器以及 EinNet、Hidet 两个学术编译器,共检测出 84 个非崩溃误编译缺陷,其中 49 个被确认、20 个已修复。

问题
张量编译器内部优化逻辑复杂,现有测试难以发现不导致崩溃的误编译(mis-compilation)缺陷。
方法
定义算术与结构等价的张量程序重写规则,并设计基于等价饱和(equality saturation)的重写框架,为同一输入构造最简化与最复杂两种语义等价计算图,使其在编译中经历不同优化路径。
评估
在 PyTorch Inductor、OnnxRuntime、TVM、TensorRT、XLA 五个工业张量编译器及 EinNet、Hidet 两个学术编译器上评估,共报告 84 个非崩溃误编译缺陷,49 个获确认、20 个已修复。
原文摘要(Abstract)

Tensor compilers are essential for deploying deep learning applications across various hardware platforms. While powerful, they are inherently complex and present significant challenges in ensuring correctness. This paper introduces PolyJuice, an automatic detection tool for identifying mis-compilation bugs in tensor compilers. Its basic idea is to construct semantically-equivalent computation graphs to validate the correctness of tensor compilers. The main challenge is to construct equivalent graphs capable of efficiently exploring the diverse optimization logic during compilation. We approach it from two dimensions. First, we propose arithmetic and structural equivalent rewrite rules to modify the dataflow of a tensor program. Second, we design an efficient equality saturation based rewriting framework to identify the most simplified and the most complex equivalent computation graphs for an input graph. After that, the outcome computation graphs have different dataflow and will likely experience different optimization processes during compilation. We applied it to five well-tested industrial tensor compilers, namely PyTorch Inductor, OnnxRuntime, TVM, TensorRT, and XLA, as well as two well-maintained academic tensor compilers, EinNet and Hidet. In total, PolyJuice detected 84 non-crash mis-compilation bugs, out of which 49 were confirmed with 20 fixed.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@article{ZhouQGZ0024,
  title = {PolyJuice: Detecting Mis-compilation Bugs in Tensor Compilers with Equality Saturation Based Rewriting},
  author = {Chijin Zhou and Bingzhou Qian and Gwihwan Go and Quan Zhang and Shanshan Li and Yu Jiang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689757}
}