{"title":"SySTeC: A Symmetric Sparse Tensor Compiler","authors":"Radha Patel, Willow Ahrens, Saman Amarasinghe","doi":"arxiv-2406.09266","DOIUrl":null,"url":null,"abstract":"Symmetric and sparse tensors arise naturally in many domains including linear\nalgebra, statistics, physics, chemistry, and graph theory. Symmetric tensors\nare equal to their transposes, so in the $n$-dimensional case we can save up to\na factor of $n!$ by avoiding redundant operations. Sparse tensors, on the other\nhand, are mostly zero, and we can save asymptotically by processing only\nnonzeros. Unfortunately, specializing for both symmetry and sparsity at the\nsame time is uniquely challenging. Optimizing for symmetry requires\nconsideration of $n!$ transpositions of a triangular kernel, which can be\ncomplex and error prone. Considering multiple transposed iteration orders and\ntriangular loop bounds also complicates iteration through intricate sparse\ntensor formats. Additionally, since each combination of symmetry and sparse\ntensor formats requires a specialized implementation, this leads to a\ncombinatorial number of cases. A compiler is needed, but existing compilers\ncannot take advantage of both symmetry and sparsity within the same kernel. In\nthis paper, we describe the first compiler which can automatically generate\nsymmetry-aware code for sparse or structured tensor kernels. We introduce a\ntaxonomy for symmetry in tensor kernels, and show how to target each kind of\nsymmetry. Our implementation demonstrates significant speedups ranging from\n1.36x for SSYMV to 30.4x for a 5-dimensional MTTKRP over the non-symmetric\nstate of the art.","PeriodicalId":501256,"journal":{"name":"arXiv - CS - Mathematical Software","volume":"9 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-06-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Mathematical Software","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2406.09266","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
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.