From 89e51e1f63cdf8a8625af3023b379a70e4926ff3 Mon Sep 17 00:00:00 2001 From: Shweta Khatri Date: Thu, 28 Mar 2024 17:11:21 -0400 Subject: [PATCH] Revert "Use HybridMutex for IPC locks" This reverts commit 5c520f4544c654e5f18e05cabd1c63d64473cfab. Reason for revert: This patch is introducing a synchronization related bug in Unit_hipGetSetDevice_MultiThreaded testcase. Change-Id: I367e4d4f1d75b21658ac1127c58982894a97cedb [ROCm/ROCR-Runtime commit: 244ad319ac3ba2605a4fbaee3ebe6f8ad6dfb89e] --- .../rocr-runtime/runtime/hsa-runtime/core/inc/signal.h | 2 +- .../runtime/hsa-runtime/core/runtime/signal.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h index a1096ddde5..39e5321867 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h @@ -407,7 +407,7 @@ class Signal { core::Agent* async_copy_agent_; private: - static HybridMutex ipcLock_; + static KernelMutex ipcLock_; static std::map ipcMap_; static Signal* lookupIpc(hsa_signal_t signal); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/signal.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/signal.cpp index eee62f5951..065f8ccc9f 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/signal.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/signal.cpp @@ -52,7 +52,7 @@ namespace rocr { namespace core { -HybridMutex Signal::ipcLock_; +KernelMutex Signal::ipcLock_; std::map Signal::ipcMap_; void SharedSignalPool_t::clear() { @@ -128,7 +128,7 @@ LocalSignal::LocalSignal(hsa_signal_value_t initial_value, bool exportable) } void Signal::registerIpc() { - ScopedAcquire lock(&ipcLock_); + ScopedAcquire lock(&ipcLock_); auto handle = Convert(this); assert(ipcMap_.find(handle.handle) == ipcMap_.end() && "Can't register the same IPC signal twice."); @@ -136,7 +136,7 @@ void Signal::registerIpc() { } bool Signal::deregisterIpc() { - ScopedAcquire lock(&ipcLock_); + ScopedAcquire lock(&ipcLock_); if (refcount_ != 0) return false; auto handle = Convert(this); const auto& it = ipcMap_.find(handle.handle); @@ -146,14 +146,14 @@ bool Signal::deregisterIpc() { } Signal* Signal::lookupIpc(hsa_signal_t signal) { - ScopedAcquire lock(&ipcLock_); + ScopedAcquire lock(&ipcLock_); const auto& it = ipcMap_.find(signal.handle); if (it == ipcMap_.end()) return nullptr; return it->second; } Signal* Signal::duplicateIpc(hsa_signal_t signal) { - ScopedAcquire lock(&ipcLock_); + ScopedAcquire lock(&ipcLock_); const auto& it = ipcMap_.find(signal.handle); if (it == ipcMap_.end()) return nullptr; it->second->refcount_++;