Skip to content

Commit d3f9c4f

Browse files
committed
update GCNHazardRecognizer
1 parent fd460a7 commit d3f9c4f

File tree

3 files changed

+91
-93
lines changed

3 files changed

+91
-93
lines changed

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ bool GCNHazardRecognizer::fixWMMAHazards(MachineInstr *MI) {
17221722
const SIInstrInfo *TII = ST.getInstrInfo();
17231723
const SIRegisterInfo *TRI = ST.getRegisterInfo();
17241724

1725-
auto IsHazardFn = [MI, TII, TRI](const MachineInstr &I) {
1725+
auto IsHazardFn = [MI, TII, TRI, this](const MachineInstr &I) {
17261726
if (!SIInstrInfo::isWMMA(I) && !SIInstrInfo::isSWMMAC(I))
17271727
return false;
17281728

@@ -1741,6 +1741,18 @@ bool GCNHazardRecognizer::fixWMMAHazards(MachineInstr *MI) {
17411741
return true;
17421742
}
17431743

1744+
// GFX12+ allows overlap of matrix C with PrevDstReg (hardware will stall)
1745+
// but Index can't overlap with PrevDstReg.
1746+
if (AMDGPU::isGFX12Plus(ST)) {
1747+
if (SIInstrInfo::isSWMMAC(*MI)) {
1748+
const Register CurIndex =
1749+
TII->getNamedOperand(*MI, AMDGPU::OpName::src2)->getReg();
1750+
if (TRI->regsOverlap(PrevDstReg, CurIndex))
1751+
return true;
1752+
}
1753+
return false;
1754+
}
1755+
17441756
return false;
17451757
};
17461758

0 commit comments

Comments
 (0)