SWDEV-516050 - Fix monitor hang in OCL (#75)
Fix monitor hang in cts integer_ops.
Improve notify().
Won't affect notifyAll() and Hip in direct
dispatch mode.
Change-Id: I95a458358e1cab9c76aefde117db09cdbd1fd3af
[ROCm/clr commit: 78f92901d8]
This commit is contained in:
1 parent
c7737558a4
commit
45b75013ec
1 file changed
+3
-7
@@ -223,9 +223,7 @@ class Monitor {
|
|||||||
// fast path
|
// fast path
|
||||||
c = 0;
|
c = 0;
|
||||||
while (c < maxCount_ &&
|
while (c < maxCount_ &&
|
||||||
(notifyState_.load(std::memory_order_acquire) != notifyState::allNotified &&
|
(notifyState_.load(std::memory_order_acquire) == notifyState::notNotified)) {
|
||||||
!notifyState_.compare_exchange_weak(expextedNotifyState, notifyState::notNotified,
|
|
||||||
std::memory_order_acq_rel, std::memory_order_acquire))) {
|
|
||||||
// First, be SMT friendly
|
// First, be SMT friendly
|
||||||
if (c < maxReadSpinIter_) {
|
if (c < maxReadSpinIter_) {
|
||||||
Os::spinPause();
|
Os::spinPause();
|
||||||
@@ -261,10 +259,8 @@ class Monitor {
|
|||||||
// the mutex is locked again before exiting...
|
// the mutex is locked again before exiting...
|
||||||
lk.release(); // Release the ownership so that the caller should unlock the mutex
|
lk.release(); // Release the ownership so that the caller should unlock the mutex
|
||||||
if (waits_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
|
if (waits_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
|
||||||
if (notifyState_.load(std::memory_order_acquire) == notifyState::allNotified) {
|
// No waiter indicates that notify() or notifyAll() processing has ended
|
||||||
// No waiter indicates that notifyAll() processing has ended
|
notifyState_.store(notifyState::notNotified, std::memory_order_release);
|
||||||
notifyState_.store(notifyState::notNotified, std::memory_order_release);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user