paperbot · PL 论文追踪

全部论文 待读 收藏

P2 StreamAlloc: A Framework for Analyzing and Transforming CUDA Code to Enable Asynchronous Execution

StreamAlloc:一个用于分析与变换 CUDA 代码以实现异步执行的框架
TOPLAS 48(2)2026匹配度 3/10 · 论文是 CUDA 程序的静态数据流分析与编译变换,属于 PL/编译方向,但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,与用户画像的核心交叉领域(PL×AI)匹配度低;仅因涉及静态分析和 GPU 代码(可能用于 ML 底层)而有边缘关联。引用 0 inbox
Soumik Kumar Basu, Jyothi Vedurada
crossref: 2026-09-10

AI 速览

一句话:提出 sync2async 优化与 StreamAlloc 数据流分析框架,自动为 CUDA 同步传输与内核分配流并插入同步,在保持依赖的前提下最大化并行。

在 CUDA 编程模型中,默认流上的数据传输与内核启动是同步的,无法彼此重叠,而使用异步 API 与多流虽可实现重叠执行,却要求程序员仔细处理跨数据传输、主机操作与内核计算的数据依赖,并为每个调用分配合适的流标识,这对非专家开发者极为困难。为此,作者提出 sync2async 优化技术,将同步的数据传输与内核启动转换为非默认流的异步调用,通过分配流标识并在恰当位置插入流同步来在保持依赖的同时最大化可并行性。为识别转换机会并实施变换,作者设计了 StreamAlloc 框架,包含四个组件:过程间组合式读写分析、过程内流敏感的 Can-Run-Asynchronously 分析、Dataflow Stream Assignment 流分配算法以及变换框架。该框架基于 LLVM/Clang 实现,在 P100、A4000 与 A100 GPU 上相对基线分别取得 1.49×、1.63× 与 2.02× 的几何平均加速。

问题
CUDA 默认流上的数据传输与内核启动是同步的,无法重叠执行;手动改用异步 API 与多流需要正确处理跨调用的数据依赖并为每次调用分配流标识,非专家程序员难以胜任。
方法
提出 StreamAlloc 框架:用过程间组合式读写分析确定调用点读写变量,用过程内流敏感 CRA 分析识别可异步执行的数据传输与内核调用,用 DFSA 算法将其调度到非默认流,并通过变换框架自动应用 sync2async 优化。
评估
基于 LLVM/Clang 实现 StreamAlloc,并在 P100、A4000 与 A100 GPU 上与基线对比,sync2async 分别取得 1.49×、1.63× 与 2.02× 的几何平均加速。
原文摘要(Abstract)

In the CUDA programming model, data transfers on the default stream are synchronous, and, similarly, device kernels launched on the default stream cannot overlap with other kernel computations and data transfers. Overlapping execution can be enabled using asynchronous APIs and streams in CUDA. Using them, however, requires careful handling of data dependencies across multiple data transfer calls, host operations, and kernel computations to ensure program correctness. Moreover, numerous data transfer calls and kernel calls in a program make it even more challenging to manually assign the appropriate stream identifier for each such call. This challenge remains daunting for non-expert programmers because they lack the right tools and expertise. To address this, we propose sync2async, a novel optimization technique that transforms synchronous data transfers and kernel launches into non-default-stream asynchronous calls by allocating stream identifiers (and adding stream synchronizations at appropriate places) to maximize parallelizability while preserving dependencies. To identify sync2async opportunities and apply transformations, we introduce StreamAlloc, a dataflow-analysis-based framework with four components: (1) inter-procedural compositional read–write analysis to identify variables read and written at call sites, (2) intra-procedural flow-sensitive Can-Run-Asynchronously (CRA) analysis to detect data transfer and kernel calls that can run asynchronously, (3) Dataflow Stream Assignment (DFSA) algorithm to schedule such asynchronous calls to different non-default streams, and (4) a transformation framework to apply sync2async and automatically optimize the input program. We have implemented StreamAlloc using LLVM/Clang. On P100, A4000, and A100 GPUs, sync2async achieves geomean speedups of 1.49×, 1.63×, and 2.02× over the baseline, respectively.

链接与引用

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

BibTeX
@article{BasuV26,
  title = {StreamAlloc: A Framework for Analyzing and Transforming CUDA Code to Enable Asynchronous Execution},
  author = {Soumik Kumar Basu and Jyothi Vedurada},
  journal = {ACM Transactions on Programming Languages and Systems},
  volume = {48},
  number = {2},
  year = {2026},
  doi = {10.1145/3799893}
}