diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-03-27 14:09:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 14:09:37 -0500 |
commit | 421085fd740d937559db068c0a1b354b033aca63 (patch) | |
tree | 23e7f1ec71123127f30a60de7758acc0935e123c /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | dd06b8e679fd28f51cd065401062041a40b87f9c (diff) | |
download | llvm-421085fd740d937559db068c0a1b354b033aca63.zip llvm-421085fd740d937559db068c0a1b354b033aca63.tar.gz llvm-421085fd740d937559db068c0a1b354b033aca63.tar.bz2 |
[Offload] Change unregister library to use `atexit` instead of destructor (#86830)
Summary:
The 'new driver' sets up the lifetime of a registered liftime using
global constructors and destructors. Currently, this is put at priority
1 which isn't strictly conformant as it will conflict with system
utilities. We now use 101 as this is the loweest suggested for
non-system constructors and will still run before user constructors.
Secondly, there were issues with the CUDA runtime when destructed with a
global destructor. Because the global ones are in any order and
potentially run before other things we were hitting an edge case where
the OpenMP runtime was uninitialized *after* `_dl_fini` was called. This
would result in us erroring when we call into a destroyed `libcuda.so`
instance. using `atexit` is what CUDA / HIP use and it prevents this
from happening. Most everything uses `atexit` except system utilities
and because of the constructor priority it will be unregistered *after*
everything else but not after `_fl_fini`.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions