@@ -345,13 +345,13 @@ class PipelineSolver {
345
345
// return the number of edges missed.
346
346
int addEdges (SmallVectorImpl<SchedGroup> &SyncPipeline, SUnit *SU, int SGID,
347
347
std::vector<std::pair<SUnit *, SUnit *>> &AddedEdges);
348
- // Link the pipeline as if \p SU was in the SchedGroup with ID \p SGID. It
349
- // returns the cost (in terms of missed pipeline edges), and tracks the edges
350
- // added in \p AddedEdges
348
+ // / Link the pipeline as if \p SU was in the SchedGroup with ID \p SGID. It
349
+ // / returns the cost (in terms of missed pipeline edges), and tracks the edges
350
+ // / added in \p AddedEdges
351
351
template <typename T>
352
352
int linkSUnit (SUnit *SU, int SGID,
353
353
std::vector<std::pair<SUnit *, SUnit *>> &AddedEdges, T I, T E);
354
- // Remove the edges passed via \p AddedEdges
354
+ // / Remove the edges passed via \p AddedEdges
355
355
void removeEdges (const std::vector<std::pair<SUnit *, SUnit *>> &AddedEdges);
356
356
// Convert the passed in maps to arrays for bidirectional iterators
357
357
void convertSyncMapsToArrays ();
@@ -851,11 +851,11 @@ class IGLPStrategy {
851
851
const SIInstrInfo *TII;
852
852
853
853
public:
854
- // Add SchedGroups to \p Pipeline to implement this Strategy.
854
+ // / Add SchedGroups to \p SyncedSchedGroups to implement this Strategy.
855
855
virtual void applyIGLPStrategy (
856
856
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
857
857
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
858
- bool IsPostRA ) = 0;
858
+ bool IsReentry ) = 0;
859
859
860
860
// Returns true if this strategy should be applied to a ScheduleDAG.
861
861
virtual bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) = 0;
@@ -874,7 +874,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
874
874
void applyIGLPStrategy (
875
875
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
876
876
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
877
- bool IsPostRA ) override ;
877
+ bool IsReentry ) override ;
878
878
879
879
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
880
880
@@ -887,7 +887,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
887
887
void MFMASmallGemmOpt::applyIGLPStrategy (
888
888
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
889
889
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
890
- bool IsPostRA ) {
890
+ bool IsReentry ) {
891
891
// Count the number of MFMA instructions.
892
892
unsigned MFMACount = 0 ;
893
893
for (const MachineInstr &I : *DAG)
@@ -1050,8 +1050,8 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
1050
1050
: InstructionRule(TII, SGID, NeedsCache) {}
1051
1051
};
1052
1052
1053
- // Whether the SU shares a V_PERM predecessor with any SU in the SchedGroup
1054
- // that is / p Distance steps away
1053
+ // / Whether the SU shares a V_PERM predecessor with any SU in the SchedGroup
1054
+ // / that is \ p Distance steps away
1055
1055
class SharesPredWithPrevNthGroup final : public InstructionRule {
1056
1056
private:
1057
1057
unsigned Distance = 1 ;
@@ -1106,7 +1106,7 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
1106
1106
void applyIGLPStrategy (
1107
1107
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1108
1108
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1109
- bool IsPostRA ) override ;
1109
+ bool IsReentry ) override ;
1110
1110
1111
1111
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
1112
1112
@@ -1123,12 +1123,12 @@ static unsigned DSWWithSharedVMEMCount = 0;
1123
1123
void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy (
1124
1124
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1125
1125
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1126
- bool IsPostRA ) {
1126
+ bool IsReentry ) {
1127
1127
unsigned MFMACount = 0 ;
1128
1128
unsigned DSRCount = 0 ;
1129
1129
1130
- assert ((IsPostRA || (DSWCount == 0 && DSWWithPermCount == 0 &&
1131
- DSWWithSharedVMEMCount == 0 )) &&
1130
+ assert ((IsReentry || (DSWCount == 0 && DSWWithPermCount == 0 &&
1131
+ DSWWithSharedVMEMCount == 0 )) &&
1132
1132
" DSWCounters should be zero in pre-RA scheduling!" );
1133
1133
SmallVector<SUnit *, 6 > DSWithPerms;
1134
1134
for (auto &SU : DAG->SUnits ) {
@@ -1138,7 +1138,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1138
1138
else if (TII->isDS (*I)) {
1139
1139
if (I->mayLoad ())
1140
1140
++DSRCount;
1141
- else if (I->mayStore () && !IsPostRA ) {
1141
+ else if (I->mayStore () && !IsReentry ) {
1142
1142
++DSWCount;
1143
1143
for (auto Pred : SU.Preds ) {
1144
1144
if (Pred.getSUnit ()->getInstr ()->getOpcode () ==
@@ -1151,7 +1151,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1151
1151
}
1152
1152
}
1153
1153
1154
- if (!IsPostRA ) {
1154
+ if (!IsReentry ) {
1155
1155
DSWWithPermCount = DSWithPerms.size ();
1156
1156
auto I = DSWithPerms.begin ();
1157
1157
auto E = DSWithPerms.end ();
@@ -1418,11 +1418,11 @@ class IGroupLPDAGMutation : public ScheduleDAGMutation {
1418
1418
// first created SchedGroup first.
1419
1419
bool IsBottomUp = 1 ;
1420
1420
1421
- // Whether the mutation is being applied to post RA scheduling
1422
- bool IsPostRA = false ;
1421
+ // Whether or not this is a reentry into the IGroupLPDAGMutation.
1422
+ bool IsReentry = false ;
1423
1423
1424
1424
IGroupLPDAGMutation () = default ;
1425
- IGroupLPDAGMutation (bool IsPostRA ) : IsPostRA(IsPostRA ) {}
1425
+ IGroupLPDAGMutation (bool IsReentry ) : IsReentry(IsReentry ) {}
1426
1426
};
1427
1427
1428
1428
unsigned SchedGroup::NumSchedGroups = 0 ;
@@ -1710,16 +1710,21 @@ void IGroupLPDAGMutation::initIGLPOpt(SUnit &SU) {
1710
1710
auto S = createIGLPStrategy (StrategyID, DAG, TII);
1711
1711
if (S->shouldApplyStrategy (DAG)) {
1712
1712
IsBottomUp = S->IsBottomUp ;
1713
- S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, IsPostRA );
1713
+ S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, IsReentry );
1714
1714
}
1715
1715
}
1716
1716
1717
1717
} // namespace
1718
1718
1719
1719
namespace llvm {
1720
1720
1721
- std::unique_ptr<ScheduleDAGMutation> createIGroupLPDAGMutation (bool IsPostRA) {
1722
- return std::make_unique<IGroupLPDAGMutation>(IsPostRA);
1721
+ // / \p IsReentry specifes whether or not this is a reentry into the
1722
+ // / IGroupLPDAGMutation. Since there may be multiple scheduling passes on the
1723
+ // / same scheduling region (e.g. pre and post-RA scheduling / multiple
1724
+ // / scheduling "phases"), we can reenter this mutation framework more than once
1725
+ // / for a given region.
1726
+ std::unique_ptr<ScheduleDAGMutation> createIGroupLPDAGMutation (bool IsReentry) {
1727
+ return std::make_unique<IGroupLPDAGMutation>(IsReentry);
1723
1728
}
1724
1729
1725
1730
} // end namespace llvm
0 commit comments