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

SySTeC:一种对称稀疏张量编译器

SySTeC: A Symmetric Sparse Tensor Compiler

Radha Patel, Willow Ahrens, Saman Amarasinghe

AI总结:

本文提出首个能同时利用对称性与稀疏性的张量编译器SySTeC,通过对称性分类与自动代码生成,实现对稀疏或结构化张量内核的优化,较非对称方法加速1.36至30.4倍。

摘要:

对称张量和稀疏张量在许多领域自然出现,包括线性代数、统计学、物理学、化学和图论。对称张量等于其转置,因此在$n$维情况下,我们可以通过避免冗余操作节省多达$n!$倍的计算量。另一方面,稀疏张量大部分元素为零,我们可以通过仅处理非零元素来获得渐近节省。不幸的是,同时针对对称性和稀疏性进行特化是独特的挑战。优化对称性需要考虑三角核的$n!$种转置,这可能复杂且容易出错。考虑多种转置的迭代顺序和三角循环边界也使通过复杂的稀疏张量格式进行迭代复杂化。此外,由于对称性和稀疏张量格式的每种组合都需要专门的实现,这导致组合数量的情况。需要编译器,但现有编译器无法在同一内核中同时利用对称性和稀疏性。在本文中,我们描述了第一个能够自动为稀疏或结构化张量内核生成对称感知代码的编译器。我们引入了张量内核中对称性的分类法,并展示了如何针对每种对称性。我们的实现展示了显著的加速,从SSYMV的1.36倍到5维MTTKRP的30.4倍,相对于非对称的最先进方法。

英文摘要:

Symmetric and sparse tensors arise naturally in many domains including linear algebra, statistics, physics, chemistry, and graph theory. Symmetric tensors are equal to their transposes, so in the $n$-dimensional case we can save up to a factor of $n!$ by avoiding redundant operations. Sparse tensors, on the other hand, are mostly zero, and we can save asymptotically by processing only nonzeros. Unfortunately, specializing for both symmetry and sparsity at the same time is uniquely challenging. Optimizing for symmetry requires consideration of $n!$ transpositions of a triangular kernel, which can be complex and error prone. Considering multiple transposed iteration orders and triangular loop bounds also complicates iteration through intricate sparse tensor formats. Additionally, since each combination of symmetry and sparse tensor formats requires a specialized implementation, this leads to a combinatorial number of cases. A compiler is needed, but existing compilers cannot take advantage of both symmetry and sparsity within the same kernel. In this paper, we describe the first compiler which can automatically generate symmetry-aware code for sparse or structured tensor kernels. We introduce a taxonomy for symmetry in tensor kernels, and show how to target each kind of symmetry. Our implementation demonstrates significant speedups ranging from 1.36x for SSYMV to 30.4x for a 5-dimensional MTTKRP over the non-symmetric state of the art.

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

↑