[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
This commit is contained in:
Jon Chesterfield 2019-11-18 18:16:35 +00:00
parent 17e37ba57a
commit 5a4a05d776
10 changed files with 18 additions and 11 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -38,6 +38,10 @@ endif()
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 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
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 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
# 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 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
# 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()

View File

@ -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

View File

@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "support.h"
#include "debug.h"
#include "common/debug.h"
#include "omptarget-nvptx.h"
////////////////////////////////////////////////////////////////////////////////