@@ -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
@@ -1767,6 +1778,7 @@ bool GCNHazardRecognizer::fixWMMAHazards(MachineInstr *MI) {
1767
1778
bool GCNHazardRecognizer::fixShift64HighRegBug (MachineInstr *MI) {
1768
1779
if (!ST.hasShift64HighRegBug ())
1769
1780
return false ;
1781
+ assert (!ST.hasExtendedWaitCounts ());
1770
1782
1771
1783
switch (MI->getOpcode ()) {
1772
1784
default :
@@ -1896,6 +1908,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
1896
1908
1897
1909
if (!ST.hasFPAtomicToDenormModeHazard ())
1898
1910
return 0 ;
1911
+ assert (!ST.hasExtendedWaitCounts ());
1899
1912
1900
1913
if (MI->getOpcode () != AMDGPU::S_DENORM_MODE)
1901
1914
return 0 ;
@@ -2721,11 +2734,11 @@ bool GCNHazardRecognizer::ShouldPreferAnother(SUnit *SU) {
2721
2734
}
2722
2735
2723
2736
bool GCNHazardRecognizer::fixVALUMaskWriteHazard (MachineInstr *MI) {
2724
- if (!ST.isWave64 ())
2725
- return false ;
2726
2737
if (!ST.hasVALUMaskWriteHazard ())
2727
2738
return false ;
2728
- if (!SIInstrInfo::isSALU (*MI))
2739
+ assert (!ST.hasExtendedWaitCounts ());
2740
+
2741
+ if (!ST.isWave64 () || !SIInstrInfo::isSALU (*MI))
2729
2742
return false ;
2730
2743
2731
2744
// The hazard sequence is three instructions:
0 commit comments