diff options
Diffstat (limited to 'openmp/libomptarget/deviceRTLs/common/state-queuei.h')
| -rw-r--r-- | openmp/libomptarget/deviceRTLs/common/state-queuei.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/openmp/libomptarget/deviceRTLs/common/state-queuei.h b/openmp/libomptarget/deviceRTLs/common/state-queuei.h index 3c3be113e73..1bd261f2826 100644 --- a/openmp/libomptarget/deviceRTLs/common/state-queuei.h +++ b/openmp/libomptarget/deviceRTLs/common/state-queuei.h @@ -1,4 +1,4 @@ -//===------- state-queue.cu - NVPTX OpenMP GPU State Queue ------- CUDA -*-===// +//===------- state-queuei.h - OpenMP GPU State Queue ------------- CUDA -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -17,15 +17,16 @@ //===----------------------------------------------------------------------===// #include "state-queue.h" +#include "common/target_atomic.h" template <typename ElementType, uint32_t SIZE> INLINE uint32_t omptarget_nvptx_Queue<ElementType, SIZE>::ENQUEUE_TICKET() { - return atomicAdd((unsigned int *)&tail, 1); + return __kmpc_atomic_add((unsigned int *)&tail, 1u); } template <typename ElementType, uint32_t SIZE> INLINE uint32_t omptarget_nvptx_Queue<ElementType, SIZE>::DEQUEUE_TICKET() { - return atomicAdd((unsigned int *)&head, 1); + return __kmpc_atomic_add((unsigned int *)&head, 1u); } template <typename ElementType, uint32_t SIZE> @@ -37,28 +38,28 @@ omptarget_nvptx_Queue<ElementType, SIZE>::ID(uint32_t ticket) { template <typename ElementType, uint32_t SIZE> INLINE bool omptarget_nvptx_Queue<ElementType, SIZE>::IsServing(uint32_t slot, uint32_t id) { - return atomicAdd((unsigned int *)&ids[slot], 0) == id; + return __kmpc_atomic_add((unsigned int *)&ids[slot], 0u) == id; } template <typename ElementType, uint32_t SIZE> INLINE void omptarget_nvptx_Queue<ElementType, SIZE>::PushElement(uint32_t slot, ElementType *element) { - atomicExch((unsigned long long *)&elementQueue[slot], - (unsigned long long)element); + __kmpc_atomic_exchange((unsigned long long *)&elementQueue[slot], + (unsigned long long)element); } template <typename ElementType, uint32_t SIZE> INLINE ElementType * omptarget_nvptx_Queue<ElementType, SIZE>::PopElement(uint32_t slot) { - return (ElementType *)atomicAdd((unsigned long long *)&elementQueue[slot], - (unsigned long long)0); + return (ElementType *)__kmpc_atomic_add( + (unsigned long long *)&elementQueue[slot], (unsigned long long)0); } template <typename ElementType, uint32_t SIZE> INLINE void omptarget_nvptx_Queue<ElementType, SIZE>::DoneServing(uint32_t slot, uint32_t id) { - atomicExch((unsigned int *)&ids[slot], (id + 1) % MAX_ID); + __kmpc_atomic_exchange((unsigned int *)&ids[slot], (id + 1) % MAX_ID); } template <typename ElementType, uint32_t SIZE> |

