利用 Exo 应对矩阵乘法微内核生成问题
Tackling the Matrix Multiplication Micro-kernel Generation with Exo
AI总结:
本文针对 GEMM 微内核需为每种新硬件手工开发的问题,提出利用 Exo 编译器逐步生成微内核的方法,在性能接近或优于手工实现的同时,通过基于库的指令描述提升代码可移植性。
摘要:
在过去几十年中,矩阵乘法(或 GEMM)的优化一直是一项持续需求。由于该运算在大量科学应用中被广泛使用,它被视为当前线性代数库(如 BLIS、OpenBLAS 或 Intel OneAPI)的旗舰运算。GEMM 通常按照 GotoBLAS 思想实现,即对 GEMM 操作数进行分块,并使用一系列嵌套循环来提升性能。这些方法通过被称为微内核的、面向硬件的高性能小型代码片段来充分提取架构的最大计算能力。然而,这种方法迫使开发人员为每一种新硬件生成专用微内核,所需投入的精力不可忽视。在本文中,我们提出了一种利用 Exo 编译器逐步生成微内核的过程,其性能接近(甚至优于)使用 intrinsic 函数或汇编语言手工开发的微内核。我们的解决方案还提高了所生成代码的可移植性,因为硬件目标可以通过对其指令进行简洁的基于库的描述来完整指定。
英文摘要:
The optimization of the matrix multiplication (or GEMM) has been a need during the last decades. This operation is considered the flagship of current linear algebra libraries such as BLIS, OpenBLAS, or Intel OneAPI because of its widespread use in a large variety of scientific applications. The GEMM is usually implemented following the GotoBLAS philosophy, which tiles the GEMM operands and uses a series of nested loops for performance improvement. These approaches extract the maximum computational power of the architectures through small pieces of hardware-oriented, high-performance code called micro-kernel. However, this approach forces developers to generate, with a non-negligible effort, a dedicated micro-kernel for each new hardware. In this work, we present a step-by-step procedure for generating micro-kernels with the Exo compiler that performs close to (or even better than) manually developed microkernels written with intrinsic functions or assembly language. Our solution also improves the portability of the generated code, since a hardware target is fully specified by a concise library-based description of its instructions.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。