diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 7328642bb8..4f0a93348b 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -186,9 +186,11 @@ void Timestamp::checkGpuTime() { bool HsaAmdSignalHandler(hsa_signal_value_t value, void* arg) { Timestamp* ts = reinterpret_cast(arg); - amd::Thread* thread = amd::Thread::current(); - if (!(thread != nullptr || - ((thread = new amd::HostThread()) != nullptr && thread == amd::Thread::current()))) { + static std::shared_ptr thread; + if (amd::Thread::current() == nullptr) { + thread = std::make_shared(); + } + if (thread.get() != amd::Thread::current()) { return false; }