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

实用快速矩阵乘法算法族的生成

Generating Families of Practical Fast Matrix Multiplication Algorithms

Jianyu Huang, Leslie Rice, Devin A. Matthews, Robert A. van de Geijn

摘要:

矩阵乘法(GEMM)是许多科学应用的核心运算。传统的实现Strassen类快速矩阵乘法(FMM)算法通常不执行,除了非常大的矩阵大小,由于内存移动的成本增加,这是特别明显的非正方形矩阵。这样的实现还需要相当大的工作空间和对标准BLAS接口的修改。我们提出了一个代码生成器框架,自动实现一个大家庭的FMM算法适合于任意矩阵大小和形状的乘法。通过用三个矩阵[U,V,W]来表示FMM,这些矩阵捕获所形成的子矩阵的线性组合,我们可以使用Kronecker积来定义类Strassen算法的多级表示。将Strassen类算法必须执行的矩阵加法扩展到GEMM内部的固有打包和微内核操作中,避免了额外的工作空间,并降低了内存移动的成本。采用与高性能GEMM实现相同的循环结构,允许所有FMM算法的并行化,具有简单但有效的数据并行,而没有任务并行的开销。我们提出了一个简单的性能模型,一般FMM算法和比较实际性能的20+ FMM算法建模的预测。我们的实现表现出的性能优势,传统的GEMM单核和多核系统。这项研究表明,类Strassen快速矩阵乘法可以纳入图书馆的实际使用。

英文摘要:

Matrix multiplication (GEMM) is a core operation to numerous scientific applications. Traditional implementations of Strassen-like fast matrix multiplication (FMM) algorithms often do not perform well except for very large matrix sizes, due to the increased cost of memory movement, which is particularly noticeable for non-square matrices. Such implementations also require considerable workspace and modifications to the standard BLAS interface. We propose a code generator framework to automatically implement a large family of FMM algorithms suitable for multiplications of arbitrary matrix sizes and shapes. By representing FMM with a triple of matrices [U,V,W] that capture the linear combinations of submatrices that are formed, we can use the Kronecker product to define a multi-level representation of Strassen-like algorithms. Incorporating the matrix additions that must be performed for Strassen-like algorithms into the inherent packing and micro-kernel operations inside GEMM avoids extra workspace and reduces the cost of memory movement. Adopting the same loop structures as high-performance GEMM implementations allows parallelization of all FMM algorithms with simple but efficient data parallelism without the overhead of task parallelism. We present a simple performance model for general FMM algorithms and compare actual performance of 20+ FMM algorithms to modeled predictions. Our implementations demonstrate a performance benefit over conventional GEMM on single core and multi-core systems. This study shows that Strassen-like fast matrix multiplication can be incorporated into libraries for practical use.

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

↑