arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.04836cs.PLcs.DCcs.PF
收藏

CoNST:面向稀疏张量网络的代码生成器

CoNST: Code Generator for Sparse Tensor Networks

Saurabh Raje, Yufan Xu, Atanas Rountev, Edward F. Valeev, Saday Sadayappan

AI总结:

提出CoNST代码生成器,通过Z3求解约束系统联合优化稀疏张量收缩树的循环融合与模式布局,并基于TACO生成代码,实现数个数量级的性能提升。

摘要:

稀疏张量网络通常用于表示稀疏张量上的收缩。张量收缩是矩阵乘法的高阶类比。张量网络在科学计算和数据科学的许多领域中很常见。在转换为二值收缩树之后,该网络被实现为一系列单独收缩的序列。在为收缩树生成高效代码时必须考虑几个关键方面,包括稀疏张量布局模式顺序、用于减少中间张量的循环融合,以及循环顺序、模式顺序和收缩顺序之间的相互依赖关系。我们提出了CoNST,这是一种使用单一公式以集成方式考虑这些因素的新方法。我们的方法创建了一个约束系统,对这些决策及其相互依赖关系进行编码,同时旨在通过融合生成降阶中间张量。该约束系统由Z3 SMT求解器求解,结果用于为整个收缩树创建所需的融合循环结构和张量模式布局。该结构被降低至TACO编译器的IR,随后用于生成可执行代码。我们的实验评估表明,与当前最先进的稀疏张量编译器/库替代方案相比,性能有非常显著(有时达数个数量级)的提升。

英文摘要:

Sparse tensor networks are commonly used to represent contractions over sparse tensors. Tensor contractions are higher-order analogs of matrix multiplication. Tensor networks arise commonly in many domains of scientific computing and data science. After a transformation into a tree of binary contractions, the network is implemented as a sequence of individual contractions. Several critical aspects must be considered in the generation of efficient code for a contraction tree, including sparse tensor layout mode order, loop fusion to reduce intermediate tensors, and the interdependence of loop order, mode order, and contraction order. We propose CoNST, a novel approach that considers these factors in an integrated manner using a single formulation. Our approach creates a constraint system that encodes these decisions and their interdependence, while aiming to produce reduced-order intermediate tensors via fusion. The constraint system is solved by the Z3 SMT solver and the result is used to create the desired fused loop structure and tensor mode layouts for the entire contraction tree. This structure is lowered to the IR of the TACO compiler, which is then used to generate executable code. Our experimental evaluation demonstrates very significant (sometimes orders of magnitude) performance improvements over current state-of-the-art sparse tensor compiler/library alternatives.

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

↑