Skip to content

Commit 5a4a05d

Browse files
[libomptarget][nfc] Move some source into common from nvptx
Summary: [libomptarget][nfc] Move some source into common from nvptx Moves some source that compiles cleanly under amdgcn into a common subdirectory Includes some non-trivial files and some headers. Keeps the cuda file extension. The build systems for different architectures seem unlikely to have much in common. The idea is therefore to set include paths such that files under common/src compile as if they were under arch/src as the mechanism for sharing. In particular, files under common/src need to be able to include target_impl.h. The corresponding -Icommon is left out in favour of explicit includes on the basis that the it makes it clearer which files under common are used by a given architecture. Reviewers: jdoerfert, ABataev, grokos Reviewed By: ABataev Subscribers: jfb, mgorny, openmp-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D70328
1 parent 17e37ba commit 5a4a05d

File tree

10 files changed

+18
-11
lines changed

10 files changed

+18
-11
lines changed

openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu renamed to openmp/libomptarget/deviceRTLs/common/src/cancel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "interface.h"
14-
#include "debug.h"
14+
#include "common/debug.h"
1515

1616
EXTERN int32_t __kmpc_cancellationpoint(kmp_Ident *loc, int32_t global_tid,
1717
int32_t cancelVal) {

openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu renamed to openmp/libomptarget/deviceRTLs/common/src/critical.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "interface.h"
14-
#include "debug.h"
14+
#include "common/debug.h"
1515

1616
EXTERN
1717
void __kmpc_critical(kmp_Ident *loc, int32_t global_tid,

openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ endif()
3838
get_filename_component(devicertl_base_directory
3939
${CMAKE_CURRENT_SOURCE_DIR}
4040
DIRECTORY)
41+
set(devicertl_common_directory
42+
${devicertl_base_directory}/common)
43+
set(devicertl_nvptx_directory
44+
${devicertl_base_directory}/nvptx)
4145

4246
if(LIBOMPTARGET_DEP_CUDA_FOUND)
4347
libomptarget_say("Building CUDA offloading device RTL.")
@@ -47,17 +51,17 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
4751
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
4852

4953
set(cuda_src_files
50-
src/cancel.cu
51-
src/critical.cu
54+
${devicertl_common_directory}/src/cancel.cu
55+
${devicertl_common_directory}/src/critical.cu
5256
src/data_sharing.cu
5357
src/libcall.cu
54-
src/loop.cu
58+
${devicertl_common_directory}/src/loop.cu
5559
src/omptarget-nvptx.cu
5660
src/parallel.cu
5761
src/reduction.cu
5862
src/support.cu
5963
src/sync.cu
60-
src/task.cu
64+
${devicertl_common_directory}/src/task.cu
6165
)
6266

6367
set(omp_data_objects src/omp_data.cu)
@@ -88,7 +92,8 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
8892
# yet supported by the CUDA toolchain on the device.
8993
set(BUILD_SHARED_LIBS OFF)
9094
set(CUDA_SEPARABLE_COMPILATION ON)
91-
list(APPEND CUDA_NVCC_FLAGS -I${devicertl_base_directory})
95+
list(APPEND CUDA_NVCC_FLAGS -I${devicertl_base_directory}
96+
-I${devicertl_nvptx_directory}/src)
9297
cuda_add_library(omptarget-nvptx STATIC ${cuda_src_files} ${omp_data_objects}
9398
OPTIONS ${CUDA_ARCH} ${CUDA_DEBUG})
9499

@@ -123,7 +128,9 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
123128

124129
# Set flags for LLVM Bitcode compilation.
125130
set(bc_flags ${LIBOMPTARGET_NVPTX_SELECTED_CUDA_COMPILER_FLAGS}
126-
-I${devicertl_base_directory})
131+
-I${devicertl_base_directory}
132+
-I${devicertl_nvptx_directory}/src)
133+
127134
if(${LIBOMPTARGET_NVPTX_DEBUG})
128135
set(bc_flags ${bc_flags} -DOMPTARGET_NVPTX_DEBUG=-1)
129136
else()

openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
// local includes
2323
#include "target_impl.h"
24-
#include "debug.h" // debug
24+
#include "common/debug.h" // debug
2525
#include "interface.h" // interfaces with omp, compiler, and user
26-
#include "state-queue.h"
26+
#include "common/state-queue.h"
2727
#include "support.h"
2828

2929
#define OMPTARGET_NVPTX_VERSION 1.1

openmp/libomptarget/deviceRTLs/nvptx/src/support.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "support.h"
14-
#include "debug.h"
14+
#include "common/debug.h"
1515
#include "omptarget-nvptx.h"
1616

1717
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)