paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Compilation of Modular and General Sparse Workspaces

模块化与通用稀疏工作区的编译
PLDI 8(PLDI)2024匹配度 2/10 · 该论文属于稀疏张量代数的编译器与代码生成,虽与PL/ML系统编译有间接关联,但不涉及用户核心关注的静态分析、Agentic程序、LLM与程序分析/形式化验证、浮点程序分析或贝叶斯程序分析。其研究目标也不是用AI改进PL,因此匹配度较低。引用 12 inbox
Genghan Zhang, Olivia Hsu, Fredrik Kjolstad
dblp: 2026-09-10crossref: 2026-09-10arxiv: 2026-09-10

AI 速览

一句话:提出一种编译器设计,自动检测稀疏散射并插入模块化稀疏中间工作区张量,以高效生成稀疏张量代数代码。

稀疏张量代数编译器在将值散射到不支持随机插入的稀疏结果张量时,常生成时间与空间低效的代码。本文提出一种编译器设计:自动检测张量表达式中的稀疏散射行为,并插入稀疏中间张量(稀疏工作区)作为散射计算与结果张量之间的高效适配器;同时给出模块化的工作区插入算法模板,支持跨越多个用户自定义实现的工作区。评估显示,稀疏工作区比此前工作的稠密工作区最高快 27.12×,但某些场景下稠密工作区反而最高快 7.58×,因此编译器需同时支持两者。生成的顺序代码在其支持的表达式上可与手工优化的线性代数与张量库竞争,且稀疏工作区通过压缩零元素可渐近降低内存占用,使原本会内存不足的张量计算成为可能。

问题
已有稀疏张量代数编译器在把结果散射进不支持随机插入的稀疏结果张量时,生成的代码在时间和空间上都不够高效。
方法
设计一种编译器,自动识别张量表达式中的稀疏散射行为并插入稀疏中间工作区张量,其核心是模块化的工作区插入算法模板,可支持跨越多个用户自定义实现的工作区。
评估
与先前工作的稠密工作区及其他实现对比:稀疏工作区最高快 27.12×,而某些情形下稠密工作区反而最高快 7.58×;生成的顺序代码可与手工优化的线性代数与张量库竞争,并在内存上因零元素压缩而更高效。
原文摘要(Abstract)

Recent years have seen considerable work on compiling sparse tensor algebra expressions. This paper addresses a shortcoming in that work, namely how to generate efficient code (in time and space) that scatters values into a sparse result tensor. We address this shortcoming through a compiler design that generates code that uses sparse intermediate tensors (sparse workspaces) as efficient adapters between compute code that scatters and result tensors that do not support random insertion. Our compiler automatically detects sparse scattering behavior in tensor expressions and inserts necessary intermediate workspace tensors. We present an algorithm template for workspace insertion that is the backbone of our code generation algorithm. Our algorithm template is modular by design, supporting sparse workspaces that span multiple user-defined implementations. Our evaluation shows that sparse workspaces can be up to 27.12 × faster than the dense workspaces of prior work. On the other hand, dense workspaces can be up to 7.58 × faster than the sparse workspaces generated by our compiler in other situations, which motivates our compiler design that supports both. Our compiler produces sequential code that is competitive with hand-optimized linear and tensor algebra libraries on the expressions they support, but that generalizes to any other expression. Sparse workspaces are also more memory efficient than dense workspaces as they compress away zeros. This compression can asymptotically decrease memory usage, enabling tensor computations on data that would otherwise run out of memory.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@article{ZhangHK24,
  title = {Compilation of Modular and General Sparse Workspaces},
  author = {Genghan Zhang and Olivia Hsu and Fredrik Kjolstad},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {PLDI},
  year = {2024},
  doi = {10.1145/3656426}
}