Page 6 - 《软件学报》2025年第12期
P. 6
软件学报 ISSN 1000-9825, CODEN RUXUEW E-mail: jos@iscas.ac.cn
2025,36(12):5387−5401 [doi: 10.13328/j.cnki.jos.007406] [CSTR: 32375.14.jos.007406] http://www.jos.org.cn
©中国科学院软件研究所版权所有. Tel: +86-10-62562563
*
面向编译优化结果不一致的代码高效定位
于恒彪 1 , 易 昕 1 , 范小康 1 , 唐 滔 1 , 黄 春 1 , 尹帮虎 2 , 王 戟 1
1
(国防科技大学 计算机学院, 湖南 长沙 410073)
2
(国防科技大学 系统工程学院, 湖南 长沙 410073)
通信作者: 易昕, E-mail: yixin09@nudt.edu.cn
摘 要: 编译器是程序开发人员最依赖的性能优化工具之一. 然而, 受限于浮点数有限精度编码问题, 很多编译优
化选项会改变浮点计算的语义, 进而导致程序计算结果不一致. 定位程序中导致编译优化结果不一致的语句对于
程序性能优化和结果可复现具有重要意义. 当前最先进的方法 PLiner 采用基于语句精度增强的二分搜索来定位导
致编译优化结果不一致的代码段, 受限于对多源问题代码的定位支持不够和搜索效率不高问题. 提出一种浮点指
令差异性引导的 Delta 调试定位方法 FI3D, 利用 Delta 调试中的回溯机制更好地支持多源问题代码定位, 基于不同
编译优化选项下函数浮点指令序列的差异性来引导定位. 使用 NPB 基准测试集中的 6 个应用、GSL 数学库中的
10 个程序和 floatsmith 混合精度测试集中的 2 个程序对 FI3D 进行了评测, 实验结果显示 FI3D 能够成功定位
PLiner 失效的 4 个测试用例, 且对 PLiner 成功定位的 14 个测试用例获得了平均 26.8% 的性能提升.
关键词: 编译优化; 结果不一致; 浮点指令差异性; Delta 调试
中图法分类号: TP311
中文引用格式: 于恒彪, 易昕, 范小康, 唐滔, 黄春, 尹帮虎, 王戟. 面向编译优化结果不一致的代码高效定位. 软件学报, 2025,
36(12): 5387–5401. http://www.jos.org.cn/1000-9825/7406.htm
英文引用格式: Yu HB, Yi X, Fan XK, Tang T, Huang C, Yin BH, Wang J. Efficient Localization for Codes Causing Compilation
Optimization-induced Result Inconsistency. Ruan Jian Xue Bao/Journal of Software, 2025, 36(12): 5387–5401 (in Chinese). http://www.
jos.org.cn/1000-9825/7406.htm
Efficient Localization for Codes Causing Compilation Optimization-induced Result Inconsistency
1
1
1
1
2
1
YU Heng-Biao , YI Xin , FAN Xiao-Kang , TANG Tao , HUANG Chun , YIN Bang-Hu , WANG Ji 1
1
(College of Computer Science and Technology, National University of Defense Technology, Changsha 410073, China)
2
(College of Systems Engineering, National University of Defense Technology, Changsha 410073, China)
Abstract: The compiler is one of the most relied-upon performance tuning tools for program developers. However, due to the limited
precision encoding of floating-point numbers, many compiler optimization options can alter the semantics of floating-point calculations,
leading to result inconsistency. Locating the program statements that cause compilation optimization-induced result inconsistency is crucial
for performance tuning and result reproducibility. The state-of-the-art approach employs precision enhancement-based binary search to
locate the code snippets causing result inconsistency but suffers from insufficient support for multi-source localization and low search
efficiency. This study proposes a floating-point instruction difference-guided Delta-Debugging localization method, FI3D, which utilizes the
backtracking mechanism in Delta-Debugging to better support multi-source problem code localization and exploits the differences in
floating-point instruction sequences under different compiler optimization options to guide the localization. FI3D is evaluated using 6
applications from the NPB benchmark, 10 programs from the GNU scientific library, and 2 programs from the floatsmith mixed-precision
benchmark. Experimental results demonstrate that FI3D successfully locates the 4 applications where PLiner fails and achieves an average
26.8% performance improvement for the 14 cases successfully located by PLiner.
Key words: compiler optimization; result inconsistency; floating-point instruction difference; Delta-Debugging
* 基金项目: 国家重点研发计划 (2023YFB3001600); 国家自然科学基金 (62272471, 62202488)
收稿时间: 2024-09-23; 修改时间: 2024-12-25; 采用时间: 2025-01-31; jos 在线出版时间: 2025-06-04
CNKI 网络首发时间: 2025-06-05

