[llvm] [Offload] Implement `olShutDown` (PR #144055)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 06:36:48 PDT 2025
================
@@ -130,6 +131,9 @@ constexpr ol_platform_backend_t pluginNameToBackend(StringRef Name) {
#include "Shared/Targets.def"
void initPlugins() {
+ PlatformList = new PlatformVecT();
+ AllocInfoMap = new AllocInfoMapT();
----------------
RossBrunton wrote:
`unique_ptr` doesn't work here because of the destruction order of statics. `olShutDown` requires the platforms list to be valid (so it can loop through them and deinit them). However if you call `olShutDown` in the destructor of a static (e.g. https://github.com/llvm/llvm-project/blob/main/offload/unittests/OffloadAPI/common/Environment.cpp#L20 ), then the `unique_ptr` might get freed before `olShutDown` is ran.
https://github.com/llvm/llvm-project/pull/144055
More information about the llvm-commits
mailing list