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

[Libomptarget] Make the DeviceRTL configuration globals weak #68220

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions openmp/libomptarget/DeviceRTL/src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The variable names look sufficient for documentation. It's a bit oblique to have the compiler inject values for these but the behaviour is pretty obvious.

The defaults look legitimate. It's only an optimisation barrier if nothing specifies the value, the compiler or whatever defining a symbol with 0 or 1 will override this. And that path only exists when people are doing debugging things.

Hopefully the compiler tags them static. Shall we go with explicit protected visibility? We never want them to show up in the code object symbol table, whether default or not, as a language runtime deciding to write to them is bad.

[[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.
Expand Down
4 changes: 4 additions & 0 deletions openmp/libomptarget/DeviceRTL/src/exports
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down