@@ -1143,6 +1143,7 @@ bool GCNHazardRecognizer::fixVcmpxPermlaneHazards(MachineInstr *MI) {
1143
1143
bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards (MachineInstr *MI) {
1144
1144
if (!ST.hasVMEMtoScalarWriteHazard ())
1145
1145
return false ;
1146
+ assert (!ST.hasExtendedWaitCounts ());
1146
1147
1147
1148
if (!SIInstrInfo::isSALU (*MI) && !SIInstrInfo::isSMRD (*MI))
1148
1149
return false ;
@@ -1189,6 +1190,7 @@ bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards(MachineInstr *MI) {
1189
1190
bool GCNHazardRecognizer::fixSMEMtoVectorWriteHazards (MachineInstr *MI) {
1190
1191
if (!ST.hasSMEMtoVectorWriteHazard ())
1191
1192
return false ;
1193
+ assert (!ST.hasExtendedWaitCounts ());
1192
1194
1193
1195
if (!SIInstrInfo::isVALU (*MI))
1194
1196
return false ;
@@ -1273,7 +1275,11 @@ bool GCNHazardRecognizer::fixSMEMtoVectorWriteHazards(MachineInstr *MI) {
1273
1275
}
1274
1276
1275
1277
bool GCNHazardRecognizer::fixVcmpxExecWARHazard (MachineInstr *MI) {
1276
- if (!ST.hasVcmpxExecWARHazard () || !SIInstrInfo::isVALU (*MI))
1278
+ if (!ST.hasVcmpxExecWARHazard ())
1279
+ return false ;
1280
+ assert (!ST.hasExtendedWaitCounts ());
1281
+
1282
+ if (!SIInstrInfo::isVALU (*MI))
1277
1283
return false ;
1278
1284
1279
1285
const SIRegisterInfo *TRI = ST.getRegisterInfo ();
@@ -1343,6 +1349,7 @@ bool GCNHazardRecognizer::fixLdsBranchVmemWARHazard(MachineInstr *MI) {
1343
1349
return false ;
1344
1350
1345
1351
assert (ST.hasLdsBranchVmemWARHazard ());
1352
+ assert (!ST.hasExtendedWaitCounts ());
1346
1353
1347
1354
auto IsHazardInst = [](const MachineInstr &MI) {
1348
1355
if (SIInstrInfo::isDS (MI))
@@ -1452,6 +1459,8 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
1452
1459
return I.readsRegister (VDSTReg, &TRI) || I.modifiesRegister (VDSTReg, &TRI);
1453
1460
};
1454
1461
bool LdsdirCanWait = ST.hasLdsWaitVMSRC ();
1462
+ // TODO: On GFX12 the hazard should expire on S_WAIT_LOADCNT/SAMPLECNT/BVHCNT
1463
+ // according to the type of VMEM instruction.
1455
1464
auto IsExpiredFn = [this , LdsdirCanWait](const MachineInstr &I, int ) {
1456
1465
return SIInstrInfo::isVALU (I) || SIInstrInfo::isEXP (I) ||
1457
1466
(I.getOpcode () == AMDGPU::S_WAITCNT && !I.getOperand (0 ).getImm ()) ||
@@ -1477,11 +1486,11 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
1477
1486
}
1478
1487
1479
1488
bool GCNHazardRecognizer::fixVALUPartialForwardingHazard (MachineInstr *MI) {
1480
- if (!ST.isWave64 ())
1481
- return false ;
1482
1489
if (!ST.hasVALUPartialForwardingHazard ())
1483
1490
return false ;
1484
- if (!SIInstrInfo::isVALU (*MI))
1491
+ assert (!ST.hasExtendedWaitCounts ());
1492
+
1493
+ if (!ST.isWave64 () || !SIInstrInfo::isVALU (*MI))
1485
1494
return false ;
1486
1495
1487
1496
SmallSetVector<Register, 4 > SrcVGPRs;
@@ -1628,6 +1637,8 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
1628
1637
bool GCNHazardRecognizer::fixVALUTransUseHazard (MachineInstr *MI) {
1629
1638
if (!ST.hasVALUTransUseHazard ())
1630
1639
return false ;
1640
+ assert (!ST.hasExtendedWaitCounts ());
1641
+
1631
1642
if (!SIInstrInfo::isVALU (*MI))
1632
1643
return false ;
1633
1644
@@ -1761,6 +1772,7 @@ bool GCNHazardRecognizer::fixWMMAHazards(MachineInstr *MI) {
1761
1772
bool GCNHazardRecognizer::fixShift64HighRegBug (MachineInstr *MI) {
1762
1773
if (!ST.hasShift64HighRegBug ())
1763
1774
return false ;
1775
+ assert (!ST.hasExtendedWaitCounts ());
1764
1776
1765
1777
switch (MI->getOpcode ()) {
1766
1778
default :
@@ -1890,6 +1902,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
1890
1902
1891
1903
if (!ST.hasFPAtomicToDenormModeHazard ())
1892
1904
return 0 ;
1905
+ assert (!ST.hasExtendedWaitCounts ());
1893
1906
1894
1907
if (MI->getOpcode () != AMDGPU::S_DENORM_MODE)
1895
1908
return 0 ;
@@ -2715,11 +2728,11 @@ bool GCNHazardRecognizer::ShouldPreferAnother(SUnit *SU) {
2715
2728
}
2716
2729
2717
2730
bool GCNHazardRecognizer::fixVALUMaskWriteHazard (MachineInstr *MI) {
2718
- if (!ST.isWave64 ())
2719
- return false ;
2720
2731
if (!ST.hasVALUMaskWriteHazard ())
2721
2732
return false ;
2722
- if (!SIInstrInfo::isSALU (*MI))
2733
+ assert (!ST.hasExtendedWaitCounts ());
2734
+
2735
+ if (!ST.isWave64 () || !SIInstrInfo::isSALU (*MI))
2723
2736
return false ;
2724
2737
2725
2738
// The hazard sequence is three instructions:
0 commit comments