[Openmp-commits] [openmp] 174967f - [nfc][libomptarget] Decrease coupling between files
Jon Chesterfield via Openmp-commits
openmp-commits at lists.llvm.org
Sun Oct 27 07:28:10 PDT 2019
Author: Jon Chesterfield
Date: 2019-10-27T14:27:54Z
New Revision: 174967f15369fafb0c0bfc13d35963f7890b2c8b
URL: https://github.com/llvm/llvm-project/commit/174967f15369fafb0c0bfc13d35963f7890b2c8b
DIFF: https://github.com/llvm/llvm-project/commit/174967f15369fafb0c0bfc13d35963f7890b2c8b.diff
LOG: [nfc][libomptarget] Decrease coupling between files
Summary:
[nfc][libomptarget] Decrease coupling between files
debug.h used the symbol omptarget_device_environment so implicitly required
an include of omptarget-nvptx.h to compile. Similarly interface.h uses size_t.
Moving this declaration to a new header means cancel, critical can now build
without omptarget-nvptx.h. After this change, debug.h, cancel.cu, critical.cu
could move under a common source directory.
Reviewers: ABataev, jdoerfert, grokos
Subscribers: openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D69473
Added:
openmp/libomptarget/deviceRTLs/nvptx/src/device_environment.h
Modified:
openmp/libomptarget/deviceRTLs/interface.h
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/omp_data.cu
openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
Removed:
################################################################################
diff --git a/openmp/libomptarget/deviceRTLs/interface.h b/openmp/libomptarget/deviceRTLs/interface.h
index 0f0f43ebb19f..d0b2d1763fd3 100644
--- a/openmp/libomptarget/deviceRTLs/interface.h
+++ b/openmp/libomptarget/deviceRTLs/interface.h
@@ -16,6 +16,7 @@
#ifndef _INTERFACES_H_
#define _INTERFACES_H_
+#include <stddef.h>
#include <stdint.h>
#ifdef __CUDACC__
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu
index bffe1b7e32be..99dea1fadcbd 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/cancel.cu
@@ -10,7 +10,8 @@
//
//===----------------------------------------------------------------------===//
-#include "omptarget-nvptx.h"
+#include "interface.h"
+#include "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/nvptx/src/critical.cu
index 2eb94f5cb6fb..d8cfb47b8766 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/critical.cu
@@ -10,9 +10,8 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-#include "omptarget-nvptx.h"
+#include "interface.h"
+#include "debug.h"
EXTERN
void __kmpc_critical(kmp_Ident *loc, int32_t global_tid,
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h b/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
index a2f1d37fdad2..1052392155a7 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
@@ -28,6 +28,8 @@
#ifndef _OMPTARGET_NVPTX_DEBUG_H_
#define _OMPTARGET_NVPTX_DEBUG_H_
+#include "device_environment.h"
+
////////////////////////////////////////////////////////////////////////////////
// set desired level of debugging
////////////////////////////////////////////////////////////////////////////////
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/device_environment.h b/openmp/libomptarget/deviceRTLs/nvptx/src/device_environment.h
new file mode 100644
index 000000000000..b2f65af354a6
--- /dev/null
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/device_environment.h
@@ -0,0 +1,24 @@
+//===---- device_environment.h - OpenMP GPU device environment --- CUDA -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Global device environment
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _OMPTARGET_DEVICE_ENVIRONMENT_H_
+#define _OMPTARGET_DEVICE_ENVIRONMENT_H_
+
+#include "target_impl.h"
+
+struct omptarget_device_environmentTy {
+ int32_t debug_level;
+};
+
+extern __device__ omptarget_device_environmentTy omptarget_device_environment;
+
+#endif
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/omp_data.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/omp_data.cu
index d369da1cb7e7..181bceb3e175 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/omp_data.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/omp_data.cu
@@ -11,9 +11,10 @@
//===----------------------------------------------------------------------===//
#include "omptarget-nvptx.h"
+#include "device_environment.h"
////////////////////////////////////////////////////////////////////////////////
-// global device envrionment
+// global device environment
////////////////////////////////////////////////////////////////////////////////
__device__ omptarget_device_environmentTy omptarget_device_environment;
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h b/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
index 5006aa4a6cce..986150402f16 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
@@ -324,11 +324,6 @@ class omptarget_nvptx_ThreadPrivateContext {
uint64_t cnt;
};
-/// Device envrionment data
-struct omptarget_device_environmentTy {
- int32_t debug_level;
-};
-
/// Memory manager for statically allocated memory.
class omptarget_nvptx_SimpleMemoryManager {
private:
@@ -345,12 +340,6 @@ class omptarget_nvptx_SimpleMemoryManager {
INLINE const void *Acquire(const void *buf, size_t size);
};
-////////////////////////////////////////////////////////////////////////////////
-// global device envrionment
-////////////////////////////////////////////////////////////////////////////////
-
-extern __device__ omptarget_device_environmentTy omptarget_device_environment;
-
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
More information about the Openmp-commits
mailing list