Implementation and Synthesis of Math Library Functions
Ian Briggs, Yash Lad, Pavel Panchekha
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Efficient Extraction for Effectful E-graphs 引用了 Target-Aware Implementation of Real Expressions
- Efficient Extraction for Effectful E-graphs 引用了 egg: Fast and extensible equality saturation
- Target-Aware Implementation of Real Expressions 引用了 Scalable yet rigorous floating-point error analysis
- Target-Aware Implementation of Real Expressions 引用了 egg: Fast and extensible equality saturation
- Target-Aware Implementation of Real Expressions 引用了 Debugging and detecting numerical errors in computation with posits
- An approach to generate correctly rounded math libraries for new floating point variants 引用了 Debugging and detecting numerical errors in computation with posits
- Correctly Rounded Math Libraries without Worrying about the Application's Rounding Mode 引用了 An approach to generate correctly rounded math libraries for new floating point variants
引用它的顶会 Paper5
- Sharpen the Spec, Cut the Code: A Case for Generative File System with SYSSPECQingyuan Liu, Mo Zou, Hengbin Zhang, Dong Du 等FAST 2026 · 9 次引用
- Efficient Extraction for Effectful E-graphsOliver Flatt, Anjali Pal, Yihong Zhang, Ryan Tjoa 等OOPSLA 2026 · 1 次引用
- Target-Aware Implementation of Real ExpressionsBrett Saiki, Jackson Brough, Jonas Regehr, Jesús Ponce 等ASPLOS 2025 · 1 次引用
- Correctly Rounded Math Libraries without Worrying about the Application's Rounding ModeSehyeok Park, Justin Kim, Santosh NagarakattePLDI 2025 · 1 次引用
- Random Variate Generation with Formal GuaranteesFeras A. Saad, Wonyeol LeePLDI 2025
它引用的 Paper9
- egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt 等POPL 2021 · 170 次引用
- Scalable yet rigorous floating-point error analysisArnab Das, Ian Briggs, Ganesh Gopalakrishnan, Sriram Krishnamoorthy 等SC 2020 · 36 次引用
- Efficient generation of error-inducing floating-point inputs via symbolic executionHui Guo, Cindy Rubio-GonzálezICSE 2020 · 27 次引用
- Debugging and detecting numerical errors in computation with positsSangeeta Chowdhary, Jay P. Lim, Santosh NagarakattePLDI 2020 · 26 次引用
- An approach to generate correctly rounded math libraries for new floating point variantsJay P. Lim, Mridul Aanjaneya, John L. Gustafson, Santosh NagarakattePOPL 2021 · 21 次引用
相关 Paper
- Choosing mathematical function implementations for speed and accuracyIan Briggs, Pavel PanchekhaPLDI 2022 · 4 次引用
- High performance correctly rounded math libraries for 32-bit floating point representationsJay P. Lim, Santosh NagarakattePLDI 2021 · 19 次引用
- SpEQ: Translation of Sparse Codes using EquivalencesAvery Laird, Bangtian Liu, Nikolaj S. Bjørner, Maryam Mehri DehnaviPLDI 2024 · 6 次引用
- Progressive polynomial approximations for fast correctly rounded math librariesMridul Aanjaneya, Jay P. Lim, Santosh NagarakattePLDI 2022 · 9 次引用
- One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modesJay P. Lim, Santosh NagarakattePOPL 2022 · 15 次引用
