Skip to content

Commit e5c4cde

Browse files
committed
[AMDGPU] SIMachineScheduler: Add support for several MachineScheduler features
The SI machine scheduler inherits from ScheduleDAGMI. This patch adds support for a few features that are implemented in ScheduleDAGMI (or its base classes) that were missing so far because their support is implemented in overridden functions. * Support cl::opt -view-misched-dags This option allows to open a graphical window of the scheduling DAG. * Support cl::opt -misched-print-dags This option allows to print the scheduling DAG in text form. * After constructing the scheduling DAG, call postprocessDAG() to apply any registered DAG mutations. Note that currently there are no mutations defined in AMDGPUTargetMachine.cpp in case SIScheduler is used. Still add this to avoid surprises in the future in case mutations are added. Differential Revision: https://reviews.llvm.org/D128808
1 parent cfec208 commit e5c4cde

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

llvm/include/llvm/CodeGen/MachineScheduler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ extern cl::opt<bool> ForceBottomUp;
103103
extern cl::opt<bool> VerifyScheduling;
104104
#ifndef NDEBUG
105105
extern cl::opt<bool> ViewMISchedDAGs;
106+
extern cl::opt<bool> PrintDAGs;
106107
#else
107108
extern const bool ViewMISchedDAGs;
109+
extern const bool PrintDAGs;
108110
#endif
109111

110112
class AAResults;

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ cl::opt<bool> VerifyScheduling(
9393
cl::opt<bool> ViewMISchedDAGs(
9494
"view-misched-dags", cl::Hidden,
9595
cl::desc("Pop up a window to show MISched dags after they are processed"));
96+
cl::opt<bool> PrintDAGs("misched-print-dags", cl::Hidden,
97+
cl::desc("Print schedule DAGs"));
9698
#else
9799
const bool ViewMISchedDAGs = false;
100+
const bool PrintDAGs = false;
98101
#endif // NDEBUG
99102

100103
} // end namespace llvm
@@ -112,10 +115,6 @@ static cl::opt<std::string> SchedOnlyFunc("misched-only-func", cl::Hidden,
112115
cl::desc("Only schedule this function"));
113116
static cl::opt<unsigned> SchedOnlyBlock("misched-only-block", cl::Hidden,
114117
cl::desc("Only schedule this MBB#"));
115-
static cl::opt<bool> PrintDAGs("misched-print-dags", cl::Hidden,
116-
cl::desc("Print schedule DAGs"));
117-
#else
118-
static const bool PrintDAGs = false;
119118
#endif // NDEBUG
120119

121120
/// Avoid quadratic complexity in unusually large basic blocks by limiting the

llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,13 @@ void SIScheduleDAGMI::schedule()
18831883
LLVM_DEBUG(dbgs() << "Preparing Scheduling\n");
18841884

18851885
buildDAGWithRegPressure();
1886+
postprocessDAG();
1887+
18861888
LLVM_DEBUG(dump());
1889+
if (PrintDAGs)
1890+
dump();
1891+
if (ViewMISchedDAGs)
1892+
viewGraph();
18871893

18881894
topologicalSort();
18891895
findRootsAndBiasEdges(TopRoots, BotRoots);

0 commit comments

Comments
 (0)