基于等式饱和的极简函数式数组语言潜在惯用法识别
Latent Idiom Recognition for a Minimalist Functional Array Language using Equality Saturation
AI总结:
本文提出用极简函数式数组语言结合等式饱和自动识别代码惯用法,匹配BLAS和PyTorch核心函数,实现1.46倍几何平均加速。
摘要:
加速程序通常通过识别与高性能库或硬件接口相匹配的代码惯用法来实现。然而,自动识别此类惯用法具有挑战性。惯用法识别机制难以编写,且需要专家知识。此外,输入程序中的细微变化可能隐藏惯用法,导致识别器失效。本文主张使用一种极简函数式数组语言,该语言支持一组规模虽小但表达力强的算子。极简设计导致一组编码语言语义的小型重写规则。关键在于,同一极简语言也用于编码惯用法。这消除了对手工分析遍或学习复杂领域特定语言来定义惯用法的需求。结合等式饱和,该方法能够在计算内核集合上匹配BLAS和PyTorch库中的核心函数。与参考C内核实现相比,当从高级极简语言生成C程序时,该方法对使用BLAS的C程序产生了1.46倍的几何平均加速比。
英文摘要:
Accelerating programs is typically done by recognizing code idioms matching high-performance libraries or hardware interfaces. However, recognizing such idioms automatically is challenging. The idiom recognition machinery is difficult to write and requires expert knowledge. In addition, slight variations in the input program might hide the idiom and defeat the recognizer. This paper advocates for the use of a minimalist functional array language supporting a small, but expressive, set of operators. The minimalist design leads to a tiny sets of rewrite rules, which encode the language semantics. Crucially, the same minimalist language is also used to encode idioms. This removes the need for hand-crafted analysis passes, or for having to learn a complex domain-specific language to define the idioms. Coupled with equality saturation, this approach is able to match the core functions from the BLAS and PyTorch libraries on a set of computational kernels. Compared to reference C kernel implementations, the approach produces a geometric mean speedup of 1.46x for C programs using BLAS, when generating such programs from the high-level minimalist language.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。