高效稀疏张量格式转换线的自动生成
Automatic Generation of Efficient Sparse Tensor Format Conversion Routines
摘要:
本文展示了如何生成代码,在不同的存储格式(数据布局)(如CSR,DIA,ELL等)之间有效地转换稀疏张量。我们将稀疏张量转换分解为三个逻辑阶段:坐标重映射,分析和组装。然后,我们开发了一种语言,精确地描述了不同的格式如何组合在一起,并在内存中排序张量的非零值。这使编译器在格式之间转换时发出执行非零的复杂重映射的代码。我们还开发了一个查询语言,可以提取稀疏张量的统计数据,我们展示了如何发出有效的分析代码,计算这样的查询。最后,我们定义了一个抽象的接口,捕捉如何存储张量的数据结构可以有效地组装给定的具体统计量的张量。不同的格式可以实现这个公共接口,从而让编译器为许多格式的任意组合发出优化的稀疏张量转换代码,而无需为任何特定组合进行硬编码。我们的评估表明,该技术生成的稀疏张量转换例程的性能在1.00和2.01之间的$\times$的手工优化版本SPARSKIT和英特尔MKL,两个流行的稀疏线性代数库。通过发出代码,避免物质化临时,这两个库需要的许多组合的源和目标格式,我们的技术优于这些库的1.78至4.01 $\times$的CSC/COO到DIA/ELL转换。
英文摘要:
This paper shows how to generate code that efficiently converts sparse tensors between disparate storage formats (data layouts) such as CSR, DIA, ELL, and many others. We decompose sparse tensor conversion into three logical phases: coordinate remapping, analysis, and assembly. We then develop a language that precisely describes how different formats group together and order a tensor's nonzeros in memory. This lets a compiler emit code that performs complex remappings of nonzeros when converting between formats. We also develop a query language that can extract statistics about sparse tensors, and we show how to emit efficient analysis code that computes such queries. Finally, we define an abstract interface that captures how data structures for storing a tensor can be efficiently assembled given specific statistics about the tensor. Disparate formats can implement this common interface, thus letting a compiler emit optimized sparse tensor conversion code for arbitrary combinations of many formats without hard-coding for any specific combination. Our evaluation shows that the technique generates sparse tensor conversion routines with performance between 1.00 and 2.01$\times$ that of hand-optimized versions in SPARSKIT and Intel MKL, two popular sparse linear algebra libraries. And by emitting code that avoids materializing temporaries, which both libraries need for many combinations of source and target formats, our technique outperforms those libraries by 1.78 to 4.01$\times$ for CSC/COO to DIA/ELL conversion.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。