[llvm-branch-commits] [openmp] 48c54f0 - [OpenMP][NVPTX] Added forward declaration for atomic operations
Shilei Tian via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 21 07:41:29 PST 2021
Author: Shilei Tian
Date: 2021-01-21T10:37:16-05:00
New Revision: 48c54f0f623407192e93dc884724a12826eeab4f
URL: https://github.com/llvm/llvm-project/commit/48c54f0f623407192e93dc884724a12826eeab4f
DIFF: https://github.com/llvm/llvm-project/commit/48c54f0f623407192e93dc884724a12826eeab4f.diff
LOG: [OpenMP][NVPTX] Added forward declaration for atomic operations
Pretty similar to 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.
Reviewed By: jdoerfert, JonChesterfield
Differential Revision: https://reviews.llvm.org/D95085
Added:
Modified:
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
Removed:
################################################################################
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
index ba3d331876b1..1d7b649fe20e 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -130,6 +130,15 @@ DEVICE int GetNumberOfThreadsInBlock();
DEVICE unsigned GetWarpId();
DEVICE unsigned GetLaneId();
+// Forward declaration of atomics. Although they're template functions, we
+// already have definitions for
diff erent 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);
More information about the llvm-branch-commits
mailing list