diff options
author | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2019-12-12 22:56:13 +0000 |
---|---|---|
committer | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2019-12-12 22:56:14 +0000 |
commit | 479868646a6a3a83dda482e8da26f77a1a39c58d (patch) | |
tree | 471aed087abbdcde6cd910555d9b75e1bcd6d7dd | |
parent | 5368f35efaf65d1085472b9ef24e33bb043f384c (diff) | |
download | bcm5719-llvm-479868646a6a3a83dda482e8da26f77a1a39c58d.tar.gz bcm5719-llvm-479868646a6a3a83dda482e8da26f77a1a39c58d.zip |
[libomptarget][nfc] Add declarations of atomic functions for amdgcn
Summary:
[libomptarget][nfc] Add declarations of atomic functions for amdgcn
This enables building more source for amdgcn. The functions are usually available
in a hip runtime header, but are duplicated here to decouple the implementation
Reviewers: jdoerfert, ABataev, grokos
Reviewed By: jdoerfert
Subscribers: jvesely, mgorny, jfb, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D71412
-rw-r--r-- | openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt | 1 | ||||
-rw-r--r-- | openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h | 39 | ||||
-rw-r--r-- | openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h | 2 |
3 files changed, 42 insertions, 0 deletions
diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt index 6b82b4eccdc..daa5e6bcd67 100644 --- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt +++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt @@ -60,6 +60,7 @@ set(cuda_sources set(h_files ${CMAKE_CURRENT_SOURCE_DIR}/src/amdgcn_interface.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/hip_atomics.h ${CMAKE_CURRENT_SOURCE_DIR}/src/target_impl.h ${devicertl_base_directory}/common/debug.h ${devicertl_base_directory}/common/device_environment.h diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h b/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h new file mode 100644 index 00000000000..9e0edbbbba5 --- /dev/null +++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h @@ -0,0 +1,39 @@ +//===---- hip_atomics.h - Declarations of hip 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 +// +//===----------------------------------------------------------------------===// + +#ifndef OMPTARGET_AMDGCN_HIP_ATOMICS_H +#define OMPTARGET_AMDGCN_HIP_ATOMICS_H + +#include "target_impl.h" + +DEVICE unsigned atomicAdd(unsigned *address, unsigned val); +DEVICE int atomicAdd(int *address, int val); +DEVICE unsigned long long atomicAdd(unsigned long long *address, + unsigned long long val); + +DEVICE unsigned atomicInc(unsigned *address); +DEVICE unsigned atomicInc(unsigned *address, unsigned max); +DEVICE int atomicInc(int *address); + +DEVICE int atomicMax(int *address, int val); +DEVICE unsigned atomicMax(unsigned *address, unsigned val); +DEVICE unsigned long long atomicMax(unsigned long long *address, + unsigned long long val); + +DEVICE int atomicExch(int *address, int val); +DEVICE unsigned atomicExch(unsigned *address, unsigned val); +DEVICE unsigned long long atomicExch(unsigned long long *address, + unsigned long long val); + +DEVICE unsigned atomicCAS(unsigned *address, unsigned compare, unsigned val); +DEVICE int atomicCAS(int *address, int compare, int val); +DEVICE unsigned long long atomicCAS(unsigned long long *address, + unsigned long long compare, + unsigned long long val); + +#endif diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h index 823fc283dc8..d9b61fd7558 100644 --- a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h +++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h @@ -27,6 +27,8 @@ #define SHARED __attribute__((shared)) #define ALIGN(N) __attribute__((aligned(N))) +#include "hip_atomics.h" + //////////////////////////////////////////////////////////////////////////////// // Kernel options //////////////////////////////////////////////////////////////////////////////// |