@@ -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 ();
@@ -847,11 +847,11 @@ class IGLPStrategy {
847
847
const SIInstrInfo *TII;
848
848
849
849
public:
850
- // Add SchedGroups to \p Pipeline to implement this Strategy.
850
+ // / Add SchedGroups to \p SyncedSchedGroups to implement this Strategy.
851
851
virtual void applyIGLPStrategy (
852
852
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
853
853
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
854
- bool IsPostRA ) = 0;
854
+ bool IsReentry ) = 0;
855
855
856
856
// Returns true if this strategy should be applied to a ScheduleDAG.
857
857
virtual bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) = 0;
@@ -870,7 +870,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
870
870
void applyIGLPStrategy (
871
871
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
872
872
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
873
- bool IsPostRA ) override ;
873
+ bool IsReentry ) override ;
874
874
875
875
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
876
876
@@ -883,7 +883,7 @@ class MFMASmallGemmOpt final : public IGLPStrategy {
883
883
void MFMASmallGemmOpt::applyIGLPStrategy (
884
884
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
885
885
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
886
- bool IsPostRA ) {
886
+ bool IsReentry ) {
887
887
// Count the number of MFMA instructions.
888
888
unsigned MFMACount = 0 ;
889
889
for (const MachineInstr &I : *DAG)
@@ -1045,8 +1045,8 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
1045
1045
: InstructionRule(TII, SGID, NeedsCache) {}
1046
1046
};
1047
1047
1048
- // Whether the SU shares a V_PERM predecessor with any SU in the SchedGroup
1049
- // that is / p Distance steps away
1048
+ // / Whether the SU shares a V_PERM predecessor with any SU in the SchedGroup
1049
+ // / that is \ p Distance steps away
1050
1050
class SharesPredWithPrevNthGroup final : public InstructionRule {
1051
1051
private:
1052
1052
unsigned Distance = 1 ;
@@ -1100,7 +1100,7 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
1100
1100
void applyIGLPStrategy (
1101
1101
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1102
1102
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1103
- bool IsPostRA ) override ;
1103
+ bool IsReentry ) override ;
1104
1104
1105
1105
bool shouldApplyStrategy (ScheduleDAGInstrs *DAG) override { return true ; }
1106
1106
@@ -1117,12 +1117,12 @@ static unsigned DSWWithSharedVMEMCount = 0;
1117
1117
void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy (
1118
1118
DenseMap<int , SUnitsToCandidateSGsMap> &SyncedInstrs,
1119
1119
DenseMap<int , SmallVector<SchedGroup, 4 >> &SyncedSchedGroups,
1120
- bool IsPostRA ) {
1120
+ bool IsReentry ) {
1121
1121
unsigned MFMACount = 0 ;
1122
1122
unsigned DSRCount = 0 ;
1123
1123
1124
- assert ((IsPostRA || (DSWCount == 0 && DSWWithPermCount == 0 &&
1125
- DSWWithSharedVMEMCount == 0 )) &&
1124
+ assert ((IsReentry || (DSWCount == 0 && DSWWithPermCount == 0 &&
1125
+ DSWWithSharedVMEMCount == 0 )) &&
1126
1126
" DSWCounters should be zero in pre-RA scheduling!" );
1127
1127
SmallVector<SUnit *, 6 > DSWithPerms;
1128
1128
for (auto &SU : DAG->SUnits ) {
@@ -1132,7 +1132,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1132
1132
else if (TII->isDS (*I)) {
1133
1133
if (I->mayLoad ())
1134
1134
++DSRCount;
1135
- else if (I->mayStore () && !IsPostRA ) {
1135
+ else if (I->mayStore () && !IsReentry ) {
1136
1136
++DSWCount;
1137
1137
for (auto Pred : SU.Preds ) {
1138
1138
if (Pred.getSUnit ()->getInstr ()->getOpcode () ==
@@ -1145,7 +1145,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
1145
1145
}
1146
1146
}
1147
1147
1148
- if (!IsPostRA ) {
1148
+ if (!IsReentry ) {
1149
1149
DSWWithPermCount = DSWithPerms.size ();
1150
1150
auto I = DSWithPerms.begin ();
1151
1151
auto E = DSWithPerms.end ();
@@ -1412,11 +1412,11 @@ class IGroupLPDAGMutation : public ScheduleDAGMutation {
1412
1412
// first created SchedGroup first.
1413
1413
bool IsBottomUp = 1 ;
1414
1414
1415
- // Whether the mutation is being applied to post RA scheduling
1416
- bool IsPostRA = false ;
1415
+ // Whether or not this is a reentry into the IGroupLPDAGMutation.
1416
+ bool IsReentry = false ;
1417
1417
1418
1418
IGroupLPDAGMutation () = default ;
1419
- IGroupLPDAGMutation (bool IsPostRA ) : IsPostRA(IsPostRA ) {}
1419
+ IGroupLPDAGMutation (bool IsReentry ) : IsReentry(IsReentry ) {}
1420
1420
};
1421
1421
1422
1422
unsigned SchedGroup::NumSchedGroups = 0 ;
@@ -1704,16 +1704,21 @@ void IGroupLPDAGMutation::initIGLPOpt(SUnit &SU) {
1704
1704
auto S = createIGLPStrategy (StrategyID, DAG, TII);
1705
1705
if (S->shouldApplyStrategy (DAG)) {
1706
1706
IsBottomUp = S->IsBottomUp ;
1707
- S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, IsPostRA );
1707
+ S->applyIGLPStrategy (SyncedInstrs, SyncedSchedGroups, IsReentry );
1708
1708
}
1709
1709
}
1710
1710
1711
1711
} // namespace
1712
1712
1713
1713
namespace llvm {
1714
1714
1715
- std::unique_ptr<ScheduleDAGMutation> createIGroupLPDAGMutation (bool IsPostRA) {
1716
- return std::make_unique<IGroupLPDAGMutation>(IsPostRA);
1715
+ // / \p IsReentry specifes whether or not this is a reentry into the
1716
+ // / IGroupLPDAGMutation. Since there may be multiple scheduling passes on the
1717
+ // / same scheduling region (e.g. pre and post-RA scheduling / multiple
1718
+ // / scheduling "phases"), we can reenter this mutation framework more than once
1719
+ // / for a given region.
1720
+ std::unique_ptr<ScheduleDAGMutation> createIGroupLPDAGMutation (bool IsReentry) {
1721
+ return std::make_unique<IGroupLPDAGMutation>(IsReentry);
1717
1722
}
1718
1723
1719
1724
} // end namespace llvm
0 commit comments