arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.24812cs.PL
收藏

数值库学习的数值超优化

Numerical Superoptimization for Library Learning

Jonas Regehr, Mitch Briles, Zachary Tatlock, Pavel Panchekha

AI总结:

本文提出GrowLibm,利用超优化器寻找数学原语,提升科学应用中数值计算的精度和速度,实验显示性能提升达2.2倍,最大精度提高至93.5%。

摘要:

数值软件依赖于快速准确的数学原语实现,如sin、exp和log。现代超优化器可优化浮点内核,但核心问题仍是哪些新原语值得实现?本文提出数值库学习:给定浮点内核工作负载,识别专家实现最能提升速度和精度的数学原语。关键洞察是超优化器已有解决此问题的工具。其搜索过程枚举候选原语,等价过程可泛化和去重候选,成本模型可估算反事实效用:若某原语可用,工作负载将如何提升。我们提出GrowLibm,将Herbie超优化器重新用于数值库学习。GrowLibm从超优化器的中间搜索结果挖掘候选原语,按反事实效用排序并剪枝冗余候选。在三个科学应用(PROJ、CoolProp和Basilisk)中,GrowLibm识别出可有效实现的紧凑、可重用原语。当Herbie扩展这些专家实现时,内核速度在固定精度下提升达2.2倍,最大可实现精度也提高,例如从56.0%到93.5%。我们还原型了一个LLVM匹配器,识别学习到的原语,在优化IR中恢复五个PROJ投影中的26个替换点,提升端到端应用性能达5%。

英文摘要:

Numerical software depends on fast, accurate implementations of mathematical primitives like sin, exp, and log. Modern superoptimizers can optimize floating-point kernels against a given set of such primitives, but a more fundamental question remains open: which new primitives are worth implementing in the first place? We formulate this as numerical library learning: given a workload of floating-point kernels, identify the mathematical primitives whose expert implementations would most improve speed and accuracy. Our key insight is that numerical superoptimizers already have the machinery well-suited to this problem. Their search procedures happen to enumerate candidate primitives, their equivalence procedures can generalize and deduplicate candidates, and their cost models can estimate counterfactual utility: how much the workload would improve if a given primitive were available. We present GrowLibm, which repurposes the Herbie superoptimizer as a numerical library learner. GrowLibm mines candidate primitives from the superoptimizer's intermediate search results, ranks them by counterfactual utility, and prunes redundant candidates. Across three scientific applications (PROJ, CoolProp, and Basilisk), GrowLibm identifies compact, reusable primitives that can be implemented effectively using standard numerical techniques. When Herbie is extended with these expert implementations, kernel speed improves by up to 2.2x at fixed accuracy, and maximum achievable accuracy also improves, in one case from 56.0% to 93.5%. We also prototype an LLVM matcher that recognizes learned primitives in optimized IR, recovering 26 replacement sites across five PROJ projections and improving end-to-end application performance by up to 5%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