Skip to content

Commit 0989bff

Browse files
committed
Delete GCNScheduleDAGMILive::RegionsWithMinOcc
1 parent dcf3c79 commit 0989bff

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -939,11 +939,9 @@ void GCNScheduleDAGMILive::finalizeSchedule() {
939939
Pressure.resize(Regions.size());
940940
RegionsWithHighRP.resize(Regions.size());
941941
RegionsWithExcessRP.resize(Regions.size());
942-
RegionsWithMinOcc.resize(Regions.size());
943942
RegionsWithIGLPInstrs.resize(Regions.size());
944943
RegionsWithHighRP.reset();
945944
RegionsWithExcessRP.reset();
946-
RegionsWithMinOcc.reset();
947945
RegionsWithIGLPInstrs.reset();
948946

949947
runSchedStages();
@@ -1093,8 +1091,7 @@ bool PreRARematStage::initGCNSchedStage() {
10931091
// fixed if there is another pass after this pass.
10941092
assert(!S.hasNextStage());
10951093

1096-
if (!GCNSchedStage::initGCNSchedStage() || DAG.RegionsWithMinOcc.none() ||
1097-
DAG.Regions.size() == 1)
1094+
if (!GCNSchedStage::initGCNSchedStage() || DAG.Regions.size() == 1)
10981095
return false;
10991096

11001097
// Before performing any IR modification record the parent region of each MI
@@ -1136,10 +1133,6 @@ void UnclusteredHighRPStage::finalizeGCNSchedStage() {
11361133
SavedMutations.swap(DAG.Mutations);
11371134
S.SGPRLimitBias = S.VGPRLimitBias = 0;
11381135
if (DAG.MinOccupancy > InitialOccupancy) {
1139-
for (unsigned IDX = 0; IDX < DAG.Pressure.size(); ++IDX)
1140-
DAG.RegionsWithMinOcc[IDX] =
1141-
DAG.Pressure[IDX].getOccupancy(DAG.ST) == DAG.MinOccupancy;
1142-
11431136
LLVM_DEBUG(dbgs() << StageID
11441137
<< " stage successfully increased occupancy to "
11451138
<< DAG.MinOccupancy << '\n');
@@ -1211,11 +1204,13 @@ bool GCNSchedStage::initGCNRegion() {
12111204
}
12121205

12131206
bool UnclusteredHighRPStage::initGCNRegion() {
1214-
// Only reschedule regions with the minimum occupancy or regions that may have
1215-
// spilling (excess register pressure).
1216-
if ((!DAG.RegionsWithMinOcc[RegionIdx] ||
1217-
DAG.MinOccupancy <= InitialOccupancy) &&
1218-
!DAG.RegionsWithExcessRP[RegionIdx])
1207+
// Only reschedule regions that have excess register pressure (i.e. spilling)
1208+
// or had minimum occupancy at the beginning of the stage (as long as
1209+
// rescheduling of previous regions did not make occupancy drop back down to
1210+
// the initial minimum).
1211+
if (!DAG.RegionsWithExcessRP[RegionIdx] &&
1212+
(DAG.MinOccupancy <= InitialOccupancy ||
1213+
DAG.Pressure[RegionIdx].getOccupancy(ST) != InitialOccupancy))
12191214
return false;
12201215

12211216
return GCNSchedStage::initGCNRegion();
@@ -1278,8 +1273,6 @@ void GCNSchedStage::checkScheduling() {
12781273
if (PressureAfter.getSGPRNum() <= S.SGPRCriticalLimit &&
12791274
PressureAfter.getVGPRNum(ST.hasGFX90AInsts()) <= S.VGPRCriticalLimit) {
12801275
DAG.Pressure[RegionIdx] = PressureAfter;
1281-
DAG.RegionsWithMinOcc[RegionIdx] =
1282-
PressureAfter.getOccupancy(ST) == DAG.MinOccupancy;
12831276

12841277
// Early out if we have achieved the occupancy target.
12851278
LLVM_DEBUG(dbgs() << "Pressure in desired limits, done.\n");
@@ -1313,7 +1306,6 @@ void GCNSchedStage::checkScheduling() {
13131306
if (NewOccupancy < DAG.MinOccupancy) {
13141307
DAG.MinOccupancy = NewOccupancy;
13151308
MFI.limitOccupancy(DAG.MinOccupancy);
1316-
DAG.RegionsWithMinOcc.reset();
13171309
LLVM_DEBUG(dbgs() << "Occupancy lowered for the function to "
13181310
<< DAG.MinOccupancy << ".\n");
13191311
}
@@ -1335,13 +1327,10 @@ void GCNSchedStage::checkScheduling() {
13351327

13361328
// Revert if this region's schedule would cause a drop in occupancy or
13371329
// spilling.
1338-
if (shouldRevertScheduling(WavesAfter)) {
1330+
if (shouldRevertScheduling(WavesAfter))
13391331
revertScheduling();
1340-
} else {
1332+
else
13411333
DAG.Pressure[RegionIdx] = PressureAfter;
1342-
DAG.RegionsWithMinOcc[RegionIdx] =
1343-
PressureAfter.getOccupancy(ST) == DAG.MinOccupancy;
1344-
}
13451334
}
13461335

13471336
unsigned
@@ -1567,8 +1556,6 @@ bool GCNSchedStage::mayCauseSpilling(unsigned WavesAfter) {
15671556
}
15681557

15691558
void GCNSchedStage::revertScheduling() {
1570-
DAG.RegionsWithMinOcc[RegionIdx] =
1571-
PressureBefore.getOccupancy(ST) == DAG.MinOccupancy;
15721559
LLVM_DEBUG(dbgs() << "Attempting to revert scheduling.\n");
15731560
DAG.RegionEnd = DAG.RegionBegin;
15741561
int SkippedDebugInstr = 0;

llvm/lib/Target/AMDGPU/GCNSchedStrategy.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ class GCNScheduleDAGMILive final : public ScheduleDAGMILive {
250250
// limit. Register pressure in these regions usually will result in spilling.
251251
BitVector RegionsWithExcessRP;
252252

253-
// Regions that has the same occupancy as the latest MinOccupancy
254-
BitVector RegionsWithMinOcc;
255-
256253
// Regions that have IGLP instructions (SCHED_GROUP_BARRIER or IGLP_OPT).
257254
BitVector RegionsWithIGLPInstrs;
258255

0 commit comments

Comments
 (0)