Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenMP][NFC] Move Utils.h and Debug.h into a "Shared" include folder #73701

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

jdoerfert
Copy link
Member

Headers used throughout the different runtimes are different from the internal headers. This is a first step to bring structure in into the include folder.

Headers used throughout the different runtimes are different from the
internal headers. This is a first step to bring structure in into the
include folder.
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 28, 2023

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-openmp

Author: Johannes Doerfert (jdoerfert)

Changes

Headers used throughout the different runtimes are different from the internal headers. This is a first step to bring structure in into the include folder.


Full diff: https://github.com/llvm/llvm-project/pull/73701.diff

24 Files Affected:

  • (modified) openmp/libomptarget/include/OmptConnector.h (+2-2)
  • (renamed) openmp/libomptarget/include/Shared/Debug.h (+5-4)
  • (renamed) openmp/libomptarget/include/Shared/Utils.h (+4-4)
  • (modified) openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp (+3-2)
  • (modified) openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h (+3-2)
  • (modified) openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h (+3-2)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp (+3-2)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h (+1-1)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h (+2-2)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp (+3-1)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h (+3-2)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/RPC.cpp (+3-1)
  • (modified) openmp/libomptarget/plugins-nextgen/common/PluginInterface/Utils/ELF.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp (+2-1)
  • (modified) openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp (+2-1)
  • (modified) openmp/libomptarget/src/OmptCallback.cpp (+2-1)
  • (modified) openmp/libomptarget/src/device.cpp (+1-1)
  • (modified) openmp/libomptarget/src/interface.cpp (+1-1)
  • (modified) openmp/libomptarget/src/private.h (+4-3)
  • (modified) openmp/libomptarget/src/rtl.cpp (+1-1)
diff --git a/openmp/libomptarget/include/OmptConnector.h b/openmp/libomptarget/include/OmptConnector.h
index 75473b8dda486f1..3f48cabfba55441 100644
--- a/openmp/libomptarget/include/OmptConnector.h
+++ b/openmp/libomptarget/include/OmptConnector.h
@@ -23,10 +23,10 @@
 #include <string>
 
 #include "omp-tools.h"
-
-#include "Debug.h"
 #include "omptarget.h"
 
+#include "Shared/Debug.h"
+
 #pragma push_macro("DEBUG_PREFIX")
 #undef DEBUG_PREFIX
 #define DEBUG_PREFIX "OMPT"
diff --git a/openmp/libomptarget/include/Debug.h b/openmp/libomptarget/include/Shared/Debug.h
similarity index 97%
rename from openmp/libomptarget/include/Debug.h
rename to openmp/libomptarget/include/Shared/Debug.h
index 17aa8746afe7ce3..9f8818429c77949 100644
--- a/openmp/libomptarget/include/Debug.h
+++ b/openmp/libomptarget/include/Shared/Debug.h
@@ -1,4 +1,4 @@
-//===------- Debug.h - Target independent OpenMP target RTL -- C++ --------===//
+//===-- Shared/Debug.h - Target independent OpenMP target RTL -- C++ ------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -34,8 +34,9 @@
 //   (uintptr_t) ptr);
 //
 //===----------------------------------------------------------------------===//
-#ifndef _OMPTARGET_DEBUG_H
-#define _OMPTARGET_DEBUG_H
+
+#ifndef OMPTARGET_SHARED_DEBUG_H
+#define OMPTARGET_SHARED_DEBUG_H
 
 #include <atomic>
 #include <mutex>
@@ -185,4 +186,4 @@ inline uint32_t getDebugLevel() {
     }                                                                          \
   } while (false)
 
-#endif // _OMPTARGET_DEBUG_H
+#endif // OMPTARGET_SHARED_DEBUG_H
diff --git a/openmp/libomptarget/include/Utilities.h b/openmp/libomptarget/include/Shared/Utils.h
similarity index 97%
rename from openmp/libomptarget/include/Utilities.h
rename to openmp/libomptarget/include/Shared/Utils.h
index 84d38d05911f712..b6bb97ce59496cc 100644
--- a/openmp/libomptarget/include/Utilities.h
+++ b/openmp/libomptarget/include/Shared/Utils.h
@@ -1,4 +1,4 @@
-//===------- Utilities.h - Target independent OpenMP target RTL -- C++ ----===//
+//===-- Shared/Utils.h - Target independent OpenMP target RTL -- C++ ------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef OPENMP_LIBOMPTARGET_INCLUDE_UTILITIES_H
-#define OPENMP_LIBOMPTARGET_INCLUDE_UTILITIES_H
+#ifndef OMPTARGET_SHARED_UTILS_H
+#define OMPTARGET_SHARED_UTILS_H
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
@@ -262,4 +262,4 @@ template <typename Ty> inline Ty roundUp(Ty V, Ty Boundary) {
 } // namespace omp
 } // namespace llvm
 
