[Openmp-commits] [PATCH] D95085: [OpenMP][NVPTX] Added forward declaration for atomic operations
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jan 20 13:12:21 PST 2021
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: jfb, guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
Pretty similar to D95058 <https://reviews.llvm.org/D95058>, this patch added forward declaration for
CUDA atomic functions. We already have definitions with right mangled names in
internal CUDA headers so the forward declaration here can work properly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95085
Files:
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -130,6 +130,15 @@
DEVICE unsigned GetWarpId();
DEVICE unsigned GetLaneId();
+// Forward declaration of atomics. Although they're template functions, we
+// already have definitions for different types in CUDA internal headers with
+// the right mangled names.
+template <typename T> T atomicAdd(T *address, T val);
+template <typename T> T atomicInc(T *address, T val);
+template <typename T> T atomicMax(T *address, T val);
+template <typename T> T atomicExch(T *address, T val);
+template <typename T> T atomicCAS(T *address, T compare, T val);
+
// Atomics
template <typename T> INLINE T __kmpc_atomic_add(T *address, T val) {
return atomicAdd(address, val);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95085.317987.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210120/a0317f53/attachment-0001.bin>
More information about the Openmp-commits
mailing list