一句话:提出 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× 的几何平均加速。
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.
@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}
}