[PATCH] D31434: [AMDGPU] Fix recorded region boundaries in max-occupancy scheduler
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 28 12:42:05 PDT 2017
rampitec created this revision.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, arsenm.
This is incorrect to record region boundaries before scheduling,
it may change after scheduling. As a result second pass may see less
instructions to schedule than it should.
Repository:
rL LLVM
https://reviews.llvm.org/D31434
Files:
lib/Target/AMDGPU/GCNSchedStrategy.cpp
lib/Target/AMDGPU/GCNSchedStrategy.h
Index: lib/Target/AMDGPU/GCNSchedStrategy.h
===================================================================
--- lib/Target/AMDGPU/GCNSchedStrategy.h
+++ lib/Target/AMDGPU/GCNSchedStrategy.h
@@ -75,8 +75,8 @@
unsigned Stage;
// Vecor of regions recorder for later rescheduling
- SmallVector<std::pair<const MachineBasicBlock::iterator,
- const MachineBasicBlock::iterator>, 32> Regions;
+ SmallVector<std::pair<MachineBasicBlock::iterator,
+ MachineBasicBlock::iterator>, 32> Regions;
// Region live-ins.
DenseMap<unsigned, LaneBitmask> LiveIns;
@@ -94,11 +94,6 @@
GCNScheduleDAGMILive(MachineSchedContext *C,
std::unique_ptr<MachineSchedStrategy> S);
- void enterRegion(MachineBasicBlock *bb,
- MachineBasicBlock::iterator begin,
- MachineBasicBlock::iterator end,
- unsigned regioninstrs) override;
-
void schedule() override;
void finalizeSchedule() override;
Index: lib/Target/AMDGPU/GCNSchedStrategy.cpp
===================================================================
--- lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -321,16 +321,6 @@
DEBUG(dbgs() << "Starting occupancy is " << StartingOccupancy << ".\n");
}
-void GCNScheduleDAGMILive::enterRegion(MachineBasicBlock *bb,
- MachineBasicBlock::iterator begin,
- MachineBasicBlock::iterator end,
- unsigned regioninstrs) {
- ScheduleDAGMILive::enterRegion(bb, begin, end, regioninstrs);
-
- if (Stage == 0)
- Regions.push_back(std::make_pair(begin, end));
-}
-
void GCNScheduleDAGMILive::schedule() {
std::vector<MachineInstr*> Unsched;
Unsched.reserve(NumRegionInstrs);
@@ -345,6 +335,9 @@
}
ScheduleDAGMILive::schedule();
+ if (Stage == 0)
+ Regions.push_back(std::make_pair(RegionBegin, RegionEnd));
+
if (!LIS)
return;
@@ -405,6 +398,8 @@
DEBUG(dbgs() << "Scheduling " << *MI);
}
RegionBegin = Unsched.front()->getIterator();
+ if (Stage == 0)
+ Regions.back() = std::make_pair(RegionBegin, RegionEnd);
placeDebugValues();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31434.93274.patch
Type: text/x-patch
Size: 2261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170328/a15f54eb/attachment.bin>
More information about the llvm-commits
mailing list