《计算机应用》唯一官方网站 ›› 2023, Vol. 43 ›› Issue (S1): 177-181.DOI: 10.11772/j.issn.1001-9081.2022101618

• 先进计算 • 上一篇    

基于程序重写的浮点程序精度缺陷修复方法

王一卓(), 王磊, 徐方洁, 张亚光   

  1. 中原工学院 前沿信息技术研究院,郑州 450007
  • 收稿日期:2022-10-31 修回日期:2022-12-28 接受日期:2023-01-03 发布日期:2023-07-04 出版日期:2023-06-30
  • 通讯作者: 王一卓
  • 作者简介:王一卓(2000—),男,河南漯河人,硕士研究生,主要研究方向:高性能计算。479174053@qq.com
    王磊(1977—),男,陕西临潼人,教授,硕士,CCF会员,主要研究方向:高性能计算
    徐方洁(1998—),女,河南商丘人,硕士研究生,主要研究方向:高性能计算
    张亚光(1997—),男,河南周口人,硕士研究生,主要研究方向:高性能计算。

Precision defect repair method for floating point program based on program rewriting

Yizhuo WANG(), Lei WANG, Fangjie XU, Yaguang ZHANG   

  1. The Frontier Information Technology Research Institute,Zhongyuan University of Technology,Zhengzhou Henan 450007,China
  • Received:2022-10-31 Revised:2022-12-28 Accepted:2023-01-03 Online:2023-07-04 Published:2023-06-30
  • Contact: Yizhuo WANG

摘要:

针对修复浮点程序中的精度缺陷的问题,从精度缺陷修复的基础理论和表达式变换方向,提出一种浮点程序精度缺陷修复方法,用以提升浮点计算的准确性。所提方法以浮点程序作为输入,首先,提出一种取样?替换?分类的方法,对特定精度的操作进行筛选隔离;然后,进行函数之间的嵌入,再通过一组表达式间的转换规则以及变量间的映射方法重组表达式,生成具有更多重写可能性的表达式;其次,使用FPtool处理生成的表达式,再使用Herbie重写处理后的浮点表达式;最后,经过多次迭代生成比初始程序浮点计算精度更高的目标程序。在GSL(GNU Scientific Library)的10个函数上进行实验,实验结果表明,以误差小于1 ULP(Unit at the Last Place)的比例为指标,所提方法优化后的平均占比提升了5.20%。

关键词: 程序重写, 数值精度, 浮点程序, 静态分析, 缺陷修复

Abstract:

Aiming at the problems of repairing the precision defects in floating point programs, a method of precision defect repair for floating point programs was proposed from the basic theory of precision defect repair and expression transformation to improve the accuracy of floating point calculations. Floating-point programs were taken as input by the proposed method. Firstly, a sampling-replacement-classification method was proposed to filter and isolate operations with specific precision, and functions were embedded in it. Then, a set of transformation rules between expressions and mapping method between variables were applied to reorganize the expressions to generate expressions with more rewriting possibilities. Next, the FPtool was used to process the generated expressions, and Herbie was used to rewrite the processed floating point expressions. Finally, after several iterations, the target program with higher floating point calculation precision than the initial program was generated. Experimental results of 10 functions on GSL (GNU Scientific Library) show that the average proportion after improving by the proposed method is improved by 5.20%, with the proportion of error less than 1 ULP (Unit at the Last Place) as the indicator.

Key words: program rewriting, numerical precision, floating point program, static analysis, defect repair

中图分类号: