[Openmp-commits] [PATCH] D142008: [libomptarget] Delay recursive shared library registrations until offload RTLs are loaded
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jan 20 11:33:40 PST 2023
JonChesterfield added a comment.
Spent way too long thinking about this and ended up reading the glibc source.
I don't think we want reference counting, more locks or delayed registration. I think we want to move the plugin initialisation to the end of the libomptarget constructor and delete the once_flag guarding it.
The amdgpu plugin will load HSA which will load libomptarget. So our global ctor needs to be reentrant, that's why reference counting it looks like a fix. But we don't need a reference count, just a nop on the second call, and it doesn't need a lock because we're already holding one via glibc.
Then constructors in user code happen sometime after libomptarget is constructed and will be fine.
I haven't implemented this, just thought it through. Joseph is testing the idea now I think.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142008/new/
https://reviews.llvm.org/D142008
More information about the Openmp-commits
mailing list