@@ -852,7 +852,7 @@ class IGLPStrategy {
852
852
virtual void applyIGLPStrategy (
853
853
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
854
854
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
855
- bool IsReentry ) = 0;
855
+ IGLPPhase Phase ) = 0;
856
856
857
857
// Returns true if this strategy should be applied to a ScheduleDAG.
858
858
virtual bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) = 0;
@@ -871,7 +871,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
871
871
void applyIGLPStrategy (
872
872
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
873
873
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
874
- bool IsReentry ) override ;
874
+ IGLPPhase Phase ) override ;
875
875
876
876
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
877
877
@@ -884,7 +884,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
884
884
void MFMASmallGemmOpt::applyIGLPStrategy (
885
885
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
886
886
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
887
- bool IsReentry ) {
887
+ IGLPPhase Phase ) {
888
888
// Count the number of MFMA instructions.
889
889
unsigned MFMACount = 0 ;
890
890
for (const MachineInstr &I : *DAG)
@@ -1101,7 +1101,7 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
1101
1101
void applyIGLPStrategy (
1102
1102
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1103
1103
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1104
- bool IsReentry ) override ;
1104
+ IGLPPhase Phase ) override ;
1105
1105
1106
1106
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
1107
1107
@@ -1118,13 +1118,14 @@ static unsigned DSWWithSharedVMEMCount = 0;
1118
1118
void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy (
1119
1119
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1120
1120
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1121
- bool IsReentry ) {
1121
+ IGLPPhase Phase ) {
1122
1122
unsigned MFMACount = 0 ;
1123
1123
unsigned DSRCount = 0 ;
1124
1124
1125
- assert ((IsReentry || (DSWCount == 0 && DSWWithPermCount == 0 &&
1126
- DSWWithSharedVMEMCount == 0 )) &&
1127
- " DSWCounters should be zero in pre-RA scheduling!" );
1125
+ assert (
1126
+ (Phase != IGLPPhase::Initial || (DSWCount == 0 && DSWWithPermCount == 0 &&
1127
+ DSWWithSharedVMEMCount == 0 )) &&
1128
+ " DSWCounters should be zero in pre-RA scheduling!" );
1128
1129
SmallVector<SUnit *, 6 > DSWithPerms;
1129
1130
for (auto &SU : DAG->SUnits ) {
1130
1131
auto I = SU.getInstr ();
@@ -1133,7 +1134,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1133
1134
else if (TII->isDS (*I)) {
1134
1135
if (I->mayLoad ())
1135
1136
++DSRCount;
1136
- else if (I->mayStore () && !IsReentry ) {
1137
+ else if (I->mayStore () && Phase == IGLPPhase::Initial ) {
1137
1138
++DSWCount;
1138
1139
for (auto Pred : SU.Preds ) {
1139
1140
if (Pred.getSUnit ()->getInstr ()->getOpcode () ==
@@ -1146,7 +1147,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1146
1147
}
1147
1148
}
1148
1149
1149
- if (!IsReentry ) {
1150
+ if (Phase == IGLPPhase::Initial ) {
1150
1151
DSWWithPermCount = DSWithPerms.size ();
1151
1152
auto I = DSWithPerms.begin ();
1152
1153
auto E = DSWithPerms.end ();
@@ -1414,10 +1415,10 @@ class IGroupLPDAGMutation : public ScheduleDAGMutation {
1414
1415
bool IsBottomUp = 1 ;
1415
1416
1416
1417
// Whether or not this is a reentry into the IGroupLPDAGMutation.
1417
- bool IsReentry = false ;
1418
+ IGLPPhase Phase = IGLPPhase::Initial ;
1418
1419
1419
1420
IGroupLPDAGMutation () = default ;
1420
- IGroupLPDAGMutation (bool IsReentry ) : IsReentry(IsReentry ) {}
1421
+ IGroupLPDAGMutation (IGLPPhase Phase ) : Phase(Phase ) {}
1421
1422
};
1422
1423
1423
1424
unsigned SchedGroup::NumSchedGroups = 0 ;
@@ -1717,21 +1718,22 @@ void IGroupLPDAGMutation::initIGLPOpt(SUnit &SU) {
1717
1718
auto S = createIGLPStrategy (StrategyID, DAG, TII);
1718
1719
if (S->shouldApplyStrategy (DAG)) {
1719
1720
IsBottomUp = S->IsBottomUp ;
1720
- S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, IsReentry );
1721
+ S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, Phase );
1721
1722
}
1722
1723
}
1723
1724
1724
1725
} // namespace
1725
1726
1726
1727
namespace llvm {
1727
1728
1728
- // / \p IsReentry specifes whether or not this is a reentry into the
1729
+ // / \p Phase specifes whether or not this is a reentry into the
1729
1730
// / IGroupLPDAGMutation. Since there may be multiple scheduling passes on the
1730
1731
// / same scheduling region (e.g. pre and post-RA scheduling / multiple
1731
1732
// / scheduling "phases"), we can reenter this mutation framework more than once
1732
1733
// / for a given region.
1733
- std::unique_ptr<ScheduleDAGMutation> createIGroupLPDAGMutation (bool IsReentry) {
1734
- return std::make_unique<IGroupLPDAGMutation>(IsReentry);
1734
+ std::unique_ptr<ScheduleDAGMutation>
1735
+ createIGroupLPDAGMutation (IGLPPhase Phase) {
1736
+ return std::make_unique<IGroupLPDAGMutation>(Phase);
1735
1737
}
1736
1738
1737
1739
} // end namespace llvm
0 commit comments