-#endif // OPENMP_LIBOMPTARGET_INCLUDE_UTILITIES_H
+#endif // OMPTARGET_SHARED_UTILS_H
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp
index 8f73a03cfeebba2..faeb4ea77d6d4b7 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp
@@ -13,7 +13,8 @@
 
 #include "llvm/Support/DynamicLibrary.h"
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "dlwrap.h"
 #include "hsa.h"
 #include "hsa_ext_amd.h"
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 208cce90d8e9277..da3d28129fca6a2 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -20,12 +20,13 @@
 #include <unistd.h>
 #include <unordered_map>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+#include "Shared/Utils.h"
+
 #include "Environment.h"
 #include "GlobalHandler.h"
 #include "OmptCallback.h"
 #include "PluginInterface.h"
-#include "Utilities.h"
 #include "UtilitiesRTL.h"
 #include "omptarget.h"
 
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
index b39545ab7d02ba2..289dbf8e3d09d18 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
@@ -12,7 +12,8 @@
 
 #include <cstdint>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "omptarget.h"
 
 #include "llvm/ADT/StringMap.h"
@@ -23,8 +24,8 @@
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/BinaryFormat/MsgPackDocument.h"
 #include "llvm/Support/MemoryBufferRef.h"
-
 #include "llvm/Support/YAMLTraits.h"
