一句话:提出 Descend,一种在类型系统中追踪所有权与生命周期、保证 CPU/GPU 内存安全并支持 GPU 层次化执行资源的系统编程语言。
GPU 提供大规模并行算力,但 CUDA/OpenCL 等 C/C++ 系语言用原始指针访问内存,易产生数据竞争和死锁。Descend 是受 Rust 启发的安全命令式 GPU 系统编程语言,在类型系统中追踪所有权与生命周期以保证 CPU/GPU 内存安全。它引入覆盖 grid、block、warp、thread 的层次化 GPU 模型,并用扩展 borrow checking、views 与原子变量确保执行资源无数据竞争地访问内存,无法检查的代码段可标注 unsafe。论文讨论其内存安全保证,并用多个基准测试表明其能表达真实 GPU 程序,性能与手写 CUDA 相比有竞争力。
Graphics Processing Units (GPU) offer tremendous computational power by following a throughput oriented paradigm where many thousand computational units operate in parallel. Programming such massively parallel hardware is challenging. Programmers must correctly and efficiently coordinate thousands of threads and their accesses to various shared memory spaces. Existing mainstream GPU programming languages, such as CUDA and OpenCL, are based on C/C++ inheriting their fundamentally unsafe ways to access memory via raw pointers. This facilitates easy to make, but hard to detect bugs, such as data races and deadlocks . In this paper, we present Descend : a safe GPU programming language. In contrast to prior safe high-level GPU programming approaches, Descend is an imperative GPU systems programming language in the spirit of Rust, enforcing safe CPU and GPU memory management in the type system by tracking Ownership and Lifetimes . Descend introduces a new holistic GPU programming model where computations are hierarchically scheduled over the GPU’s execution resources : grid, blocks, warps, and threads. Descend’s extended Borrow checking ensures that execution resources safely access memory regions without data races. For this, we introduced views describing safe parallel access patterns of memory regions, as well as atomic variables. For memory accesses that can’t be checked by our type system, users can annotate limited code sections as unsafe . We discuss the memory safety guarantees offered by Descend and evaluate our implementation using multiple benchmarks, demonstrating that Descend is capable of expressing real-world GPU programs showing competitive performance compared to manually written CUDA programs lacking Descend’s safety guarantees.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{KopckeGS24,
title = {Descend: A Safe GPU Systems Programming Language},
author = {Bastian Köpcke and Sergei Gorlatch and Michel Steuwer},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {PLDI},
year = {2024},
doi = {10.1145/3656411}
}