@@ -183,10 +183,7 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
183
183
if (ST.hasNoDataDepHazard ())
184
184
return NoHazard;
185
185
186
- // FIXME: Should flat be considered vmem?
187
- if ((SIInstrInfo::isVMEM (*MI) ||
188
- SIInstrInfo::isFLAT (*MI))
189
- && checkVMEMHazards (MI) > 0 )
186
+ if (SIInstrInfo::isVMEM (*MI) && checkVMEMHazards (MI) > 0 )
190
187
return HazardType;
191
188
192
189
if (SIInstrInfo::isVALU (*MI) && checkVALUHazards (MI) > 0 )
@@ -202,8 +199,8 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
202
199
return HazardType;
203
200
204
201
if ((SIInstrInfo::isVALU (*MI) || SIInstrInfo::isVMEM (*MI) ||
205
- SIInstrInfo::isFLAT (*MI) || SIInstrInfo::isDS (*MI) ||
206
- SIInstrInfo::isEXP (*MI)) && checkMAIVALUHazards (MI) > 0 )
202
+ SIInstrInfo::isDS (*MI) || SIInstrInfo::isEXP (*MI)) &&
203
+ checkMAIVALUHazards (MI) > 0 )
207
204
return HazardType;
208
205
209
206
if (isSGetReg (MI->getOpcode ()) && checkGetRegHazards (MI) > 0 )
@@ -230,7 +227,6 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
230
227
return HazardType;
231
228
232
229
if ((SIInstrInfo::isVMEM (*MI) ||
233
- SIInstrInfo::isFLAT (*MI) ||
234
230
SIInstrInfo::isDS (*MI)) && checkMAILdStHazards (MI) > 0 )
235
231
return HazardType;
236
232
@@ -324,7 +320,7 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
324
320
if (ST.hasNoDataDepHazard ())
325
321
return WaitStates;
326
322
327
- if (SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isFLAT (*MI) )
323
+ if (SIInstrInfo::isVMEM (*MI))
328
324
WaitStates = std::max (WaitStates, checkVMEMHazards (MI));
329
325
330
326
if (SIInstrInfo::isVALU (*MI))
@@ -340,8 +336,8 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
340
336
WaitStates = std::max (WaitStates, checkRWLaneHazards (MI));
341
337
342
338
if ((SIInstrInfo::isVALU (*MI) || SIInstrInfo::isVMEM (*MI) ||
343
- SIInstrInfo::isFLAT (*MI) || SIInstrInfo::isDS (*MI) ||
344
- SIInstrInfo::isEXP (*MI)) && checkMAIVALUHazards (MI) > 0 )
339
+ SIInstrInfo::isDS (*MI) || SIInstrInfo::isEXP (*MI)) &&
340
+ checkMAIVALUHazards (MI) > 0 )
345
341
WaitStates = std::max (WaitStates, checkMAIVALUHazards (MI));
346
342
347
343
if (MI->isInlineAsm ())
@@ -370,7 +366,6 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
370
366
return std::max (WaitStates, checkMAIHazards (MI));
371
367
372
368
if (SIInstrInfo::isVMEM (*MI) ||
373
- SIInstrInfo::isFLAT (*MI) ||
374
369
SIInstrInfo::isDS (*MI))
375
370
return std::max (WaitStates, checkMAILdStHazards (MI));
376
371
@@ -598,7 +593,7 @@ static bool breaksSMEMSoftClause(MachineInstr *MI) {
598
593
}
599
594
600
595
static bool breaksVMEMSoftClause (MachineInstr *MI) {
601
- return !SIInstrInfo::isVMEM (*MI) && ! SIInstrInfo::isFLAT (*MI) ;
596
+ return !SIInstrInfo::isVMEM (*MI);
602
597
}
603
598
604
599
int GCNHazardRecognizer::checkSoftClauseHazards (MachineInstr *MEM) {
@@ -1250,8 +1245,7 @@ bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards(MachineInstr *MI) {
1250
1245
const SIRegisterInfo *TRI = ST.getRegisterInfo ();
1251
1246
1252
1247
auto IsHazardFn = [TRI, MI](const MachineInstr &I) {
1253
- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I) &&
1254
- !SIInstrInfo::isFLAT (I))
1248
+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
1255
1249
return false ;
1256
1250
1257
1251
for (const MachineOperand &Def : MI->defs ()) {
@@ -1424,9 +1418,8 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
1424
1418
bool HasVmem = false ;
1425
1419
for (auto &MBB : MF) {
1426
1420
for (auto &MI : MBB) {
1427
- HasLds |= SIInstrInfo::isDS (MI);
1428
- HasVmem |=
1429
- SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI);
1421
+ HasLds |= SIInstrInfo::isDS (MI) || SIInstrInfo::isLDSDMA (MI);
1422
+ HasVmem |= SIInstrInfo::isVMEM (MI) && !SIInstrInfo::isLDSDMA (MI);
1430
1423
if (HasLds && HasVmem)
1431
1424
return true ;
1432
1425
}
@@ -1448,9 +1441,9 @@ bool GCNHazardRecognizer::fixLdsBranchVmemWARHazard(MachineInstr *MI) {
1448
1441
assert (!ST.hasExtendedWaitCounts ());
1449
1442
1450
1443
auto IsHazardInst = [](const MachineInstr &MI) {
1451
- if (SIInstrInfo::isDS (MI))
1444
+ if (SIInstrInfo::isDS (MI) || SIInstrInfo::isLDSDMA (MI) )
1452
1445
return 1 ;
1453
- if (SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI))
1446
+ if (SIInstrInfo::isVMEM (MI) && ! SIInstrInfo::isLDSDMA (MI))
1454
1447
return 2 ;
1455
1448
return 0 ;
1456
1449
};
@@ -1517,8 +1510,8 @@ bool GCNHazardRecognizer::fixLdsDirectVALUHazard(MachineInstr *MI) {
1517
1510
if (WaitStates >= NoHazardWaitStates)
1518
1511
return true ;
1519
1512
// Instructions which cause va_vdst==0 expire hazard
1520
- return SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1521
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I);
1513
+ return SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1514
+ SIInstrInfo::isEXP (I);
1522
1515
};
1523
1516
auto GetWaitStatesFn = [](const MachineInstr &MI) {
1524
1517
return SIInstrInfo::isVALU (MI) ? 1 : 0 ;
@@ -1549,8 +1542,7 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
1549
1542
const Register VDSTReg = VDST->getReg ();
1550
1543
1551
1544
auto IsHazardFn = [this , VDSTReg](const MachineInstr &I) {
1552
- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isFLAT (I) &&
1553
- !SIInstrInfo::isDS (I))
1545
+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
1554
1546
return false ;
1555
1547
return I.readsRegister (VDSTReg, &TRI) || I.modifiesRegister (VDSTReg, &TRI);
1556
1548
};
@@ -1635,8 +1627,8 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
1635
1627
return HazardExpired;
1636
1628
1637
1629
// Instructions which cause va_vdst==0 expire hazard
1638
- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1639
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1630
+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1631
+ SIInstrInfo::isEXP (I) ||
1640
1632
(I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
1641
1633
AMDGPU::DepCtr::decodeFieldVaVdst (I.getOperand (0 ).getImm ()) == 0 ))
1642
1634
return HazardExpired;
@@ -1772,8 +1764,8 @@ bool GCNHazardRecognizer::fixVALUTransUseHazard(MachineInstr *MI) {
1772
1764
return HazardExpired;
1773
1765
1774
1766
// Instructions which cause va_vdst==0 expire hazard
1775
- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1776
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1767
+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1768
+ SIInstrInfo::isEXP (I) ||
1777
1769
(I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
1778
1770
I.getOperand (0 ).getImm () == 0x0fff ))
1779
1771
return HazardExpired;
@@ -2003,7 +1995,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
2003
1995
return 0 ;
2004
1996
2005
1997
auto IsHazardFn = [](const MachineInstr &I) {
2006
- if (!SIInstrInfo::isVMEM (I) && ! SIInstrInfo::isFLAT (I) )
1998
+ if (!SIInstrInfo::isVMEM (I))
2007
1999
return false ;
2008
2000
return SIInstrInfo::isFPAtomic (I);
2009
2001
};
@@ -2626,7 +2618,6 @@ int GCNHazardRecognizer::checkMAIVALUHazards(MachineInstr *MI) {
2626
2618
int WaitStatesNeeded = 0 ;
2627
2619
2628
2620
bool IsMem = SIInstrInfo::isVMEM (*MI) ||
2629
- SIInstrInfo::isFLAT (*MI) ||
2630
2621
SIInstrInfo::isDS (*MI);
2631
2622
bool IsMemOrExport = IsMem || SIInstrInfo::isEXP (*MI);
2632
2623
bool IsVALU = SIInstrInfo::isVALU (*MI);
0 commit comments