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