+
 using namespace llvm::ELF;
 
 namespace llvm {
diff --git a/openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp b/openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp
index 7d719156c49b864..b778b7287c7bc56 100644
--- a/openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp
@@ -18,7 +18,8 @@
 #include <cstring>
 #include <memory>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "OmptCallback.h"
 #include "OmptConnector.h"
 
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
index 9cb1da371fa9ac4..6cb9a366f8b2c02 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
@@ -12,9 +12,10 @@
 
 #include "GlobalHandler.h"
 #include "PluginInterface.h"
-#include "Utilities.h"
 #include "Utils/ELF.h"
 
+#include "Shared/Utils.h"
+
 #include <cstring>
 
 using namespace llvm;
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h
index c92e0d549c1bd36..aff10b1d504fc71 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h
@@ -18,8 +18,9 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Object/ELFObjectFile.h"
 
-#include "Debug.h"
-#include "Utilities.h"
+#include "Shared/Debug.h"
+#include "Shared/Utils.h"
+
 #include "omptarget.h"
 
 namespace llvm {
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
index 3def95ee4920508..188fb6dac84b9cd 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
@@ -9,10 +9,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "JIT.h"
-#include "Debug.h"
+
+#include "Shared/Debug.h"
+#include "Shared/Utils.h"
 
 #include "PluginInterface.h"
-#include "Utilities.h"
 #include "omptarget.h"
 
 #include "llvm/ADT/SmallVector.h"
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h
index 100c279e863df0e..1a5e56b2ea732a6 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h
@@ -11,7 +11,7 @@
 #ifndef OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_COMMON_JIT_H
 #define OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_COMMON_JIT_H
 
-#include "Utilities.h"
+#include "Shared/Utils.h"
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h
index 2d23d959f6c0ba0..95491b4be6fa6f0 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h
@@ -21,8 +21,8 @@
 #include <unordered_map>
 #include <vector>
 
-#include "Debug.h"
-#include "Utilities.h"
+#include "Shared/Debug.h"
+#include "Shared/Utils.h"
 #include "omptarget.h"
 
 /// Base class of per-device allocator.
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
index 2ee79d3131ff3df..277aab1c2f35fe2 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
@@ -9,7 +9,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "PluginInterface.h"
-#include "Debug.h"
+
+#include "Shared/Debug.h"
+
 #include "Environment.h"
 #include "GlobalHandler.h"
 #include "JIT.h"
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
index 0093bef571f93c1..23e2e1efbad805e 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
@@ -19,13 +19,14 @@
 #include <shared_mutex>
 #include <vector>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+#include "Shared/Utils.h"
+
 #include "Environment.h"
 #include "GlobalHandler.h"
 #include "JIT.h"
 #include "MemoryManager.h"
 #include "RPC.h"
-#include "Utilities.h"
 #include "omptarget.h"
 
 #ifdef OMPT_SUPPORT
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/RPC.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/RPC.cpp
index 72bba012fcf93c6..a40bf147b224842 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/RPC.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/RPC.cpp
@@ -7,7 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "RPC.h"
-#include "Debug.h"
+
+#include "Shared/Debug.h"
+
 #include "PluginInterface.h"
 
 // This header file may be present in-tree or from an LLVM installation. The
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/Utils/ELF.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/Utils/ELF.cpp
index e0c46e4a288e926..7089e26754aa521 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/Utils/ELF.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/Utils/ELF.cpp
@@ -11,7 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "ELF.h"
-#include "Debug.h"
+
+#include "Shared/Debug.h"
 
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Object/Binary.h"
diff --git a/openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp b/openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp
index 3d0de0d5b2caff6..f99dc780c38e443 100644
--- a/openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp
+++ b/openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp
@@ -13,7 +13,8 @@
 
 #include "llvm/Support/DynamicLibrary.h"
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "cuda.h"
 #include "dlwrap.h"
 
diff --git a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
index d1473c94af8a630..fc2ef54919ee6e0 100644
--- a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
@@ -16,7 +16,8 @@
 #include <string>
 #include <unordered_map>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "Environment.h"
 #include "GlobalHandler.h"
 #include "OmptCallback.h"
diff --git a/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
index 85cf9bef1543b2a..ce5f2f07361f002 100644
--- a/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
@@ -16,7 +16,8 @@
 #include <string>
 #include <unordered_map>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "Environment.h"
 #include "GlobalHandler.h"
 #include "OmptCallback.h"
diff --git a/openmp/libomptarget/src/OmptCallback.cpp b/openmp/libomptarget/src/OmptCallback.cpp
index 4882a762adbf653..983939090df2e7e 100644
--- a/openmp/libomptarget/src/OmptCallback.cpp
+++ b/openmp/libomptarget/src/OmptCallback.cpp
@@ -18,7 +18,8 @@
 #include <cstring>
 #include <memory>
 
-#include "Debug.h"
+#include "Shared/Debug.h"
+
 #include "OmptCallback.h"
 #include "OmptConnector.h"
 #include "OmptInterface.h"
diff --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp
index 11465d0b2cc3cf3..87ee48082521712 100644
--- a/openmp/libomptarget/src/device.cpp
+++ b/openmp/libomptarget/src/device.cpp
@@ -17,7 +17,7 @@
 #include "private.h"
 #include "rtl.h"
 
-#include "Utilities.h"
+#include "Shared/Utils.h"
 
 #include <cassert>
 #include <climits>
diff --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp
index 79f38ed1a43437f..4735469b55aa055 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -18,7 +18,7 @@
 #include "private.h"
 #include "rtl.h"
 
-#include "Utilities.h"
+#include "Shared/Utils.h"
 
 #include <cassert>
 #include <cstdint>
diff --git a/openmp/libomptarget/src/private.h b/openmp/libomptarget/src/private.h
index 3eb500cbd4c97f2..87ffe2d43dd75c1 100644
--- a/openmp/libomptarget/src/private.h
+++ b/openmp/libomptarget/src/private.h
@@ -13,10 +13,11 @@
 #ifndef _OMPTARGET_PRIVATE_H
 #define _OMPTARGET_PRIVATE_H
 
+#include "Shared/Debug.h"
+
+#include "SourceInfo.h"
 #include "device.h"
-#include <Debug.h>
-#include <SourceInfo.h>
-#include <omptarget.h>
+#include "omptarget.h"
 
 #include <cstdint>
 
diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp
index 78076dd2c6db13d..86509cd69c5614f 100644
--- a/openmp/libomptarget/src/rtl.cpp
+++ b/openmp/libomptarget/src/rtl.cpp
@@ -17,7 +17,7 @@
 #include "private.h"
 #include "rtl.h"
 
-#include "Utilities.h"
+#include "Shared/Utils.h"
 
 #include <cassert>
 #include <cstdlib>

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate the debug header and its error macros, but for the time being this is fine. Long term I want to replace most all of this.

@jdoerfert jdoerfert merged commit 8327f4a into llvm:main Nov 28, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants