高性能稠密线性代数的最后一英里自动化
Automating the Last-Mile for High Performance Dense Linear Algebra
摘要:
高性能密集线性代数(DLA)库通常依赖于使用汇编或向量内部函数实现的通用矩阵乘法(Gemm)内核。特别是,实值Gemm内核提供了复值Gemm内核的绝大多数性能,以及整个3级BLAS和许多实和复LAPACK例程。因此,实现Gemm内核的高性能转化为该内核之上的高性能线性代数堆栈。然而,对于领域专家来说,为每个库支持的体系结构手动实现内核是一项艰巨的任务。这导致人们相信宝石内核的工艺更像是黑暗艺术而不是科学。正是这个前提推动了DLA领域中使用代码生成进行自动调优的流行。相反,本文的重点是分析方法的代码生成的Gemm内核的不同的体系结构,为了阐明的细节或巫术需要实现一个高性能的Gemm内核。我们蒸馏的内核到一个更小的内核,外产品的实施,并分析确定如何可用的SIMD指令可以用来计算外产品有效。我们将这种方法编入一个系统,自动生成一个高性能的SIMD实现的Gemm内核。实验结果表明,我们的方法产生的内核与人工实现的内核或使用经验搜索的性能具有竞争力。
英文摘要:
High performance dense linear algebra (DLA) libraries often rely on a general matrix multiply (Gemm) kernel that is implemented using assembly or with vector intrinsics. In particular, the real-valued Gemm kernels provide the overwhelming fraction of performance for the complex-valued Gemm kernels, along with the entire level-3 BLAS and many of the real and complex LAPACK routines. Thus,achieving high performance for the Gemm kernel translates into a high performance linear algebra stack above this kernel. However, it is a monumental task for a domain expert to manually implement the kernel for every library-supported architecture. This leads to the belief that the craft of a Gemm kernel is more dark art than science. It is this premise that drives the popularity of autotuning with code generation in the domain of DLA. This paper, instead, focuses on an analytical approach to code generation of the Gemm kernel for different architecture, in order to shed light on the details or voo-doo required for implementing a high performance Gemm kernel. We distill the implementation of the kernel into an even smaller kernel, an outer-product, and analytically determine how available SIMD instructions can be used to compute the outer-product efficiently. We codify this approach into a system to automatically generate a high performance SIMD implementation of the Gemm kernel. Experimental results demonstrate that our approach yields generated kernels with performance that is competitive with kernels implemented manually or using empirical search.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。