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 diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu b/openmp/libomptarget/deviceRTLs/common/src/cancel.cu rename from openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu rename to openmp/libomptarget/deviceRTLs/common/src/cancel.cu --- a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/cancel.cu @@ -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.cu rename from openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu rename to openmp/libomptarget/deviceRTLs/common/src/critical.cu --- a/openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/critical.cu @@ -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.cu rename from openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu rename to openmp/libomptarget/deviceRTLs/common/src/loop.cu diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/task.cu b/openmp/libomptarget/deviceRTLs/common/src/task.cu rename from openmp/libomptarget/deviceRTLs/nvptx/src/task.cu rename to openmp/libomptarget/deviceRTLs/common/src/task.cu 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 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 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,10 @@ get_filename_component(devicertl_base_directory ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) +set(devicertl_common_directory + ${devicertl_base_directory}/common) +set(devicertl_nvptx_directory + ${devicertl_base_directory}/nvptx) if(LIBOMPTARGET_DEP_CUDA_FOUND) libomptarget_say("Building CUDA offloading device RTL.") @@ -47,17 +51,17 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF) set(cuda_src_files - src/cancel.cu - src/critical.cu + ${devicertl_common_directory}/src/cancel.cu + ${devicertl_common_directory}/src/critical.cu src/data_sharing.cu src/libcall.cu - src/loop.cu + ${devicertl_common_directory}/src/loop.cu src/omptarget-nvptx.cu src/parallel.cu src/reduction.cu src/support.cu src/sync.cu - src/task.cu + ${devicertl_common_directory}/src/task.cu ) set(omp_data_objects src/omp_data.cu) @@ -88,7 +92,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 +128,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/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" ////////////////////////////////////////////////////////////////////////////////