[llvm-branch-commits] [llvm] [AMDGPU][InsertWaitCnts] Move TENSOR/ASYNC event detection to separate header (PR #204544)

Pierre van Houtryve via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 18 03:08:06 PDT 2026


https://github.com/Pierre-vh created https://github.com/llvm/llvm-project/pull/204544

I forgot to move those out of the way as they were not grouped with the other.
Now `getEventsFor` does all the work.

>From 2c576407045090b01aaf7d588ebfa4af95ce5653 Mon Sep 17 00:00:00 2001
From: pvanhout <pierre.vanhoutryve at amd.com>
Date: Thu, 18 Jun 2026 10:58:24 +0200
Subject: [PATCH] [AMDGPU][InsertWaitCnts] Move TENSOR/ASYNC event detection to
 separate header

I forgot to move those out of the way as they were not grouped with the other.
Now `getEventsFor` does all the work.
---
 llvm/lib/Target/AMDGPU/AMDGPUHWEvents.cpp   | 7 +++++++
 llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 5 -----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUHWEvents.cpp b/llvm/lib/Target/AMDGPU/AMDGPUHWEvents.cpp
index 94af63796c94a..04c4e045e231d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUHWEvents.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUHWEvents.cpp
@@ -123,9 +123,16 @@ static HWEvents getEventsForImpl(const MachineInstr &Inst,
 
     if (TII.mayAccessLDSThroughFlat(Inst))
       E |= HWEvents::LDS_ACCESS;
+
+    if (SIInstrInfo::usesASYNC_CNT(Inst))
+      E |= HWEvents::ASYNC_ACCESS;
+
     return E;
   }
 
+  if (SIInstrInfo::usesTENSOR_CNT(Inst))
+    return HWEvents::TENSOR_ACCESS;
+
   if (SIInstrInfo::isVMEM(Inst) &&
       (!AMDGPU::getMUBUFIsBufferInv(Inst.getOpcode()) ||
        Inst.getOpcode() == AMDGPU::BUFFER_WBL2)) {
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 498f92e5a6d10..65089858a8fbf 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -2668,11 +2668,6 @@ void SIInsertWaitcnts::updateEventWaitcntAfter(MachineInstr &Inst,
       // pointers so that both VM and LGKM counters are flushed.
       ScoreBrackets->setPendingFlat();
     }
-    if (SIInstrInfo::usesASYNC_CNT(Inst)) {
-      ScoreBrackets->updateByEvent(HWEvents::ASYNC_ACCESS, Inst);
-    }
-  } else if (SIInstrInfo::usesTENSOR_CNT(Inst)) {
-    ScoreBrackets->updateByEvent(HWEvents::TENSOR_ACCESS, Inst);
   } else if (Inst.isCall()) {
     // Act as a wait on everything, but AsyncCnt and TensorCnt are never
     // included in such blanket waits.



More information about the llvm-branch-commits mailing list