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: 244ad319ac]
This commit is contained in:
@@ -407,7 +407,7 @@ class Signal {
|
||||
core::Agent* async_copy_agent_;
|
||||
|
||||
private:
|
||||
static HybridMutex ipcLock_;
|
||||
static KernelMutex ipcLock_;
|
||||
static std::map<decltype(hsa_signal_t::handle), Signal*> ipcMap_;
|
||||
|
||||
static Signal* lookupIpc(hsa_signal_t signal);
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
namespace rocr {
|
||||
namespace core {
|
||||
|
||||
HybridMutex Signal::ipcLock_;
|
||||
KernelMutex Signal::ipcLock_;
|
||||
std::map<decltype(hsa_signal_t::handle), Signal*> Signal::ipcMap_;
|
||||
|
||||
void SharedSignalPool_t::clear() {
|
||||
@@ -128,7 +128,7 @@ LocalSignal::LocalSignal(hsa_signal_value_t initial_value, bool exportable)
|
||||
}
|
||||
|
||||
void Signal::registerIpc() {
|
||||
ScopedAcquire<HybridMutex> lock(&ipcLock_);
|
||||
ScopedAcquire<KernelMutex> 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<HybridMutex> lock(&ipcLock_);
|
||||
ScopedAcquire<KernelMutex> 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<HybridMutex> lock(&ipcLock_);
|
||||
ScopedAcquire<KernelMutex> 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<HybridMutex> lock(&ipcLock_);
|
||||
ScopedAcquire<KernelMutex> lock(&ipcLock_);
|
||||
const auto& it = ipcMap_.find(signal.handle);
|
||||
if (it == ipcMap_.end()) return nullptr;
|
||||
it->second->refcount_++;
|
||||
|
||||
Reference in New Issue
Block a user