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]
이 커밋은 다음에 포함됨:
Sang, Tao 작성하고 GitHub가 2025-04-23 14:34:53 -04:00를 커밋함
1 부모 c7737558a4
커밋 45b75013ec
1 파일이 변경됨
+3 -7
+3 -7
파일 보기
@@ -223,9 +223,7 @@ class Monitor {
// fast path
c = 0;
while (c < maxCount_ &&
(notifyState_.load(std::memory_order_acquire) != notifyState::allNotified &&
!notifyState_.compare_exchange_weak(expextedNotifyState, notifyState::notNotified,
std::memory_order_acq_rel, std::memory_order_acquire))) {
(notifyState_.load(std::memory_order_acquire) == notifyState::notNotified)) {
// First, be SMT friendly
if (c < maxReadSpinIter_) {
Os::spinPause();
@@ -261,10 +259,8 @@ class Monitor {
// the mutex is locked again before exiting...
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 (notifyState_.load(std::memory_order_acquire) == notifyState::allNotified) {
// No waiter indicates that notifyAll() processing has ended
notifyState_.store(notifyState::notNotified, std::memory_order_release);
}
// No waiter indicates that notify() or notifyAll() processing has ended
notifyState_.store(notifyState::notNotified, std::memory_order_release);
}
}