首页|基于多类型计算重写的浮点表达式精度优化方法

基于多类型计算重写的浮点表达式精度优化方法

扫码查看
表达式重写是精度优化领域的新兴方法,其核心思想是在不改变表达式精度类型的前提下,将其变换为语义上等价的表达式以尝试提升精度.然而,面对庞大的变换规则和变换空间,如何选取合适的变换策略成为了重写方法的问题所在.针对上述问题,提出了一个基于多类型计算重写的浮点表达式精度优化方法,支持包括函数计算、四则运算的表达式,并实现了表达式重写工具exprAuto.区别于其他精度优化工具侧重于对子表达式的替换,exprAuto更注重对表达式运算顺序的变换.ex-prAuto在对表达式化简和数学变换后,通过多项式变换获取不同的计算顺序,并尝试减少运算次数以提升精度,最终生成一个包含不同计算顺序的等价表达式集合,通过排序筛选和误差检测从中选出最终的精度优化结果.文中选取41个FPBench标准集中的表达式和18个常见数学函数的近似多项式作为测试用例,在经exprAuto优化后,所提方法相比原式最大误差降低了45.92%,平均误差降低了 34.98%;针对其中的18个近似多项式,相比原式最大误差降低了 58.35%,平均误差降低了43.73%.实验结果表明,exprAuto可以有效提升表达式尤其是多项式的精度.
Floating-point Expression Precision Optimization Method Based on Multi-type Calculation Rewriting
Expression rewriting is an emerging method in the field of precision optimization.Its core idea is to transform an ex-pression 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 mathemati-cal 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 ex-pression operations.After the expression is simplified and mathematically transformed,exprAuto obtains different calculation or-ders through polynomial transformation,and tries to improve the precision by reducing the number of operations.Finally,ex-prAuto generates an equivalent set of expressions with different calculation orders and selects the final precision optimization re-sult through sorting screening and error detection.In this paper,41 expressions from the FPBench standard set and 18 approxi-mate 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 poly-nomials,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.

Floating-point computationPrecision optimizationRewriting transformation

郝江伟、杨鸿儒、夏媛媛、刘毅、许瑾晨、庞建民

展开 >

信息工程大学网络空间安全学院 郑州 450001

数学工程与先进计算国家重点实验室 江苏无锡 214125

中国科学院软件研究所天基综合信息系统重点实验室 北京 100190

浮点计算 精度优化 重写变换

数学工程与先进计算国家重点实验室开放基金

2023B02

2024

计算机科学
重庆西南信息有限公司(原科技部西南信息中心)

计算机科学

CSTPCD北大核心
影响因子:0.944
ISSN:1002-137X
年,卷(期):2024.51(4)
  • 19