Skip to content

Commit 43c9c19

Browse files
committed
[OpenMP] Remove dependency on LLVM include directory from DeviceRTL
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.
1 parent 5eabece commit 43c9c19

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

offload/DeviceRTL/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ if(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
7575
list(APPEND clang_opt_flags -DOMPTARGET_HAS_LIBC)
7676
endif()
7777

78-
# Prepend -I to each list element
79-
set (LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL "${LIBOMPTARGET_LLVM_INCLUDE_DIRS}")
80-
list(TRANSFORM LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL PREPEND "-I")
81-
8278
# Set flags for LLVM Bitcode compilation.
8379
set(bc_flags -c -flto -std=c++17 -fvisibility=hidden
8480
${clang_opt_flags} -nogpulib -nostdlibinc
@@ -88,7 +84,6 @@ set(bc_flags -c -flto -std=c++17 -fvisibility=hidden
8884
-I${include_directory}
8985
-I${devicertl_base_directory}/../include
9086
-I${devicertl_base_directory}/../../libc
91-
${LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL}
9287
)
9388

9489
# first create an object target
@@ -172,7 +167,6 @@ function(compileDeviceRTLLibrary target_name target_triple)
172167
${include_directory}
173168
${devicertl_base_directory}/../../libc
174169
${devicertl_base_directory}/../include
175-
${LIBOMPTARGET_LLVM_INCLUDE_DIRS}
176170
)
177171
install(TARGETS ${ide_target_name} EXCLUDE_FROM_ALL)
178172
endif()

offload/DeviceRTL/src/Kernel.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "Synchronization.h"
2222
#include "Workshare.h"
2323

24-
#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"
25-
2624
using namespace ompx;
2725

2826
static void
@@ -74,8 +72,7 @@ extern "C" {
7472
int32_t __kmpc_target_init(KernelEnvironmentTy &KernelEnvironment,
7573
KernelLaunchEnvironmentTy &KernelLaunchEnvironment) {
7674
ConfigurationEnvironmentTy &Configuration = KernelEnvironment.Configuration;
77-
bool IsSPMD = Configuration.ExecMode &
78-
llvm::omp::OMPTgtExecModeFlags::OMP_TGT_EXEC_MODE_SPMD;
75+
bool IsSPMD = Configuration.ExecMode & /*OMP_TGT_EXEC_MODE_SPMD=*/1;
7976
bool UseGenericStateMachine = Configuration.UseGenericStateMachine;
8077
if (IsSPMD) {
8178
inititializeRuntime(/*IsSPMD=*/true, KernelEnvironment,

offload/DeviceRTL/src/Mapping.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "State.h"
1717
#include "gpuintrin.h"
1818

19-
#include "llvm/Frontend/OpenMP/OMPGridValues.h"
20-
2119
using namespace ompx;
2220

2321
// FIXME: This resolves the handling for the AMDGPU workgroup size when the ABI

offload/include/Shared/Environment.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,9 @@
1515

1616
#include <stdint.h>
1717

18-
#ifdef OMPTARGET_DEVICE_RUNTIME
19-
#include "DeviceTypes.h"
20-
#else
21-
#include "SourceInfo.h"
18+
struct IdentTy;
2219

23-
using IdentTy = ident_t;
24-
#endif
25-
26-
#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"
20+
using OMPTgtExecModeFlags = unsigned char;
2721

2822
enum class DeviceDebugKind : uint32_t {
2923
Assertion = 1U << 0,
@@ -80,7 +74,7 @@ struct DynamicEnvironmentTy {
8074
struct ConfigurationEnvironmentTy {
8175
uint8_t UseGenericStateMachine = 2;
8276
uint8_t MayUseNestedParallelism = 2;
83-
llvm::omp::OMPTgtExecModeFlags ExecMode = llvm::omp::OMP_TGT_EXEC_MODE_SPMD;
77+
OMPTgtExecModeFlags ExecMode;
8478
// Information about (legal) launch configurations.
8579
//{
8680
int32_t MinThreads = -1;

0 commit comments

Comments
 (0)