通过访问模式重写纯张量程序(Representation Pearl)
Pure Tensor Program Rewriting via Access Patterns (Representation Pearl)
摘要:
机器学习(ML)中的张量内核通常对应于纯数学表达式,使得项重写成为优化和映射到专用硬件加速器的有吸引力的策略。然而,现有的ML中间表示(IR)倾向于要么是\textit{pure but high-level},使得对硬件目标的低级重写不可表达,要么是\textit{low-level but impure},完全阻碍了术语重写的使用。本文介绍了Glenside,一个纯IR的核心抽象-\textit{access pattern} -使低层次,布局感知,以硬件为中心的程序重写。我们演示了如何在Glenside长期重写可以用来映射程序片段的硬件加速器调用,并自动发现经典的数据布局转换,如\texttt{im2col}。Glenside为进一步探索优化低级张量程序的项重写技术奠定了新的基础。
英文摘要:
Tensor kernels in machine learning (ML) often correspond to pure mathematical expressions, making term rewriting an attractive strategy for optimization and mapping to specialized hardware accelerators. However, existing ML intermediate representations (IRs) tend to either be \textit{pure but high-level}, making low-level rewrites to hardware targets inexpressible, or \textit{low-level but impure}, hampering the use of term rewriting altogether. This paper introduces Glenside, a pure IR whose core abstraction -- the \textit{access pattern} -- enables low-level, layout-aware, hardware-centric program rewrites. We demonstrate how term rewriting in Glenside can be used to map program fragments to hardware accelerator invocations and automatically discover classic data layout transformations like \texttt{im2col}. Glenside establishes a new foundation for exploring further term rewriting techniques in optimizing low-level tensor programs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。