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
Этот коммит содержится в:
коммит произвёл
Chris Freehill
родитель
fe5f12342d
Коммит
b1d6cacf79
@@ -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<KernelMutex> 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<KernelMutex> boot(&bootstrap_lock());
|
||||
|
||||
if (runtime_singleton_ == nullptr) return HSA_STATUS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
Ссылка в новой задаче
Block a user