Computer Science ›› 2024, Vol. 51 ›› Issue (4): 86-94.doi: 10.11896/jsjkx.221200072

• High Performance Computing • Previous Articles     Next Articles

Floating-point Expression Precision Optimization Method Based on Multi-type Calculation
Rewriting

HAO Jiangwei1,2, YANG Hongru1,2, XIA Yuanyuan3, LIU Yi1,2, XU Jinchen1,2 , PANG Jianmin1,2   

  1. 1 School of Cyberspace Security,Information Engineering University,Zhengzhou 450001,China
    2 State Key Laboratory of Mathematical Engineering and Advanced Computing,Wuxi,Jiangsu 214125,China
    3 Institute of Software,Chinese Academy of Sciences,Beijing 100190,China
  • Received:2022-12-12 Revised:2023-03-29 Online:2024-04-15 Published:2024-04-10
  • Supported by:
    Open Project Program of the State Key Laboratory of Mathematical Engineering and Advanced Computing(2023B02).

Abstract: Expression rewriting is an emerging method in the field of precision optimization.Its core idea is to transform an expression into a semantically equivalent expression without changing its precision representation to improve precision.However,given the large number of transformation rules and the huge transformation space,the problem of the rewriting method is how to choose an appropriate transformation strategy.In response to the above problems,this paper proposes a precision optimization method for floating-point expressions based on multi-type calculation rewriting,which supports expressions including mathematical function calculations and four arithmetic calculations,and implements an expression rewriting tool exprAuto.Unlike other precision optimization tools that focus on replacing sub-expressions,exprAuto pays more attention to transform the order of expression operations.After the expression is simplified and mathematically transformed,exprAuto obtains different calculation orders through polynomial transformation,and tries to improve the precision by reducing the number of operations.Finally,exprAuto generates an equivalent set of expressions with different calculation orders and selects the final precision optimization result through sorting screening and error detection.In this paper,41 expressions from the FPBench standard set and 18 approximate polynomials of common mathematical functions are selected as test cases.After exprAuto optimization,the maximum error is reduced by 45.92% and the average error is reduced by 34.98% compared to the original expression.For 18 approximate polynomials,the maximum error is reduced by 58.35%,and the average error is reduced by 43.73%.Experimental results show that exprAuto can effectively improve the precision of expressions,especially polynomials.

Key words: Floating-point computation, Precision optimization, Rewriting transformation

CLC Number: 

  • TP311
[1]YI X.Research on Automated Repair Techniques[D].Changsha:National University of Defense Technology,2020.
[2]BENZ F,HILDEBRANDT A,HACK S.A Dynamic ProgramAnalysis to Find Floating-Point Accuracy Problems[C]// Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation.Association for Computing Machinery,2012,47(6):453-462.
[3]DAMOUCHE N,MARTEL M,PANCHEKHA P,et al.To-ward a Standard Benchmark Format and Suite for Floating-Point Analysis[C]// International Workshop on Numerical Software Verification.2016.
[4]MULLER J M,BRISEBARRE N,DINECHIN F D,et al.Handbook of Floating-point Arithmetic[M].Birkhäuser,2009.
[5]GOLDBERG D.What Every Computer Scientist Should Know About Floating-point Arithmetic [J].ACM Computer Surveys,1991,23(1):5-48.
[6]FOUSSE L,HANROT G,LEFEVRE V,et al.MPFR:A Multiple-Precision Binary Floating-Point Library with Correct Rounding [J].ACM Transactions on Mathematical Software,2007,33(2):13.1-13.15.
[7]ANSI/IEEE 754-2019.IEEE Standard for Floating-Point Arithmetic[S].Institute of Electrical and Electronics Engineers,2019.
[8]BACKUS J W,BAUER F L,GREENJ,et al.Revised Report on the Algorithmic Language Algol 60[EB/OL].https://www.masswerk.at/algol60/report.htm.
[9]HAMMING R W.Numerical Methods for Scientists and Engineers [M].Dover Publications,2nd edition,1987.
[10]AHO A V,LAM M S,SETHI R,et al.Compilers:Principles,Techniques,and Tools(2nd Edition)[M].Addison-Wesley Longman Publishing Co.Inc.,2006.
[11]PANCHEKHA P,SANCHEZ-STERN A,WILCOX J R,et al.Automatically Improving Accuracy for Floating Point Expressions[J].ACM SIGPLAN Notices.Association for Computing Machinery,2015,50(6):1-11.
[12]LI Z,DONG X X,HUANG C C,et al.Design space exploration method for floating-point expression based on heuristic search[J].Journal of Computer Applications,2020,40(9):2665-2669.
[13]XIAO A X,ZHANG S X,TANG E Y,et al.An Experience-Guided Acceleration Strategy for Floating-Point Optimization[J].Chinese Journal of Computers,2022,45(9):2014-2028.
[14]WANG X,WANG H J,SU Z D,et al.Global Optimization of Numerical Programs via Prioritized Stochastic Algebraic Transformations[C]//Proceedings of the 41st International Confe-rence on Software Engineering(Montreal,Quebec,Canada)(ICSE' 19).IEEE Press,2019:1131-1141.
[15]ROBERT R,ANASTASIIA I,EVA D.Regime Inference forSound Floating-Point Optimizations [J].ACM Trans.Embed Computing System,2021,20(5):1-23.
[16]YI X,CHEN L Q,MAO X G,et al.Automated Repair of High Inaccuracies in Numerical Programs[C]//IEEE International Conference on Software Maintenance & Evolution.IEEE Computer Society,2017.
[17]HIDA Y,LI X S,BAILEY D H.Algorithms for quad-doubleprecision floating point arithmetic [C]//Proceedings of the 15th Symposium on Computer Arithmetic.San Diego,CA,2001:155-162.
[18]LAUTER C.Basic building blocks for a triple-double interme-diate format,200538 [R].2005.
[19]DARAMY L C,DEFOUR D,DINECHIN F D,et al.CR-LIBM A library of correctly rounded elementary functions in double-precision.Research Report,ensl-01529804 [R].Paris:LIP,2006.
[1] SHUAI Dongxin, GE Lili, XIE Jinyan, ZHANG Yingzhou, XUE Yuchuan, YANG Jiayi, MI Jie, LU Yue. Survey of Interprocedural Flow-sensitive Pointer Analysis Technology [J]. Computer Science, 2023, 50(12): 1-13.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!