paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Implementation and Synthesis of Math Library Functions

数学库函数的实现与合成
POPL 8(POPL)2024匹配度 4/10 · 论文研究数学库函数的 DSL、测试、调优与程序合成,涉及浮点精度和语义检查,与用户关注的浮点程序分析有邻接关系;但不涉及静态分析、LLM/Agent 或贝叶斯程序分析,核心方向匹配有限。引用 6 inbox
Ian Briggs, Yash Lad, Pavel Panchekha
crossref: 2026-09-10

AI 速览

一句话:提出 MegaLibm,一个用于实现、测试、调优与合成数学库函数的领域特定语言。

数学库函数(如 exp、sin、log)在速度与精度上难以兼顾,而 C 等底层语言无法帮助开发者发现数学错误、增量构建实现或分离高层算法与底层决策。为此,作者设计了领域特定语言 MegaLibm,它通过语义良构性检查检测符号翻转等数学错误,以模块化、可组合方式实现范围归约(range reduction),并用正交调优参数调整工作精度与求值方案。MegaLibm 还支持交互式编译、测试与调优,并可调用 Sollya 和类型导向合成来补全组件或合成整个实现。评估表明,MegaLibm 能以与原 C 代码相当的速度和精度表达 8 个先进数学库实现,并能在最少指导下合成 5 个变体和 3 个从零实现。

问题
数学库函数难以同时达到高速度与高精度,而 C 等底层实现语言缺乏对数学错误检查、增量构建以及高层算法与底层决策分离的支持。
方法
提出领域特定语言 MegaLibm,提供语义良构性检查、模块化范围归约、正交调优参数,并支持交互式编译测试调优以及类型导向合成和 Sollya 集成。
评估
用 MegaLibm 表达 8 个先进数学库实现,并与原 C 代码比较速度与精度;同时评估其在最少指导下合成 5 个变体和 3 个从零实现的能力。
原文摘要(Abstract)

Achieving speed and accuracy for math library functions like exp , sin , and log is difficult. This is because low-level implementation languages like C do not help math library developers catch mathematical errors, build implementations incrementally, or separate high-level and low-level decision making. This ultimately puts development of such functions out of reach for all but the most experienced experts. To address this, we introduce MegaLibm, a domain-specific language for implementing, testing, and tuning math library implementations. MegaLibm is safe, modular, and tunable. Implementations in MegaLibm can automatically detect mathematical mistakes like sign flips via semantic wellformedness checks, and components like range reductions can be implemented in a modular, composable way, simplifying implementations. Once the high-level algorithm is done, tuning parameters like working precisions and evaluation schemes can be adjusted through orthogonal tuning parameters to achieve the desired speed and accuracy. MegaLibm also enables math library developers to work interactively, compiling, testing, and tuning their implementations and invoking tools like Sollya and type-directed synthesis to complete components and synthesize entire implementations. MegaLibm can express 8 state-of-the-art math library implementations with comparable speed and accuracy to the original C code, and can synthesize 5 variations and 3 from-scratch implementations with minimal guidance.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2644,
  title = {Implementation and Synthesis of Math Library Functions},
  author = {Ian Briggs and Yash Lad and Pavel Panchekha},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {POPL},
  year = {2024},
  doi = {10.1145/3632874}
}