OSDN Git Service

[NVPTX] Add intrinsics to support named barriers.
authorArpith Chacko Jacob <acjacob@us.ibm.com>
Sat, 28 Jan 2017 16:38:15 +0000 (16:38 +0000)
committerArpith Chacko Jacob <acjacob@us.ibm.com>
Sat, 28 Jan 2017 16:38:15 +0000 (16:38 +0000)
commit5692e8ecc6dac719d82e4194db890ba4bbdec927
tree452634da6c794a63db0bf2c0bc7df81d740f37d2
parentbd96ea7b6ad1c7f697599b3536f19ee3135679b1
[NVPTX] Add intrinsics to support named barriers.

Support for barrier synchronization between a subset of threads
in a CTA through one of sixteen explicitly specified barriers.
These intrinsics are not directly exposed in CUDA but are
critical for forthcoming support of OpenMP on NVPTX GPUs.

The intrinsics allow the synchronization of an arbitrary
(multiple of 32) number of threads in a CTA at one of 16
distinct barriers. The two intrinsics added are as follows:

call void @llvm.nvvm.barrier.n(i32 10)
waits for all threads in a CTA to arrive at named barrier #10.

call void @llvm.nvvm.barrier(i32 15, i32 992)
waits for 992 threads in a CTA to arrive at barrier #15.

Detailed description of these intrinsics are available in the PTX manual.
http://docs.nvidia.com/cuda/parallel-thread-execution/#parallel-synchronization-and-communication-instructions

Reviewers: hfinkel, jlebar
Differential Revision: https://reviews.llvm.org/D17657

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293384 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/IntrinsicsNVVM.td
lib/Target/NVPTX/NVPTXIntrinsics.td
test/CodeGen/NVPTX/named-barriers.ll [new file with mode: 0644]