26void HWEventSet::dump()
const {
39 return HWEvent::VGPR_XDL_WRITE;
41 if (
TII.isTRANS(Inst))
42 return HWEvent::VGPR_TRANS_WRITE;
45 return HWEvent::VGPR_DPMACC_WRITE;
47 return HWEvent::VGPR_CSMACC_WRITE;
55 return HWEvent::VGPR_FLAT_READ;
58 return HWEvent::VGPR_LDS_READ;
60 if (
TII.isVMEM(Inst) ||
TII.isVIMAGE(Inst) ||
TII.isVSAMPLE(Inst))
61 return HWEvent::VGPR_VMEM_READ;
71 case AMDGPU::GLOBAL_INV:
72 return HWEvent::GLOBAL_INV_ACCESS;
74 case AMDGPU::GLOBAL_WB:
75 case AMDGPU::GLOBAL_WBINV:
76 return HWEvent::VMEM_WRITE_ACCESS;
85 return HWEvent::VMEM_ACCESS;
88 if (
TII.mayAccessScratch(Inst))
89 return HWEvent::SCRATCH_WRITE_ACCESS;
90 return HWEvent::VMEM_WRITE_ACCESS;
93 return HWEvent::VMEM_ACCESS;
101 return HWEvent::VMEM_BVH_READ_ACCESS;
107 return HWEvent::VMEM_SAMPLER_READ_ACCESS;
110 return HWEvent::VMEM_ACCESS;
116 if (
TII.isDS(Inst) &&
TII.usesLGKM_CNT(Inst)) {
118 TII.hasModifiersSet(Inst, AMDGPU::OpName::gds))
119 return {HWEvent::GDS_ACCESS, HWEvent::GDS_GPR_LOCK};
121 return HWEvent::LDS_ACCESS;
124 if (
TII.isFLAT(Inst)) {
130 if (
TII.mayAccessVMEMThroughFlat(Inst)) {
131 if (ST.hasWaitXcnt())
132 S.
insert(HWEvent::VMEM_GROUP);
136 if (
TII.mayAccessLDSThroughFlat(Inst))
137 S.
insert(HWEvent::LDS_ACCESS);
143 Inst.
getOpcode() == AMDGPU::BUFFER_WBL2)) {
148 if (ST.hasWaitXcnt())
149 S.
insert(HWEvent::VMEM_GROUP);
150 if (ST.vmemWriteNeedsExpWaitcnt() &&
152 S.
insert(HWEvent::VMW_GPR_LOCK);
157 if (
TII.isSMRD(Inst)) {
158 if (ST.hasWaitXcnt())
159 return {HWEvent::SMEM_GROUP, HWEvent::SMEM_ACCESS};
160 return HWEvent::SMEM_ACCESS;
164 return HWEvent::EXP_LDS_ACCESS;
168 unsigned Imm =
TII.getNamedOperand(Inst, AMDGPU::OpName::tgt)->getImm();
170 return HWEvent::EXP_PARAM_ACCESS;
172 return HWEvent::EXP_POS_ACCESS;
173 return HWEvent::EXP_GPR_LOCK;
177 return HWEvent::SCC_WRITE;
181 case AMDGPU::S_SENDMSG:
182 case AMDGPU::S_SENDMSG_RTN_B32:
183 case AMDGPU::S_SENDMSG_RTN_B64:
184 case AMDGPU::S_SENDMSGHALT:
185 return HWEvent::SQ_MESSAGE;
186 case AMDGPU::S_MEMTIME:
187 case AMDGPU::S_MEMREALTIME:
188 case AMDGPU::S_GET_BARRIER_STATE_M0:
189 case AMDGPU::S_GET_BARRIER_STATE_IMM:
190 return HWEvent::SMEM_ACCESS;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMD GCN specific subclass of TargetSubtarget.
const HexagonInstrInfo * TII
Interface definition for SIInstrInfo.
void print(raw_ostream &OS) const
bool contains(const HWEvent &Event) const
void insert(const HWEvent &Event)
A helper class to return the specified delimiter string after the first invocation of operator String...
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
static bool isVMEM(const MachineInstr &MI)
static bool isEXP(const MachineInstr &MI)
static bool mayWriteLDSThroughDMA(const MachineInstr &MI)
static bool isLDSDIR(const MachineInstr &MI)
static bool isVSAMPLE(const MachineInstr &MI)
static bool isAtomicRet(const MachineInstr &MI)
static bool isImage(const MachineInstr &MI)
static bool isGFX12CacheInvOrWBInst(unsigned Opc)
static bool isSBarrierSCCWrite(unsigned Opcode)
static bool isFLAT(const MachineInstr &MI)
static bool isLDSDMA(const MachineInstr &MI)
static bool isAtomicNoRet(const MachineInstr &MI)
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_READONLY const MIMGInfo * getMIMGInfo(unsigned Opc)
bool isDPMACCInstruction(unsigned Opc)
static HWEventSet getEventsForImpl(const MachineInstr &Inst, const GCNSubtarget &ST, const SIInstrInfo &TII)
static HWEventSet getExpertSchedulingEventType(const MachineInstr &Inst, const SIInstrInfo &TII)
HWEventSet getEventsFor(const MachineInstr &Inst, const GCNSubtarget &ST, bool IsExpertMode)
static HWEvent getVmemHWEvent(const MachineInstr &Inst, const GCNSubtarget &ST, const SIInstrInfo &TII)
static constexpr StringLiteral toString(HWEvent Event)
HWEvent
TODO: This should be a bitmask from the start instead of having this enum.
bool getMUBUFIsBufferInv(unsigned Opc)
LLVM_READONLY const MIMGBaseOpcodeInfo * getMIMGBaseOpcodeInfo(unsigned BaseOpcode)
iota_range< HWEvent > hw_events(HWEvent MaxEvent=HWEvent::NUM_WAIT_EVENTS)
Return an iterator over all events between FIRST_WAIT_EVENT and MaxEvent (exclusive,...
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.