面向目标感知的实数表达式实现
Target-Aware Implementation of Real Expressions
AI总结:
针对数值代码精度与性能优化难题,结合传统与数值编译器优势提出目标感知编译器Chassis,通过模等价指令选择算法和成本机会启发式迭代优化,在9类目标上实现优于Clang、Herbie的精度性能权衡。
摘要:
新型低精度加速器、向量指令集与库函数使得最大化数值代码的精度和性能的难度日益提升。传统编译器与数值编译器这两类研究方向从相反角度切入该问题:传统编译器后端针对特定目标环境优化,但在平衡性能与精度方面能力有限;数值编译器可权衡精度与性能,甚至能同时提升二者,却忽略目标环境。我们结合两类方法的优势,打造了目标感知的数值编译器Chassis。\n Chassis将数学表达式编译为目标描述中的算子,目标描述列出了每个算子所近似的实数表达式,并估算其成本与精度。随后Chassis采用迭代改进循环来优化速度与精度:具体而言,一种全新的模等价指令选择算法可高效搜索更快的目标特定程序,同时一种全新的成本机会启发式算法为迭代改进提供支持。我们在9种不同目标(包括硬件指令集架构、数学库与编程语言)上验证了Chassis的能力。通过利用低精度加速器、精度优化的数值辅助函数以及库子组件,Chassis在精度与性能的权衡上表现优于Clang(提升3.5倍)与Herbie(最高提升2.0倍)。
英文摘要:
New low-precision accelerators, vector instruction sets, and library functions make maximizing accuracy and performance of numerical code increasingly challenging. Two lines of work$\unicode{x2013}$traditional compilers and numerical compilers$\unicode{x2013}$attack this problem from opposite directions. Traditional compiler backends optimize for specific target environments but are limited in their ability to balance performance and accuracy. Numerical compilers trade off accuracy and performance, or even improve both, but ignore the target environment. We join aspects of both to produce Chassis, a target-aware numerical compiler. Chassis compiles mathematical expressions to operators from a target description, which lists the real expressions each operator approximates and estimates its cost and accuracy. Chassis then uses an iterative improvement loop to optimize for speed and accuracy. Specifically, a new instruction selection modulo equivalence algorithm efficiently searches for faster target-specific programs, while a new cost-opportunity heuristic supports iterative improvement. We demonstrate Chassis' capabilities on 9 different targets, including hardware ISAs, math libraries, and programming languages. Chassis finds better accuracy and performance trade-offs than both Clang (by 3.5x) or Herbie (by up to 2.0x) by leveraging low-precision accelerators, accuracy-optimized numerical helper functions, and library subcomponents.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。