arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.03448cs.PL
收藏

Descend:一种安全的GPU系统编程语言

Descend: A Safe GPU Systems Programming Language

Bastian Köpcke, Sergei Gorlatch, Michel Steuwer

AI总结:

针对现有主流GPU编程语言存在内存安全隐患的问题,本文提出安全GPU系统编程语言Descend,通过所有权、生命周期和扩展借用检查等机制保障内存安全,实验显示其相对手写CUDA无显著运行时开销。

摘要:

图形处理单元(GPU)遵循面向吞吐量的计算范式,数千个计算单元并行运行,由此提供了极强的计算能力。对这种大规模并行硬件进行编程颇具挑战。程序员必须正确且高效地协调数千个线程,以及它们对各类共享内存空间的访问。现有的主流GPU编程语言,如CUDA和OpenCL,都基于C/C++开发,继承了其通过原始指针访问内存的本质不安全的方式,这极易引发数据竞争、死锁等难以检测的bug。\n 本文提出了Descend——一种安全的GPU系统编程语言。秉承Rust的设计理念,Descend的类型系统通过追踪所有权(Ownership)和生命周期(Lifetimes),实现CPU与GPU内存的安全管理。Descend引入了一种全新的整体式GPU编程模型,计算任务可在GPU的执行资源(网格、线程块、线程)上进行分层调度。Descend扩展后的借用检查(Borrow checking)机制可确保执行资源安全访问内存区域,不会引发数据竞争。为此,我们提出了视图(views)的概念,用于描述内存区域的安全并行访问模式。\n 本文讨论了Descend类型系统提供的内存安全保障,并通过多个基准测试程序对Descend的实现进行了评估,结果表明,与不具备Descend安全保障的手写CUDA程序相比,Descend不会带来显著的运行时开销。

英文摘要:

Graphics Processing Units (GPU) offer tremendous computational power by following a throughput oriented computing paradigm where many thousand computational units operate in parallel. Programming this 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 systems programming language. In the spirit of Rust, Descend's type system enforces safe CPU and GPU memory management 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, and threads. Descend's extended Borrow checking ensures that execution resources safely access memory regions without introducing data races. For this, we introduced views describing safe parallel access patterns of memory regions. We discuss the memory safety guarantees offered by Descend's type system and evaluate our implementation of Descend using a number of benchmarks, showing that no significant runtime overhead is introduced compared to manually written CUDA programs lacking Descend's safety guarantees.

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

↑