[openmp][amdgpu] Tear down amdgpu plugin accurately
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Thu, 28 Jul 2022 19:00:01 +0000 (20:00 +0100)
committerTom Stellard <tstellar@redhat.com>
Mon, 8 Aug 2022 18:00:41 +0000 (11:00 -0700)
commitcb24013bce01ac135b27cd2a69858e95bcd177c2
treea0fb048c9a8fed066bcb49abcd6c3d9f159bee18
parent087d9bb226995073051ba2035f3aba7575cbd1e1
[openmp][amdgpu] Tear down amdgpu plugin accurately

Moves DeviceInfo global to heap to accurately control lifetime.
Moves calls from libomptarget to deinit_plugin later, plugins need to stay
alive until very shortly before libomptarget is destructed.

Leaving the deinit_plugin calls where initially inserted hits use after
free from the dynamic_module.c offloading test (verified with valgrind
 that the new location is sound with respect to this)

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D130714

(cherry picked from commit ed0f21811544320f829124efbb6a38ee12eb9155)
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
openmp/libomptarget/src/rtl.cpp