diff options
author | Joseph Huber <35342157+jhuber6@users.noreply.github.com> | 2023-10-04 14:14:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 14:14:13 -0500 |
commit | 2d4d8c8f97ceec2fb7f9e8376b0a304aad0790e6 (patch) | |
tree | 247e6b08b69e96880734b847a4fbd5e9cb9c9639 | |
parent | 49d8a559d35b5b144d61c8d96b0538db7f719de4 (diff) | |
download | llvm-2d4d8c8f97ceec2fb7f9e8376b0a304aad0790e6.zip llvm-2d4d8c8f97ceec2fb7f9e8376b0a304aad0790e6.tar.gz llvm-2d4d8c8f97ceec2fb7f9e8376b0a304aad0790e6.tar.bz2 |
[Libomptarget] Make the DeviceRTL configuration globals weak (#68220)
This patch applies weak linkage to the config globals by the name
`__omp_rtl...`. This is because when passing `-nogpulib` we will not
link in or create these globals. This allows the OpenMP device RTL to be
self contained without requiring the additional definitions from the
`clang` compiler. In the standard case, this should not affect the
current behavior, this is because the strong definition coming from the
compiler should always override the weak definition we default to here.
In the case that these are not defined by the compiler, these will
remain weak. This will impact optimizations somewhat, but the previous
behavior was that it would not link so that is an improvement.
Depends on: https://github.com/llvm/llvm-project/pull/68215
-rw-r--r-- | openmp/libomptarget/DeviceRTL/src/Configuration.cpp | 8 | ||||
-rw-r--r-- | openmp/libomptarget/DeviceRTL/src/exports | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/openmp/libomptarget/DeviceRTL/src/Configuration.cpp b/openmp/libomptarget/DeviceRTL/src/Configuration.cpp index 5deee9c..809c5f0 100644 --- a/openmp/libomptarget/DeviceRTL/src/Configuration.cpp +++ b/openmp/libomptarget/DeviceRTL/src/Configuration.cpp @@ -20,10 +20,10 @@ using namespace ompx; #pragma omp begin declare target device_type(nohost) -// defined by CGOpenMPRuntimeGPU -extern uint32_t __omp_rtl_debug_kind; -extern uint32_t __omp_rtl_assume_no_thread_state; -extern uint32_t __omp_rtl_assume_no_nested_parallelism; +// Weak definitions will be overridden by CGOpenmpRuntimeGPU if enabled. +[[gnu::weak]] extern const uint32_t __omp_rtl_debug_kind = 0; +[[gnu::weak]] extern const uint32_t __omp_rtl_assume_no_thread_state = 0; +[[gnu::weak]] extern const uint32_t __omp_rtl_assume_no_nested_parallelism = 0; // This variable should be visibile to the plugin so we override the default // hidden visibility. diff --git a/openmp/libomptarget/DeviceRTL/src/exports b/openmp/libomptarget/DeviceRTL/src/exports index 2d13195..fbcda3c 100644 --- a/openmp/libomptarget/DeviceRTL/src/exports +++ b/openmp/libomptarget/DeviceRTL/src/exports @@ -3,6 +3,10 @@ ompx_* *llvm_* __kmpc_* +__omp_rtl_debug_kind +__omp_rtl_assume_no_thread_state +__omp_rtl_assume_no_nested_parallelism + _ZN4ompx* IsSPMDMode |