一句话:提出 ShaDiv,针对图形着色器编译器后端,利用 GPU 线程控制流与数据流发散模式生成测试,发现 12 个后端缺陷。
图形着色器编译器将 GLSL 等高级着色程序编译为 GPU 低级二进制,其前端、中端和后端复杂,后端位于编译流水线深处,尤其难以测试。现有着色器编译器测试工具未专门针对后端,难以发现后端缺陷。本文提出 ShaDiv:一种面向图形着色器编译器后端的自动化测试工具。它针对 GPU 线程间控制流与数据流发散这一后端计算模型,设计两种策略,刻意扰动着色器程序的控制流与数据流发散模式,以有效触发后端优化。作者在四家主流 GPU 厂商的着色器编译器上评估 ShaDiv,发现 12 个后端缺陷;与现有工具相比,后端组件覆盖率提升 25%,发现的后端缺陷数达到四倍。
Graphics shaders are the core of modern 3D visual effects, enabling developers to create realistic, real-time rendering of 3D scenes. Shaders are specialized programs written in high-level shading languages like GLSL, and graphics shader compilers translate these high-level shader programs into low-level binaries that run on GPUs. These shader compilers are complex programs with multiple layers: front-end, middle-end, and back-end. Despite significant development efforts from industrial GPU vendors such as NVIDIA and AMD, graphics shader compilers still contain bugs that can impact downstream applications and lead to negative consequences from poor user experience in entertainment to accidents in driving assistance systems. Because they are complex and deep in the compilation pipeline, the back-ends of shader compilers are particularly challenging to test. Our empirical exploration shows that state-of-the-art testing tools for shader compilers do not specifically target the back-ends and are thus ineffective in uncovering back-end bugs. This work fills this gap and introduces ShaDiv , an automated testing tool specifically designed to uncover bugs in the back-ends of graphics shader compilers. To this end, ShaDiv generates test inputs with two novel, carefully designed strategies to support the unique computational models of the back-ends, namely control and data flow divergence among GPU threads. ShaDiv deliberately perturbs divergence patterns in both the control and data flow of shader programs to effectively trigger back-end optimizations. Our evaluation of ShaDiv on graphics shader compilers from four mainstream GPU vendors uncovered 12 back-end bugs. Further comparison with existing shader compiler testing tools shows that ShaDiv achieves a 25% coverage increase in the back-end components and finds four times as many back-end bugs.
@article{paperbot3137,
title = {Divergence-Aware Testing of Graphics Shader Compiler Back-Ends},
author = {Dongwei Xiao and Shuai Wang and Zhibo Liu and Yiteng Peng and Daoyuan Wu and Zhendong Su},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {PLDI},
year = {2025},
doi = {10.1145/3729305}
}