Skip to content

Commit c2ad7ee

Browse files
committed
[AMDGPU] override isHighLatencyDef
SIMachineScheduler uses isHighLatencyInstruction with the same sematincs, but TargetInstrInfo has virtual isHighLatencyDef method, so override it instead. Added FLAT to the list of high latency opcodes and a check for mayLoad since stores are not technically high latency in terms of data dependency. This change did not produce any visible impact on our tests. Differential Revision: https://reviews.llvm.org/D73582
1 parent f717483 commit c2ad7ee

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6005,10 +6005,9 @@ bool SIInstrInfo::isLowLatencyInstruction(const MachineInstr &MI) const {
60056005
return isSMRD(Opc);
60066006
}
60076007

6008-
bool SIInstrInfo::isHighLatencyInstruction(const MachineInstr &MI) const {
6009-
unsigned Opc = MI.getOpcode();
6010-
6011-
return isMUBUF(Opc) || isMTBUF(Opc) || isMIMG(Opc);
6008+
bool SIInstrInfo::isHighLatencyDef(int Opc) const {
6009+
return get(Opc).mayLoad() &&
6010+
(isMUBUF(Opc) || isMTBUF(Opc) || isMIMG(Opc) || isFLAT(Opc));
60126011
}
60136012

60146013
unsigned SIInstrInfo::isStackAccess(const MachineInstr &MI,

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
931931
uint64_t getScratchRsrcWords23() const;
932932

933933
bool isLowLatencyInstruction(const MachineInstr &MI) const;
934-
bool isHighLatencyInstruction(const MachineInstr &MI) const;
934+
bool isHighLatencyDef(int Opc) const override;
935935

936936
/// Return the descriptor of the target-specific machine instruction
937937
/// that corresponds to the specified pseudo or native opcode.

llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ void SIScheduleDAGMI::schedule()
19551955
if (SITII->getMemOperandWithOffset(*SU->getInstr(), BaseLatOp, OffLatReg,
19561956
TRI))
19571957
LowLatencyOffset[i] = OffLatReg;
1958-
} else if (SITII->isHighLatencyInstruction(*SU->getInstr()))
1958+
} else if (SITII->isHighLatencyDef(SU->getInstr()->getOpcode()))
19591959
IsHighLatencySU[i] = 1;
19601960
}
19611961

0 commit comments

Comments
 (0)