• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===---- target_atomic.h - OpenMP GPU target atomic functions ---- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Declarations of atomic functions provided by each target
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef OMPTARGET_TARGET_ATOMIC_H
14 #define OMPTARGET_TARGET_ATOMIC_H
15 
16 #include "target_impl.h"
17 
__kmpc_atomic_add(T * address,T val)18 template <typename T> INLINE T __kmpc_atomic_add(T *address, T val) {
19   return atomicAdd(address, val);
20 }
21 
__kmpc_atomic_inc(T * address,T val)22 template <typename T> INLINE T __kmpc_atomic_inc(T *address, T val) {
23   return atomicInc(address, val);
24 }
25 
__kmpc_atomic_max(T * address,T val)26 template <typename T> INLINE T __kmpc_atomic_max(T *address, T val) {
27   return atomicMax(address, val);
28 }
29 
__kmpc_atomic_exchange(T * address,T val)30 template <typename T> INLINE T __kmpc_atomic_exchange(T *address, T val) {
31   return atomicExch(address, val);
32 }
33 
__kmpc_atomic_cas(T * address,T compare,T val)34 template <typename T> INLINE T __kmpc_atomic_cas(T *address, T compare, T val) {
35   return atomicCAS(address, compare, val);
36 }
37 
38 #endif
39