[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 15:51:02 PST 2021
tianshilei1992 updated this revision to Diff 318046.
tianshilei1992 added a comment.
Mark those forward declarations as `DEVICE`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95085/new/
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> DEVICE T atomicAdd(T *address, T val);
+template <typename T> DEVICE T atomicInc(T *address, T val);
+template <typename T> DEVICE T atomicMax(T *address, T val);
+template <typename T> DEVICE T atomicExch(T *address, T val);
+template <typename T> DEVICE 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.318046.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210120/70c37e99/attachment-0001.bin>
More information about the Openmp-commits
mailing list