[Openmp-commits] [PATCH] D142008: [libomptarget] Delay recursive shared library registrations until offload RTLs are loaded

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 20 04:55:45 PST 2023

jhuber6 added a comment.

In D142008#4068271 <https://reviews.llvm.org/D142008#4068271>, @JonChesterfield wrote:

> @jhuber6 can you remember what stopped us from deleting the global ctor embedded in every user TU to set some flag? I think there was some backwards compatibility concern.

That was D131089 <https://reviews.llvm.org/D131089>, the intention was to get rid of the requires flag registration that happened every TU so it didn't modify the shared library opening. However, we probably could roll that into the `initLibomptarget` and `deinitLibomptarget` functions since we presumably only need to `dlopen` the plugins once. Then whenever this comes along and tries to call `__tgt_register_lib` we will already need that `libomptarget`'s refcount is already one and avoid doing initialization again. Think that would work?

The only concern was that it's a breaking change for old applications using `requires unified_shared_memory`, but I think it's acceptable now that we explicitly state that `libomptarget` is only compatible within a major release.



More information about the Openmp-commits mailing list