summaryrefslogtreecommitdiff
path: root/offload/DeviceRTL/src
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2025-04-21 15:21:47 -0500
committerGitHub <noreply@github.com>2025-04-21 15:21:47 -0500
commit56bf0e720288ae6ba6e8635c7ec12f1e7d6f783b (patch)
tree39affcec4dc728ceb21d2d884e16007fec58792a /offload/DeviceRTL/src
parentc1049e42a1beab9b240cec80418b3ce32c9da03e (diff)
[OpenMP] Remove dependency on LLVM include directory from DeviceRTL (#136359)
Summary: Currently we depend on a single LLVM include directory. This is actually only required to define one enum, which is highly unlikely to change. THis patch makes the `Environment.h` include directory more hermetic so we no long depend on other libraries. In exchange, we get a simpler dependency list for the price of hard-coding `1` somewhere. I think it's a valid trade considering that this flag is highly unlikely to change at this point. @ronlieb AMD version https://gist.github.com/jhuber6/3313e6f957be14dc79fe85e5126d2cb3
Diffstat (limited to 'offload/DeviceRTL/src')
-rw-r--r--offload/DeviceRTL/src/Kernel.cpp14
-rw-r--r--offload/DeviceRTL/src/Mapping.cpp2
2 files changed, 10 insertions, 6 deletions
diff --git a/offload/DeviceRTL/src/Kernel.cpp b/offload/DeviceRTL/src/Kernel.cpp
index 9bb89573dc0c..eac68a15538c 100644
--- a/offload/DeviceRTL/src/Kernel.cpp
+++ b/offload/DeviceRTL/src/Kernel.cpp
@@ -21,10 +21,17 @@
#include "Synchronization.h"
#include "Workshare.h"
-#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"
-
using namespace ompx;
+// These flags are copied from "llvm/Frontend/OpenMP/OMPDeviceConstants.h" and
+// must be kept in-sync.
+enum OMPTgtExecModeFlags : unsigned char {
+ OMP_TGT_EXEC_MODE_GENERIC = 1 << 0,
+ OMP_TGT_EXEC_MODE_SPMD = 1 << 1,
+ OMP_TGT_EXEC_MODE_GENERIC_SPMD =
+ OMP_TGT_EXEC_MODE_GENERIC | OMP_TGT_EXEC_MODE_SPMD
+};
+
static void
inititializeRuntime(bool IsSPMD, KernelEnvironmentTy &KernelEnvironment,
KernelLaunchEnvironmentTy &KernelLaunchEnvironment) {
@@ -74,8 +81,7 @@ extern "C" {
int32_t __kmpc_target_init(KernelEnvironmentTy &KernelEnvironment,
KernelLaunchEnvironmentTy &KernelLaunchEnvironment) {
ConfigurationEnvironmentTy &Configuration = KernelEnvironment.Configuration;
- bool IsSPMD = Configuration.ExecMode &
- llvm::omp::OMPTgtExecModeFlags::OMP_TGT_EXEC_MODE_SPMD;
+ bool IsSPMD = Configuration.ExecMode & OMP_TGT_EXEC_MODE_SPMD;
bool UseGenericStateMachine = Configuration.UseGenericStateMachine;
if (IsSPMD) {
inititializeRuntime(/*IsSPMD=*/true, KernelEnvironment,
diff --git a/offload/DeviceRTL/src/Mapping.cpp b/offload/DeviceRTL/src/Mapping.cpp
index e951556c2ad4..b145892d1ece 100644
--- a/offload/DeviceRTL/src/Mapping.cpp
+++ b/offload/DeviceRTL/src/Mapping.cpp
@@ -16,8 +16,6 @@
#include "State.h"
#include "gpuintrin.h"
-#include "llvm/Frontend/OpenMP/OMPGridValues.h"
-
using namespace ompx;
// FIXME: This resolves the handling for the AMDGPU workgroup size when the ABI