summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp b/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp
index 86924667084d..77960ef62f3a 100644
--- a/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp
@@ -80,13 +80,11 @@ static void printLivenessInfo(raw_ostream &OS,
const auto &MRI = BB->getParent()->getRegInfo();
const auto LiveIns = getLiveRegsBefore(*Begin, *LIS);
- OS << "LIn RP: ";
- getRegPressure(MRI, LiveIns).print(OS);
+ OS << "LIn RP: " << print(getRegPressure(MRI, LiveIns));
const auto BottomMI = End == BB->end() ? std::prev(End) : End;
const auto LiveOuts = getLiveRegsAfter(*BottomMI, *LIS);
- OS << "LOt RP: ";
- getRegPressure(MRI, LiveOuts).print(OS);
+ OS << "LOt RP: " << print(getRegPressure(MRI, LiveOuts));
}
LLVM_DUMP_METHOD
@@ -96,8 +94,7 @@ void GCNIterativeScheduler::printRegions(raw_ostream &OS) const {
OS << "Region to schedule ";
printRegion(OS, R->Begin, R->End, LIS, 1);
printLivenessInfo(OS, R->Begin, R->End, LIS);
- OS << "Max RP: ";
- R->MaxPressure.print(OS, &ST);
+ OS << "Max RP: " << print(R->MaxPressure, &ST);
}
}
@@ -116,10 +113,8 @@ void GCNIterativeScheduler::printSchedRP(raw_ostream &OS,
const GCNRegPressure &Before,
const GCNRegPressure &After) const {
const auto &ST = MF.getSubtarget<GCNSubtarget>();
- OS << "RP before: ";
- Before.print(OS, &ST);
- OS << "RP after: ";
- After.print(OS, &ST);
+ OS << "RP before: " << print(Before, &ST)
+ << "RP after: " << print(After, &ST);
}
#endif
@@ -297,9 +292,9 @@ void GCNIterativeScheduler::schedule() { // overridden
// do nothing
LLVM_DEBUG(printLivenessInfo(dbgs(), RegionBegin, RegionEnd, LIS);
if (!Regions.empty() && Regions.back()->Begin == RegionBegin) {
- dbgs() << "Max RP: ";
- Regions.back()->MaxPressure.print(
- dbgs(), &MF.getSubtarget<GCNSubtarget>());
+ dbgs() << "Max RP: "
+ << print(Regions.back()->MaxPressure,
+ &MF.getSubtarget<GCNSubtarget>());
} dbgs()
<< '\n';);
}
@@ -326,7 +321,7 @@ GCNIterativeScheduler::detachSchedule(ScheduleRef Schedule) const {
Res.push_back(FirstDbgValue);
const auto DbgB = DbgValues.begin(), DbgE = DbgValues.end();
- for (auto SU : Schedule) {
+ for (const auto *SU : Schedule) {
Res.push_back(SU->getInstr());
const auto &D = std::find_if(DbgB, DbgE, [SU](decltype(*DbgB) &P) {
return P.second == SU->getInstr();
@@ -403,15 +398,14 @@ void GCNIterativeScheduler::scheduleRegion(Region &R, Range &&Schedule,
const auto RegionMaxRP = getRegionPressure(R);
const auto &ST = MF.getSubtarget<GCNSubtarget>();
#endif
- assert((SchedMaxRP == RegionMaxRP && (MaxRP.empty() || SchedMaxRP == MaxRP))
- || (dbgs() << "Max RP mismatch!!!\n"
- "RP for schedule (calculated): ",
- SchedMaxRP.print(dbgs(), &ST),
- dbgs() << "RP for schedule (reported): ",
- MaxRP.print(dbgs(), &ST),
- dbgs() << "RP after scheduling: ",
- RegionMaxRP.print(dbgs(), &ST),
- false));
+ assert(
+ (SchedMaxRP == RegionMaxRP && (MaxRP.empty() || SchedMaxRP == MaxRP)) ||
+ (dbgs() << "Max RP mismatch!!!\n"
+ "RP for schedule (calculated): "
+ << print(SchedMaxRP, &ST)
+ << "RP for schedule (reported): " << print(MaxRP, &ST)
+ << "RP after scheduling: " << print(RegionMaxRP, &ST),
+ false));
}
// Sort recorded regions by pressure - highest at the front
@@ -439,7 +433,7 @@ unsigned GCNIterativeScheduler::tryMaximizeOccupancy(unsigned TargetOcc) {
<< ", current = " << Occ << '\n');
auto NewOcc = TargetOcc;
- for (auto R : Regions) {
+ for (auto *R : Regions) {
if (R->MaxPressure.getOccupancy(ST) >= NewOcc)
break;
@@ -495,7 +489,7 @@ void GCNIterativeScheduler::scheduleLegacyMaxOccupancy(
// running first pass with TargetOccupancy = 0 mimics previous scheduling
// approach and is a performance magic
LStrgy.setTargetOccupancy(I == 0 ? 0 : TgtOcc);
- for (auto R : Regions) {
+ for (auto *R : Regions) {
OverrideLegacyStrategy Ovr(*R, LStrgy, *this);
Ovr.schedule();
@@ -530,7 +524,7 @@ void GCNIterativeScheduler::scheduleMinReg(bool force) {
sortRegionsByPressure(TgtOcc);
auto MaxPressure = Regions.front()->MaxPressure;
- for (auto R : Regions) {
+ for (auto *R : Regions) {
if (!force && R->MaxPressure.less(ST, MaxPressure, TgtOcc))
break;
@@ -574,7 +568,7 @@ void GCNIterativeScheduler::scheduleILP(
<< TgtOcc << '\n');
unsigned FinalOccupancy = std::min(Occ, MFI->getOccupancy());
- for (auto R : Regions) {
+ for (auto *R : Regions) {
BuildDAG DAG(*R, *this);
const auto ILPSchedule = makeGCNILPScheduler(DAG.getBottomRoots(), *this);