[Openmp-commits] [openmp] 5a4a05d - [libomptarget][nfc] Move some source into common from nvptx
Jon Chesterfield via Openmp-commits
openmp-commits at lists.llvm.org
Mon Nov 18 10:17:51 PST 2019
Author: Jon Chesterfield
Date: 2019-11-18T18:17:36Z
New Revision: 5a4a05d776d3adacad344b2b5e15cf594c906bce
URL: https://github.com/llvm/llvm-project/commit/5a4a05d776d3adacad344b2b5e15cf594c906bce
DIFF: https://github.com/llvm/llvm-project/commit/5a4a05d776d3adacad344b2b5e15cf594c906bce.diff
LOG: [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
Added:
openmp/libomptarget/deviceRTLs/common/debug.h
openmp/libomptarget/deviceRTLs/common/src/cancel.cu
openmp/libomptarget/deviceRTLs/common/src/critical.cu
openmp/libomptarget/deviceRTLs/common/src/loop.cu
openmp/libomptarget/deviceRTLs/common/src/task.cu
openmp/libomptarget/deviceRTLs/common/state-queue.h
openmp/libomptarget/deviceRTLs/common/state-queuei.h
Modified:
openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
openmp/libomptarget/deviceRTLs/nvptx/src/support.cu
Removed:
openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu
openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu
openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu
openmp/libomptarget/deviceRTLs/nvptx/src/state-queue.h
openmp/libomptarget/deviceRTLs/nvptx/src/state-queuei.h
openmp/libomptarget/deviceRTLs/nvptx/src/task.cu
################################################################################
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h b/openmp/libomptarget/deviceRTLs/common/debug.h
similarity index 100%
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
similarity index 97%
rename from openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu
rename to openmp/libomptarget/deviceRTLs/common/src/cancel.cu
index 99dea1fadcbd..9540f5647699 100644
--- 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
similarity index 97%
rename from openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu
rename to openmp/libomptarget/deviceRTLs/common/src/critical.cu
index d8cfb47b8766..ee4b056ddad9 100644
--- 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
similarity index 100%
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
similarity index 100%
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
similarity index 100%
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
similarity index 100%
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
index b3cd8ef46d27..c3b2db05c3a2 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
+++ b/openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
@@ -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()
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h b/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
index 6c98f0104efc..1a815ee4d240 100644
--- 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
index 7a022e1680ff..c8ac493459c1 100644
--- 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"
////////////////////////////////////////////////////////////////////////////////
More information about the Openmp-commits
mailing list