[llvm] r303186 - [AMDGPU] Use GCNRPTracker dumper methods in scheduler
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 09:31:46 PDT 2017
Author: rampitec
Date: Tue May 16 11:31:45 2017
New Revision: 303186
URL: http://llvm.org/viewvc/llvm-project?rev=303186&view=rev
Log:
[AMDGPU] Use GCNRPTracker dumper methods in scheduler
Differential Revision: https://reviews.llvm.org/D33244
Modified:
llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.cpp
llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.h
llvm/trunk/lib/Target/AMDGPU/GCNSchedStrategy.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.cpp?rev=303186&r1=303185&r2=303186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.cpp Tue May 16 11:31:45 2017
@@ -451,4 +451,16 @@ bool GCNUpwardRPTracker::isValid() const
return true;
}
+void GCNRPTracker::printLiveRegs(raw_ostream &OS, const LiveRegSet& LiveRegs,
+ const MachineRegisterInfo &MRI) {
+ const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
+ for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
+ unsigned Reg = TargetRegisterInfo::index2VirtReg(I);
+ auto It = LiveRegs.find(Reg);
+ if (It != LiveRegs.end() && It->second.any())
+ OS << ' ' << PrintVRegOrUnit(Reg, TRI) << ':'
+ << PrintLaneMask(It->second);
+ }
+ OS << '\n';
+}
#endif
Modified: llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.h?rev=303186&r1=303185&r2=303186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.h (original)
+++ llvm/trunk/lib/Target/AMDGPU/GCNRegPressure.h Tue May 16 11:31:45 2017
@@ -116,6 +116,8 @@ public:
decltype(LiveRegs) moveLiveRegs() {
return std::move(LiveRegs);
}
+ static void printLiveRegs(raw_ostream &OS, const LiveRegSet& LiveRegs,
+ const MachineRegisterInfo &MRI);
};
class GCNUpwardRPTracker : public GCNRPTracker {
Modified: llvm/trunk/lib/Target/AMDGPU/GCNSchedStrategy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/GCNSchedStrategy.cpp?rev=303186&r1=303185&r2=303186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/GCNSchedStrategy.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/GCNSchedStrategy.cpp Tue May 16 11:31:45 2017
@@ -337,21 +337,12 @@ void GCNScheduleDAGMILive::schedule() {
if (LIS) {
PressureBefore = Pressure[RegionIdx];
- DEBUG(const SIRegisterInfo *SRI = static_cast<const SIRegisterInfo*>(TRI);
- dbgs() << "Pressure before scheduling:\nRegion live-ins:";
- for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
- unsigned Reg = TargetRegisterInfo::index2VirtReg(I);
- auto It = LiveIns[RegionIdx].find(Reg);
- if (It != LiveIns[RegionIdx].end() && It->second.any())
- dbgs() << ' ' << PrintVRegOrUnit(Reg, SRI) << ':'
- << PrintLaneMask(It->second);
- }
- auto P = llvm::getRegPressure(MRI, LiveIns[RegionIdx]);
- dbgs() << "\nLive-in pressure:\nSGPR = " << P.getSGPRNum()
- << "\nVGPR = " << P.getVGPRNum()
- << "\nReal region's register pressure:\nSGPR = "
- << PressureBefore.getSGPRNum()
- << "\nVGPR = " << PressureBefore.getVGPRNum() << '\n');
+ DEBUG(dbgs() << "Pressure before scheduling:\nRegion live-ins:";
+ GCNRPTracker::printLiveRegs(dbgs(), LiveIns[RegionIdx], MRI);
+ dbgs() << "Region live-in pressure: ";
+ llvm::getRegPressure(MRI, LiveIns[RegionIdx]).print(dbgs());
+ dbgs() << "Region register pressure: ";
+ PressureBefore.print(dbgs()));
}
ScheduleDAGMILive::schedule();
@@ -364,9 +355,7 @@ void GCNScheduleDAGMILive::schedule() {
GCNMaxOccupancySchedStrategy &S = (GCNMaxOccupancySchedStrategy&)*SchedImpl;
auto PressureAfter = getRealRegPressure();
- DEBUG(dbgs() << "Pressure after scheduling:\nSGPR = "
- << PressureAfter.getSGPRNum()
- << "\nVGPR = " << PressureAfter.getVGPRNum() << '\n');
+ DEBUG(dbgs() << "Pressure after scheduling: "; PressureAfter.print(dbgs()));
if (PressureAfter.getSGPRNum() <= S.SGPRCriticalLimit &&
PressureAfter.getVGPRNum() <= S.VGPRCriticalLimit) {
More information about the llvm-commits
mailing list