在GPU上实现隐式OpenMP数据共享
Implementing implicit OpenMP data sharing on GPUs
摘要:
OpenMP是一种共享内存编程模型,支持将目标区域卸载到加速器(如NVIDIA GPU)。Clang/LLVM中的实现旨在提供一个通用的GPU编译工具链,支持原生CUDA C/C++和OpenMP设备卸载模型。在某些情况下,OpenMP的语义和CUDA的语义存在分歧。一个这样的例子是隐式处理局部变量的策略。在CUDA中,局部变量被隐式映射到线程本地内存,因此成为CUDA线程的私有变量。在OpenMP中,由于语义允许嵌套由不同数量的线程执行的区域,因此变量需要在争用组的线程之间隐式地为\emph{shared}。在本文中,我们介绍了一个重新设计的OpenMP设备数据共享基础设施,负责隐式共享本地变量的Clang/LLVM工具链。我们引入了一个新的数据共享基础设施,降低隐式共享变量的GPU的共享内存。在涉及标量变量和静态分配数组的情况下,我们测量我们的方案使用的共享内存量。通过卸载到K40和P100 NVIDIA GPU进行评估。对于标量变量,共享内存的压力相对较低,低于K40共享内存利用率的26%,并且不会对占用率产生负面影响。在这种情况下,限制占用因素是寄存器压力。数据共享方案为用户提供了一个简单的内存模型,用于控制设备共享内存的隐式分配。
英文摘要:
OpenMP is a shared memory programming model which supports the offloading of target regions to accelerators such as NVIDIA GPUs. The implementation in Clang/LLVM aims to deliver a generic GPU compilation toolchain that supports both the native CUDA C/C++ and the OpenMP device offloading models. There are situations where the semantics of OpenMP and those of CUDA diverge. One such example is the policy for implicitly handling local variables. In CUDA, local variables are implicitly mapped to thread local memory and thus become private to a CUDA thread. In OpenMP, due to semantics that allow the nesting of regions executed by different numbers of threads, variables need to be implicitly \emph{shared} among the threads of a contention group. In this paper we introduce a re-design of the OpenMP device data sharing infrastructure that is responsible for the implicit sharing of local variables in the Clang/LLVM toolchain. We introduce a new data sharing infrastructure that lowers implicitly shared variables to the shared memory of the GPU. We measure the amount of shared memory used by our scheme in cases that involve scalar variables and statically allocated arrays. The evaluation is carried out by offloading to K40 and P100 NVIDIA GPUs. For scalar variables the pressure on shared memory is relatively low, under 26\% of shared memory utilization for the K40, and does not negatively impact occupancy. The limiting occupancy factor in that case is register pressure. The data sharing scheme offers the users a simple memory model for controlling the implicit allocation of device shared memory.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。