[llvm] [AMDGPU] Inline SIInsertWaitcnts::getExpertSchedulingEventType. NFC. (PR #195105)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 08:12:38 PDT 2026
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/195105
None
>From ed8cdaf0b3f807f73c08943068030017a0c822f4 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 30 Apr 2026 16:10:25 +0100
Subject: [PATCH] [AMDGPU] Inline
SIInsertWaitcnts::getExpertSchedulingEventType. NFC.
---
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 65 ++++++++-------------
1 file changed, 23 insertions(+), 42 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index f00b99075b022..04de3a0015502 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -648,9 +648,6 @@ class SIInsertWaitcnts {
return VmemReadMapping[getVmemType(Inst)];
}
- std::optional<WaitEventType>
- getExpertSchedulingEventType(const MachineInstr &Inst) const;
-
bool isAsync(const MachineInstr &MI) const {
if (!SIInstrInfo::isLDSDMA(MI))
return false;
@@ -2797,43 +2794,6 @@ bool SIInsertWaitcnts::generateWaitcnt(AMDGPU::Waitcnt Wait,
return Modified;
}
-std::optional<WaitEventType>
-SIInsertWaitcnts::getExpertSchedulingEventType(const MachineInstr &Inst) const {
- if (TII.isVALU(Inst)) {
- // Core/Side-, DP-, XDL- and TRANS-MACC VALU instructions complete
- // out-of-order with respect to each other, so each of these classes
- // has its own event.
-
- if (TII.isXDL(Inst))
- return VGPR_XDL_WRITE;
-
- if (TII.isTRANS(Inst))
- return VGPR_TRANS_WRITE;
-
- if (AMDGPU::isDPMACCInstruction(Inst.getOpcode()))
- return VGPR_DPMACC_WRITE;
-
- return VGPR_CSMACC_WRITE;
- }
-
- // FLAT and LDS instructions may read their VGPR sources out-of-order
- // with respect to each other and all other VMEM instructions, so
- // each of these also has a separate event.
-
- if (TII.isFLAT(Inst))
- return VGPR_FLAT_READ;
-
- if (TII.isDS(Inst))
- return VGPR_LDS_READ;
-
- if (TII.isVMEM(Inst) || TII.isVIMAGE(Inst) || TII.isVSAMPLE(Inst))
- return VGPR_VMEM_READ;
-
- // Otherwise, no hazard.
-
- return {};
-}
-
bool SIInsertWaitcnts::isVmemAccess(const MachineInstr &MI) const {
return (TII.isFLAT(MI) && TII.mayAccessVMEMThroughFlat(MI)) ||
(TII.isVMEM(MI) && !AMDGPU::getMUBUFIsBufferInv(MI.getOpcode()));
@@ -2900,8 +2860,29 @@ bool SIInsertWaitcnts::insertForcedWaitAfter(MachineInstr &Inst,
WaitEventSet SIInsertWaitcnts::getEventsFor(const MachineInstr &Inst) const {
WaitEventSet Events;
if (IsExpertMode) {
- if (const auto ET = getExpertSchedulingEventType(Inst))
- Events.insert(*ET);
+ if (TII.isVALU(Inst)) {
+ // Core/Side-, DP-, XDL- and TRANS-MACC VALU instructions complete
+ // out-of-order with respect to each other, so each of these classes
+ // has its own event.
+ if (TII.isXDL(Inst))
+ Events.insert(VGPR_XDL_WRITE);
+ else if (TII.isTRANS(Inst))
+ Events.insert(VGPR_TRANS_WRITE);
+ else if (AMDGPU::isDPMACCInstruction(Inst.getOpcode()))
+ Events.insert(VGPR_DPMACC_WRITE);
+ else
+ Events.insert(VGPR_CSMACC_WRITE);
+ } else {
+ // FLAT and LDS instructions may read their VGPR sources out-of-order
+ // with respect to each other and all other VMEM instructions, so
+ // each of these also has a separate event.
+ if (TII.isFLAT(Inst))
+ Events.insert(VGPR_FLAT_READ);
+ else if (TII.isDS(Inst))
+ Events.insert(VGPR_LDS_READ);
+ else if (TII.isVMEM(Inst))
+ Events.insert(VGPR_VMEM_READ);
+ }
}
if (TII.isDS(Inst) && TII.usesLGKM_CNT(Inst)) {
More information about the llvm-commits
mailing list