[Openmp-commits] [openmp] [Libomptarget] Make the DeviceRTL configuration globals weak (PR #68220)

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Wed Oct 4 12:04:29 PDT 2023


================
@@ -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.
----------------
JonChesterfield wrote:

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.

https://github.com/llvm/llvm-project/pull/68220


More information about the Openmp-commits mailing list