@@ -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 )
@@ -229,9 +226,8 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
229
226
if (SIInstrInfo::isMAI (*MI) && checkMAIHazards (MI) > 0 )
230
227
return HazardType;
231
228
232
- if ((SIInstrInfo::isVMEM (*MI) ||
233
- SIInstrInfo::isFLAT (*MI) ||
234
- SIInstrInfo::isDS (*MI)) && checkMAILdStHazards (MI) > 0 )
229
+ if ((SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI)) &&
230
+ checkMAILdStHazards (MI) > 0 )
235
231
return HazardType;
236
232
237
233
if (MI->isInlineAsm () && checkInlineAsmHazards (MI) > 0 )
@@ -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 ())
@@ -369,9 +365,7 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
369
365
if (SIInstrInfo::isMAI (*MI))
370
366
return std::max (WaitStates, checkMAIHazards (MI));
371
367
372
- if (SIInstrInfo::isVMEM (*MI) ||
373
- SIInstrInfo::isFLAT (*MI) ||
374
- SIInstrInfo::isDS (*MI))
368
+ if (SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI))
375
369
return std::max (WaitStates, checkMAILdStHazards (MI));
376
370
377
371
if (ST.hasGFX950Insts () && isPermlane (*MI))
@@ -598,7 +592,7 @@ static bool breaksSMEMSoftClause(MachineInstr *MI) {
598
592
}
599
593
600
594
static bool breaksVMEMSoftClause (MachineInstr *MI) {
601
- return !SIInstrInfo::isVMEM (*MI) && ! SIInstrInfo::isFLAT (*MI) ;
595
+ return !SIInstrInfo::isVMEM (*MI);
602
596
}
603
597
604
598
int GCNHazardRecognizer::checkSoftClauseHazards (MachineInstr *MEM) {
@@ -1250,8 +1244,7 @@ bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards(MachineInstr *MI) {
1250
1244
const SIRegisterInfo *TRI = ST.getRegisterInfo ();
1251
1245
1252
1246
auto IsHazardFn = [TRI, MI](const MachineInstr &I) {
1253
- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I) &&
1254
- !SIInstrInfo::isFLAT (I))
1247
+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
1255
1248
return false ;
1256
1249
1257
1250
for (const MachineOperand &Def : MI->defs ()) {
@@ -1425,8 +1418,8 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
1425
1418
for (auto &MBB : MF) {
1426
1419
for (auto &MI : MBB) {
1427
1420
HasLds |= SIInstrInfo::isDS (MI);
1428
- HasVmem |=
1429
- SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI);
1421
+ HasVmem |= ( SIInstrInfo::isVMEM (MI) && ! SIInstrInfo::isFLAT (MI)) ||
1422
+ SIInstrInfo::isSegmentSpecificFLAT (MI);
1430
1423
if (HasLds && HasVmem)
1431
1424
return true ;
1432
1425
}
@@ -1450,7 +1443,8 @@ bool GCNHazardRecognizer::fixLdsBranchVmemWARHazard(MachineInstr *MI) {
1450
1443
auto IsHazardInst = [](const MachineInstr &MI) {
1451
1444
if (SIInstrInfo::isDS (MI))
1452
1445
return 1 ;
1453
- if (SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI))
1446
+ if ((SIInstrInfo::isVMEM (MI) && !SIInstrInfo::isFLAT (MI)) ||
1447
+ SIInstrInfo::isSegmentSpecificFLAT (MI))
1454
1448
return 2 ;
1455
1449
return 0 ;
1456
1450
};
@@ -1517,8 +1511,8 @@ bool GCNHazardRecognizer::fixLdsDirectVALUHazard(MachineInstr *MI) {
1517
1511
if (WaitStates >= NoHazardWaitStates)
1518
1512
return true ;
1519
1513
// Instructions which cause va_vdst==0 expire hazard
1520
- return SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1521
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I);
1514
+ return SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1515
+ SIInstrInfo::isEXP (I);
1522
1516
};
1523
1517
auto GetWaitStatesFn = [](const MachineInstr &MI) {
1524
1518
return SIInstrInfo::isVALU (MI) ? 1 : 0 ;
@@ -1549,8 +1543,7 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
1549
1543
const Register VDSTReg = VDST->getReg ();
1550
1544
1551
1545
auto IsHazardFn = [this , VDSTReg](const MachineInstr &I) {
1552
- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isFLAT (I) &&
1553
- !SIInstrInfo::isDS (I))
1546
+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
1554
1547
return false ;
1555
1548
return I.readsRegister (VDSTReg, &TRI) || I.modifiesRegister (VDSTReg, &TRI);
1556
1549
};
@@ -1635,8 +1628,8 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
1635
1628
return HazardExpired;
1636
1629
1637
1630
// Instructions which cause va_vdst==0 expire hazard
1638
- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1639
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1631
+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1632
+ SIInstrInfo::isEXP (I) ||
1640
1633
(I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
1641
1634
AMDGPU::DepCtr::decodeFieldVaVdst (I.getOperand (0 ).getImm ()) == 0 ))
1642
1635
return HazardExpired;
@@ -1772,8 +1765,8 @@ bool GCNHazardRecognizer::fixVALUTransUseHazard(MachineInstr *MI) {
1772
1765
return HazardExpired;
1773
1766
1774
1767
// Instructions which cause va_vdst==0 expire hazard
1775
- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1776
- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1768
+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1769
+ SIInstrInfo::isEXP (I) ||
1777
1770
(I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
1778
1771
I.getOperand (0 ).getImm () == 0x0fff ))
1779
1772
return HazardExpired;
@@ -2003,7 +1996,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
2003
1996
return 0 ;
2004
1997
2005
1998
auto IsHazardFn = [](const MachineInstr &I) {
2006
- if (!SIInstrInfo::isVMEM (I) && ! SIInstrInfo::isFLAT (I) )
1999
+ if (!SIInstrInfo::isVMEM (I))
2007
2000
return false ;
2008
2001
return SIInstrInfo::isFPAtomic (I);
2009
2002
};
@@ -2625,9 +2618,7 @@ int GCNHazardRecognizer::checkMAIVALUHazards(MachineInstr *MI) {
2625
2618
2626
2619
int WaitStatesNeeded = 0 ;
2627
2620
2628
- bool IsMem = SIInstrInfo::isVMEM (*MI) ||
2629
- SIInstrInfo::isFLAT (*MI) ||
2630
- SIInstrInfo::isDS (*MI);
2621
+ bool IsMem = SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI);
2631
2622
bool IsMemOrExport = IsMem || SIInstrInfo::isEXP (*MI);
2632
2623
bool IsVALU = SIInstrInfo::isVALU (*MI);
2633
2624
0 commit comments