[llvm] [AMDGPU][InsertWaitCnts] Make HWEvent a BitMask (PR #203864)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 01:09:22 PDT 2026


================
@@ -1509,22 +1505,22 @@ void WaitcntBrackets::applyWaitcnt(AMDGPU::InstCounterType T, unsigned Count) {
     setScoreLB(T, std::max(getScoreLB(T), UB - Count));
   } else {
     setScoreLB(T, UB);
-    PendingEvents.remove(Context->getWaitEvents(T));
+    PendingEvents = PendingEvents.without(Context->getWaitEvents(T));
   }
 
   if (T == AMDGPU::KM_CNT && Count == 0 &&
-      hasPendingEvent(HWEvent::SMEM_GROUP)) {
+      hasPendingEvent(HWEvents::SMEM_GROUP)) {
     if (!hasMixedPendingEvents(AMDGPU::X_CNT))
       applyWaitcnt(AMDGPU::X_CNT, 0);
     else
-      PendingEvents.remove(HWEvent::SMEM_GROUP);
+      PendingEvents = PendingEvents.without(HWEvents::SMEM_GROUP);
   }
-  if (T == AMDGPU::LOAD_CNT && hasPendingEvent(HWEvent::VMEM_GROUP) &&
+  if (T == AMDGPU::LOAD_CNT && hasPendingEvent(HWEvents::VMEM_GROUP) &&
       !hasPendingEvent(AMDGPU::STORE_CNT)) {
     if (!hasMixedPendingEvents(AMDGPU::X_CNT))
       applyWaitcnt(AMDGPU::X_CNT, Count);
     else if (Count == 0)
-      PendingEvents.remove(HWEvent::VMEM_GROUP);
+      PendingEvents = PendingEvents.without(HWEvents::VMEM_GROUP);
----------------
ssahasra wrote:

A `-=` operator seems more readable to me. I am not really sure what the opposite of `|=` should be.

https://github.com/llvm/llvm-project/pull/203864


More information about the llvm-commits mailing list