diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h b/openmp/libomptarget/deviceRTLs/common/debug.h rename from openmp/libomptarget/deviceRTLs/nvptx/src/debug.h rename to openmp/libomptarget/deviceRTLs/common/debug.h --- a/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h +++ b/openmp/libomptarget/deviceRTLs/common/debug.h @@ -1,4 +1,4 @@ -//===------------- debug.h - NVPTX OpenMP debug macros ----------- CUDA -*-===// +//===------------- debug.h - OpenMP debug macros ----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu b/openmp/libomptarget/deviceRTLs/common/src/cancel.cpp rename from openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu rename to openmp/libomptarget/deviceRTLs/common/src/cancel.cpp --- a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/cancel.cpp @@ -1,4 +1,4 @@ -//===------ cancel.cu - NVPTX OpenMP cancel interface ------------ CUDA -*-===// +//===------ cancel.cpp - OpenMP cancel interface --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "interface.h" -#include "debug.h" +#include "common/debug.h" EXTERN int32_t __kmpc_cancellationpoint(kmp_Ident *loc, int32_t global_tid, int32_t cancelVal) { diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu b/openmp/libomptarget/deviceRTLs/common/src/critical.cpp rename from openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu rename to openmp/libomptarget/deviceRTLs/common/src/critical.cpp --- a/openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/critical.cpp @@ -1,4 +1,4 @@ -//===------ critical.cu - NVPTX OpenMP critical ------------------ CUDA -*-===// +//===------ critical.cpp - OpenMP critical --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "interface.h" -#include "debug.h" +#include "common/debug.h" EXTERN void __kmpc_critical(kmp_Ident *loc, int32_t global_tid, diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu b/openmp/libomptarget/deviceRTLs/common/src/loop.cpp rename from openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu rename to openmp/libomptarget/deviceRTLs/common/src/loop.cpp --- a/openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/loop.cpp @@ -1,4 +1,4 @@ -//===------------ loop.cu - NVPTX OpenMP loop constructs --------- CUDA -*-===// +//===------------ loop.cpp - OpenMP loop constructs -----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/task.cu b/openmp/libomptarget/deviceRTLs/common/src/task.cpp rename from openmp/libomptarget/deviceRTLs/nvptx/src/task.cu rename to openmp/libomptarget/deviceRTLs/common/src/task.cpp --- a/openmp/libomptarget/deviceRTLs/nvptx/src/task.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/task.cpp @@ -1,4 +1,4 @@ -//===------------- task.h - NVPTX OpenMP tasks support ----------- CUDA -*-===// +//===------------- task.cpp - OpenMP tasks support ------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/state-queue.h b/openmp/libomptarget/deviceRTLs/common/state-queue.h rename from openmp/libomptarget/deviceRTLs/nvptx/src/state-queue.h rename to openmp/libomptarget/deviceRTLs/common/state-queue.h --- a/openmp/libomptarget/deviceRTLs/nvptx/src/state-queue.h +++ b/openmp/libomptarget/deviceRTLs/common/state-queue.h @@ -1,4 +1,4 @@ -//===--------- statequeue.h - NVPTX OpenMP GPU State Queue ------- CUDA -*-===// +//===--------- state-queue.h - OpenMP GPU State Queue -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/state-queuei.h b/openmp/libomptarget/deviceRTLs/common/state-queuei.h rename from openmp/libomptarget/deviceRTLs/nvptx/src/state-queuei.h rename to openmp/libomptarget/deviceRTLs/common/state-queuei.h --- a/openmp/libomptarget/deviceRTLs/nvptx/src/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 ------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt --- a/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt +++ b/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt @@ -38,6 +38,8 @@ get_filename_component(devicertl_base_directory ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) +set(devicertl_nvptx_directory + ${devicertl_base_directory}/nvptx) if(LIBOMPTARGET_DEP_CUDA_FOUND) libomptarget_say("Building CUDA offloading device RTL.") @@ -47,17 +49,17 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF) set(cuda_src_files - src/cancel.cu - src/critical.cu + ${devicertl_nvptx_directory}/cancel.cu + ${devicertl_nvptx_directory}/critical.cu src/data_sharing.cu src/libcall.cu - src/loop.cu + ${devicertl_nvptx_directory}/loop.cu src/omptarget-nvptx.cu src/parallel.cu src/reduction.cu src/support.cu src/sync.cu - src/task.cu + ${devicertl_nvptx_directory}/task.cu ) set(omp_data_objects src/omp_data.cu) @@ -88,7 +90,8 @@ # yet supported by the CUDA toolchain on the device. set(BUILD_SHARED_LIBS OFF) set(CUDA_SEPARABLE_COMPILATION ON) - list(APPEND CUDA_NVCC_FLAGS -I${devicertl_base_directory}) + list(APPEND CUDA_NVCC_FLAGS -I${devicertl_base_directory} + -I${devicertl_nvptx_directory}/src) cuda_add_library(omptarget-nvptx STATIC ${cuda_src_files} ${omp_data_objects} OPTIONS ${CUDA_ARCH} ${CUDA_DEBUG}) @@ -123,7 +126,9 @@ # Set flags for LLVM Bitcode compilation. set(bc_flags ${LIBOMPTARGET_NVPTX_SELECTED_CUDA_COMPILER_FLAGS} - -I${devicertl_base_directory}) + -I${devicertl_base_directory} + -I${devicertl_nvptx_directory}/src) + if(${LIBOMPTARGET_NVPTX_DEBUG}) set(bc_flags ${bc_flags} -DOMPTARGET_NVPTX_DEBUG=-1) else() diff --git a/openmp/libomptarget/deviceRTLs/nvptx/cancel.cu b/openmp/libomptarget/deviceRTLs/nvptx/cancel.cu new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/deviceRTLs/nvptx/cancel.cu @@ -0,0 +1 @@ +#include "common/src/cancel.cpp" diff --git a/openmp/libomptarget/deviceRTLs/nvptx/critical.cu b/openmp/libomptarget/deviceRTLs/nvptx/critical.cu new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/deviceRTLs/nvptx/critical.cu @@ -0,0 +1 @@ +#include "common/src/critical.cpp" diff --git a/openmp/libomptarget/deviceRTLs/nvptx/loop.cu b/openmp/libomptarget/deviceRTLs/nvptx/loop.cu new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/deviceRTLs/nvptx/loop.cu @@ -0,0 +1 @@ +#include "common/src/loop.cpp" diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h b/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h --- a/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h +++ b/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h @@ -21,9 +21,9 @@ // local includes #include "target_impl.h" -#include "debug.h" // debug +#include "common/debug.h" // debug #include "interface.h" // interfaces with omp, compiler, and user -#include "state-queue.h" +#include "common/state-queue.h" #include "support.h" #define OMPTARGET_NVPTX_VERSION 1.1 diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/support.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/support.cu --- a/openmp/libomptarget/deviceRTLs/nvptx/src/support.cu +++ b/openmp/libomptarget/deviceRTLs/nvptx/src/support.cu @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "support.h" -#include "debug.h" +#include "common/debug.h" #include "omptarget-nvptx.h" //////////////////////////////////////////////////////////////////////////////// diff --git a/openmp/libomptarget/deviceRTLs/nvptx/task.cu b/openmp/libomptarget/deviceRTLs/nvptx/task.cu new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/deviceRTLs/nvptx/task.cu @@ -0,0 +1 @@ +#include "common/src/task.cpp"