From b1d6cacf7951885a343a8d7fdc559e47434320aa Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Wed, 8 Jan 2025 17:45:32 -0600 Subject: [PATCH] rocr: Remove RuntimeCleanup and use of loaded() The recent static initialization changes cause this clean up to happen when it previously never did. The result of ~RuntimeCleanup() being executed is that the static global "loaded_" is set to false, which in turn prevents hsa_init() from executing again. Clean up already happens when hsa_shut_down() occurs. Change-Id: Ib5cefb80d82880c1945e04eb6ec246bc2c7d2324 --- runtime/hsa-runtime/core/runtime/runtime.cpp | 25 -------------------- 1 file changed, 25 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 70b9ed40e2..1471261f05 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -109,29 +109,7 @@ bool g_use_interrupt_wait; bool g_use_mwaitx; Runtime* Runtime::runtime_singleton_ = NULL; - -__forceinline static bool& loaded() { - static bool loaded_ = true; - return loaded_; -} - -class RuntimeCleanup { - public: - ~RuntimeCleanup() { - if (!Runtime::IsOpen()) { - delete Runtime::runtime_singleton_; - } - - loaded() = false; - } -}; - -static RuntimeCleanup cleanup_at_unload_; - hsa_status_t Runtime::Acquire() { - // Check to see if HSA has been cleaned up (process exit) - if (!loaded()) return HSA_STATUS_ERROR_OUT_OF_RESOURCES; - ScopedAcquire boot(&bootstrap_lock()); if (runtime_singleton_ == NULL) { @@ -159,9 +137,6 @@ hsa_status_t Runtime::Acquire() { } hsa_status_t Runtime::Release() { - // Check to see if HSA has been cleaned up (process exit) - if (!loaded()) return HSA_STATUS_SUCCESS; - ScopedAcquire boot(&bootstrap_lock()); if (runtime_singleton_ == nullptr) return HSA_STATUS_ERROR_NOT_INITIALIZED;