arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.20347cs.CL
收藏

使用 Apache TVM 为一系列矩阵乘法例程自动生成器

Automatic Generators for a Family of Matrix Multiplication Routines with Apache TVM

Universitat Politècnica de València(瓦伦西亚理工大学);Universidad Complutense de Madrid(马德里康普顿斯大学);Universidad de Córdoba(科尔多瓦大学)

Guillermo Alaejos, Adrián Castelló, Pedro Alonso-Jordá, Francisco D. Igual, Héctor Martínez, Enrique S. Quintana-Ortí

AI总结:

本文利用 Apache TVM 自动生成 GEMM 的分块算法和处理器专用微内核,以替代手工汇编编码,在保持高性能的同时提升可移植性、灵活性与可维护性,并降低内存占用。

摘要:

我们探索利用 Apache TVM 开源框架自动生成一系列算法,这些算法遵循 GotoBLAS2、BLIS 和 OpenBLAS 等流行线性代数库所采用的方法,以获得通用矩阵乘法(GEMM)的高性能分块公式。此外,我们还通过利用 Apache TVM 框架推导出完整的针对特定处理器的 GEMM 微内核种类,从而完全自动化生成过程。这与高性能库中的惯例形成对比,后者使用汇编代码为每种架构手工编码单个微内核。总体而言,我们由 TVM 生成的分块算法和 GEMM 微内核的组合 1) 提高了可移植性、可维护性,并在整体上简化了软件生命周期;2) 提供了高度灵活性,可轻松定制和优化解决方案以适应不同的数据类型、处理器架构和矩阵操作数形状,其性能与手工调优的库相当(对于特定矩阵形状甚至更优);3) 具有较小的内存占用。

英文摘要:

We explore the utilization of the Apache TVM open source framework to automatically generate a family of algorithms that follow the approach taken by popular linear algebra libraries, such as GotoBLAS2, BLIS and OpenBLAS, in order to obtain high-performance blocked formulations of the general matrix multiplication (GEMM). % In addition, we fully automatize the generation process, by also leveraging the Apache TVM framework to derive a complete variety of the processor-specific micro-kernels for GEMM. This is in contrast with the convention in high performance libraries, which hand-encode a single micro-kernel per architecture using Assembly code. % In global, the combination of our TVM-generated blocked algorithms and micro-kernels for GEMM 1)~improves portability, maintainability and, globally, streamlines the software life cycle; 2)~provides high flexibility to easily tailor and optimize the solution to different data types, processor architectures, and matrix operand shapes, yielding performance on a par (or even superior for specific matrix shapes) with that of hand-tuned libraries; and 3)~features a small memory footprint.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