arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2404.16730cs.MS
收藏

Finch:支持控制流的稀疏与结构化张量编程

Finch: Sparse and Structured Tensor Programming with Control Flow

Willow Ahrens, Theadora Fields Collin, Radha Patel, Kyle Deeds, Changwan Hong, Saman Amarasinghe

AI总结:

提出支持灵活控制流与多样化数据结构的编程语言Finch,通过将控制流与数据结构协同优化,可靠利用张量结构特性,在SpMV、SpGEMM等操作中实现显著加速。

摘要:

从 FORTRAN 到 NumPy,张量彻底改变了我们表达计算的方式。然而,这些以及几乎所有主流系统中的张量,都只能处理稠密的直线型整数网格。现实世界中的张量通常包含底层结构,如稀疏性、重复值的游程或对称性。对结构化数据的支持是碎片化且不完整的。现有的框架限制了它们支持的张量结构和程序控制流,以便更好地简化问题。在这项工作中,我们提出了一种新的编程语言 Finch,它同时支持灵活的控制流和多样化的数据结构。Finch 促进了一种编程模型,该模型通过将控制流和数据结构结合到一个可以协同优化的通用表示中,解决了在结构化张量上进行计算的挑战。Finch 自动将控制流专门化为数据,使性能工程师能够专注于尝试多种算法。Finch 支持熟悉的循环、语句、if、break 等编程语言,适用于多种张量结构,如稀疏性、游程编码、对称性、三角形、填充或块。Finch 可靠地利用结构的关键属性,如结构零、重复值或聚集的非零值。我们表明,这在 SpMV 和 SpGEMM、图像处理和图分析等操作中带来了显著的加速。

英文摘要:

From FORTRAN to NumPy, tensors have revolutionized how we express computation. However, tensors in these, and almost all prominent systems, can only handle dense rectilinear integer grids. Real world tensors often contain underlying structure, such as sparsity, runs of repeated values, or symmetry. Support for structured data is fragmented and incomplete. Existing frameworks limit the tensor structures and program control flow they support to better simplify the problem. In this work, we propose a new programming language, Finch, which supports both flexible control flow and diverse data structures. Finch facilitates a programming model which resolves the challenges of computing over structured tensors by combining control flow and data structures into a common representation where they can be co-optimized. Finch automatically specializes control flow to data so that performance engineers can focus on experimenting with many algorithms. Finch supports a familiar programming language of loops, statements, ifs, breaks, etc., over a wide variety of tensor structures, such as sparsity, run-length-encoding, symmetry, triangles, padding, or blocks. Finch reliably utilizes the key properties of structure, such as structural zeros, repeated values, or clustered non-zeros. We show that this leads to dramatic speedups in operations such as SpMV and SpGEMM, image processing, and graph analytics.

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

↑