2016-08-29 21:42:52 +02:00
|
|
|
//===-- GCNSchedStrategy.cpp - GCN Scheduler Strategy ---------------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-08-29 21:42:52 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
/// This contains a MachineSchedStrategy implementation for maximizing wave
|
|
|
|
/// occupancy on GCN hardware.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "GCNSchedStrategy.h"
|
|
|
|
#include "SIMachineFunctionInfo.h"
|
|
|
|
|
2017-07-12 00:08:28 +02:00
|
|
|
#define DEBUG_TYPE "machine-scheduler"
|
2016-08-29 21:42:52 +02:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
GCNMaxOccupancySchedStrategy::GCNMaxOccupancySchedStrategy(
|
|
|
|
const MachineSchedContext *C) :
|
2021-02-24 00:26:12 +01:00
|
|
|
GenericScheduler(C), TargetOccupancy(0), HasClusteredNodes(false),
|
2021-02-26 00:03:34 +01:00
|
|
|
HasExcessPressure(false), MF(nullptr) { }
|
2016-08-29 21:42:52 +02:00
|
|
|
|
2017-02-15 18:19:50 +01:00
|
|
|
void GCNMaxOccupancySchedStrategy::initialize(ScheduleDAGMI *DAG) {
|
|
|
|
GenericScheduler::initialize(DAG);
|
|
|
|
|
|
|
|
const SIRegisterInfo *SRI = static_cast<const SIRegisterInfo*>(TRI);
|
|
|
|
|
2017-02-28 20:20:33 +01:00
|
|
|
MF = &DAG->MF;
|
|
|
|
|
2018-07-11 22:59:01 +02:00
|
|
|
const GCNSubtarget &ST = MF->getSubtarget<GCNSubtarget>();
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2017-02-15 18:19:50 +01:00
|
|
|
// FIXME: This is also necessary, because some passes that run after
|
|
|
|
// scheduling and before regalloc increase register pressure.
|
|
|
|
const int ErrorMargin = 3;
|
|
|
|
|
|
|
|
SGPRExcessLimit = Context->RegClassInfo
|
|
|
|
->getNumAllocatableRegs(&AMDGPU::SGPR_32RegClass) - ErrorMargin;
|
|
|
|
VGPRExcessLimit = Context->RegClassInfo
|
|
|
|
->getNumAllocatableRegs(&AMDGPU::VGPR_32RegClass) - ErrorMargin;
|
2017-02-28 20:20:33 +01:00
|
|
|
if (TargetOccupancy) {
|
|
|
|
SGPRCriticalLimit = ST.getMaxNumSGPRs(TargetOccupancy, true);
|
|
|
|
VGPRCriticalLimit = ST.getMaxNumVGPRs(TargetOccupancy);
|
|
|
|
} else {
|
|
|
|
SGPRCriticalLimit = SRI->getRegPressureSetLimit(DAG->MF,
|
2020-02-18 02:22:28 +01:00
|
|
|
AMDGPU::RegisterPressureSets::SReg_32);
|
2017-02-28 20:20:33 +01:00
|
|
|
VGPRCriticalLimit = SRI->getRegPressureSetLimit(DAG->MF,
|
2020-02-18 02:22:28 +01:00
|
|
|
AMDGPU::RegisterPressureSets::VGPR_32);
|
2017-02-28 20:20:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SGPRCriticalLimit -= ErrorMargin;
|
|
|
|
VGPRCriticalLimit -= ErrorMargin;
|
2017-02-15 18:19:50 +01:00
|
|
|
}
|
|
|
|
|
2016-08-29 21:42:52 +02:00
|
|
|
void GCNMaxOccupancySchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU,
|
|
|
|
bool AtTop, const RegPressureTracker &RPTracker,
|
|
|
|
const SIRegisterInfo *SRI,
|
2017-02-15 18:19:50 +01:00
|
|
|
unsigned SGPRPressure,
|
|
|
|
unsigned VGPRPressure) {
|
2016-08-29 21:42:52 +02:00
|
|
|
|
|
|
|
Cand.SU = SU;
|
|
|
|
Cand.AtTop = AtTop;
|
|
|
|
|
|
|
|
// getDownwardPressure() and getUpwardPressure() make temporary changes to
|
2018-01-22 06:54:46 +01:00
|
|
|
// the tracker, so we need to pass those function a non-const copy.
|
2016-08-29 21:42:52 +02:00
|
|
|
RegPressureTracker &TempTracker = const_cast<RegPressureTracker&>(RPTracker);
|
|
|
|
|
2019-09-06 00:44:06 +02:00
|
|
|
Pressure.clear();
|
|
|
|
MaxPressure.clear();
|
2016-08-29 21:42:52 +02:00
|
|
|
|
|
|
|
if (AtTop)
|
|
|
|
TempTracker.getDownwardPressure(SU->getInstr(), Pressure, MaxPressure);
|
|
|
|
else {
|
|
|
|
// FIXME: I think for bottom up scheduling, the register pressure is cached
|
|
|
|
// and can be retrieved by DAG->getPressureDif(SU).
|
|
|
|
TempTracker.getUpwardPressure(SU->getInstr(), Pressure, MaxPressure);
|
|
|
|
}
|
2016-11-01 01:55:14 +01:00
|
|
|
|
2020-02-18 02:22:28 +01:00
|
|
|
unsigned NewSGPRPressure = Pressure[AMDGPU::RegisterPressureSets::SReg_32];
|
|
|
|
unsigned NewVGPRPressure = Pressure[AMDGPU::RegisterPressureSets::VGPR_32];
|
2016-08-29 21:42:52 +02:00
|
|
|
|
|
|
|
// If two instructions increase the pressure of different register sets
|
|
|
|
// by the same amount, the generic scheduler will prefer to schedule the
|
|
|
|
// instruction that increases the set with the least amount of registers,
|
|
|
|
// which in our case would be SGPRs. This is rarely what we want, so
|
|
|
|
// when we report excess/critical register pressure, we do it either
|
|
|
|
// only for VGPRs or only for SGPRs.
|
|
|
|
|
|
|
|
// FIXME: Better heuristics to determine whether to prefer SGPRs or VGPRs.
|
2017-02-15 18:19:50 +01:00
|
|
|
const unsigned MaxVGPRPressureInc = 16;
|
2016-08-29 21:42:52 +02:00
|
|
|
bool ShouldTrackVGPRs = VGPRPressure + MaxVGPRPressureInc >= VGPRExcessLimit;
|
|
|
|
bool ShouldTrackSGPRs = !ShouldTrackVGPRs && SGPRPressure >= SGPRExcessLimit;
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: We have to enter REG-EXCESS before we reach the actual threshold
|
|
|
|
// to increase the likelihood we don't go over the limits. We should improve
|
|
|
|
// the analysis to look through dependencies to find the path with the least
|
|
|
|
// register pressure.
|
|
|
|
|
2019-09-06 22:00:22 +02:00
|
|
|
// We only need to update the RPDelta for instructions that increase register
|
|
|
|
// pressure. Instructions that decrease or keep reg pressure the same will be
|
|
|
|
// marked as RegExcess in tryCandidate() when they are compared with
|
|
|
|
// instructions that increase the register pressure.
|
2016-08-29 21:42:52 +02:00
|
|
|
if (ShouldTrackVGPRs && NewVGPRPressure >= VGPRExcessLimit) {
|
2021-02-26 00:03:34 +01:00
|
|
|
HasExcessPressure = true;
|
2020-02-18 02:22:28 +01:00
|
|
|
Cand.RPDelta.Excess = PressureChange(AMDGPU::RegisterPressureSets::VGPR_32);
|
2016-08-29 21:42:52 +02:00
|
|
|
Cand.RPDelta.Excess.setUnitInc(NewVGPRPressure - VGPRExcessLimit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ShouldTrackSGPRs && NewSGPRPressure >= SGPRExcessLimit) {
|
2021-02-26 00:03:34 +01:00
|
|
|
HasExcessPressure = true;
|
2020-02-18 02:22:28 +01:00
|
|
|
Cand.RPDelta.Excess = PressureChange(AMDGPU::RegisterPressureSets::SReg_32);
|
2017-01-26 11:51:47 +01:00
|
|
|
Cand.RPDelta.Excess.setUnitInc(NewSGPRPressure - SGPRExcessLimit);
|
2016-08-29 21:42:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Register pressure is considered 'CRITICAL' if it is approaching a value
|
|
|
|
// that would reduce the wave occupancy for the execution unit. When
|
|
|
|
// register pressure is 'CRITICAL', increading SGPR and VGPR pressure both
|
|
|
|
// has the same cost, so we don't need to prefer one over the other.
|
|
|
|
|
|
|
|
int SGPRDelta = NewSGPRPressure - SGPRCriticalLimit;
|
|
|
|
int VGPRDelta = NewVGPRPressure - VGPRCriticalLimit;
|
|
|
|
|
|
|
|
if (SGPRDelta >= 0 || VGPRDelta >= 0) {
|
2021-02-26 00:03:34 +01:00
|
|
|
HasExcessPressure = true;
|
2016-08-29 21:42:52 +02:00
|
|
|
if (SGPRDelta > VGPRDelta) {
|
2020-02-18 02:22:28 +01:00
|
|
|
Cand.RPDelta.CriticalMax =
|
|
|
|
PressureChange(AMDGPU::RegisterPressureSets::SReg_32);
|
2016-08-29 21:42:52 +02:00
|
|
|
Cand.RPDelta.CriticalMax.setUnitInc(SGPRDelta);
|
|
|
|
} else {
|
2020-02-18 02:22:28 +01:00
|
|
|
Cand.RPDelta.CriticalMax =
|
|
|
|
PressureChange(AMDGPU::RegisterPressureSets::VGPR_32);
|
2016-08-29 21:42:52 +02:00
|
|
|
Cand.RPDelta.CriticalMax.setUnitInc(VGPRDelta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function is mostly cut and pasted from
|
|
|
|
// GenericScheduler::pickNodeFromQueue()
|
|
|
|
void GCNMaxOccupancySchedStrategy::pickNodeFromQueue(SchedBoundary &Zone,
|
|
|
|
const CandPolicy &ZonePolicy,
|
|
|
|
const RegPressureTracker &RPTracker,
|
|
|
|
SchedCandidate &Cand) {
|
|
|
|
const SIRegisterInfo *SRI = static_cast<const SIRegisterInfo*>(TRI);
|
|
|
|
ArrayRef<unsigned> Pressure = RPTracker.getRegSetPressureAtPos();
|
2020-02-18 02:22:28 +01:00
|
|
|
unsigned SGPRPressure = Pressure[AMDGPU::RegisterPressureSets::SReg_32];
|
|
|
|
unsigned VGPRPressure = Pressure[AMDGPU::RegisterPressureSets::VGPR_32];
|
2016-08-29 21:42:52 +02:00
|
|
|
ReadyQueue &Q = Zone.Available;
|
|
|
|
for (SUnit *SU : Q) {
|
|
|
|
|
|
|
|
SchedCandidate TryCand(ZonePolicy);
|
|
|
|
initCandidate(TryCand, SU, Zone.isTop(), RPTracker, SRI,
|
2017-02-15 18:19:50 +01:00
|
|
|
SGPRPressure, VGPRPressure);
|
2016-08-29 21:42:52 +02:00
|
|
|
// Pass SchedBoundary only when comparing nodes from the same boundary.
|
|
|
|
SchedBoundary *ZoneArg = Cand.AtTop == TryCand.AtTop ? &Zone : nullptr;
|
|
|
|
GenericScheduler::tryCandidate(Cand, TryCand, ZoneArg);
|
|
|
|
if (TryCand.Reason != NoCand) {
|
|
|
|
// Initialize resource delta if needed in case future heuristics query it.
|
|
|
|
if (TryCand.ResDelta == SchedResourceDelta())
|
|
|
|
TryCand.initResourceDelta(Zone.DAG, SchedModel);
|
|
|
|
Cand.setBest(TryCand);
|
2019-09-25 10:45:41 +02:00
|
|
|
LLVM_DEBUG(traceCandidate(Cand));
|
2016-08-29 21:42:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function is mostly cut and pasted from
|
|
|
|
// GenericScheduler::pickNodeBidirectional()
|
|
|
|
SUnit *GCNMaxOccupancySchedStrategy::pickNodeBidirectional(bool &IsTopNode) {
|
|
|
|
// Schedule as far as possible in the direction of no choice. This is most
|
|
|
|
// efficient, but also provides the best heuristics for CriticalPSets.
|
|
|
|
if (SUnit *SU = Bot.pickOnlyChoice()) {
|
|
|
|
IsTopNode = false;
|
|
|
|
return SU;
|
|
|
|
}
|
|
|
|
if (SUnit *SU = Top.pickOnlyChoice()) {
|
|
|
|
IsTopNode = true;
|
|
|
|
return SU;
|
|
|
|
}
|
|
|
|
// Set the bottom-up policy based on the state of the current bottom zone and
|
|
|
|
// the instructions outside the zone, including the top zone.
|
|
|
|
CandPolicy BotPolicy;
|
|
|
|
setPolicy(BotPolicy, /*IsPostRA=*/false, Bot, &Top);
|
|
|
|
// Set the top-down policy based on the state of the current top zone and
|
|
|
|
// the instructions outside the zone, including the bottom zone.
|
|
|
|
CandPolicy TopPolicy;
|
|
|
|
setPolicy(TopPolicy, /*IsPostRA=*/false, Top, &Bot);
|
|
|
|
|
|
|
|
// See if BotCand is still valid (because we previously scheduled from Top).
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Picking from Bot:\n");
|
2016-08-29 21:42:52 +02:00
|
|
|
if (!BotCand.isValid() || BotCand.SU->isScheduled ||
|
|
|
|
BotCand.Policy != BotPolicy) {
|
|
|
|
BotCand.reset(CandPolicy());
|
|
|
|
pickNodeFromQueue(Bot, BotPolicy, DAG->getBotRPTracker(), BotCand);
|
|
|
|
assert(BotCand.Reason != NoCand && "failed to find the first candidate");
|
|
|
|
} else {
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(traceCandidate(BotCand));
|
[AMDGPU] Add VerifyScheduling support.
Summary:
This is cut and pasted from the corresponding GenericScheduler
functions.
Reviewers: arsenm, atrick, tstellar, vpykhtin
Subscribers: MatzeB, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68264
llvm-svn: 373346
2019-10-01 17:45:47 +02:00
|
|
|
#ifndef NDEBUG
|
|
|
|
if (VerifyScheduling) {
|
|
|
|
SchedCandidate TCand;
|
|
|
|
TCand.reset(CandPolicy());
|
|
|
|
pickNodeFromQueue(Bot, BotPolicy, DAG->getBotRPTracker(), TCand);
|
|
|
|
assert(TCand.SU == BotCand.SU &&
|
|
|
|
"Last pick result should correspond to re-picking right now");
|
|
|
|
}
|
|
|
|
#endif
|
2016-08-29 21:42:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the top Q has a better candidate.
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Picking from Top:\n");
|
2016-08-29 21:42:52 +02:00
|
|
|
if (!TopCand.isValid() || TopCand.SU->isScheduled ||
|
|
|
|
TopCand.Policy != TopPolicy) {
|
|
|
|
TopCand.reset(CandPolicy());
|
|
|
|
pickNodeFromQueue(Top, TopPolicy, DAG->getTopRPTracker(), TopCand);
|
|
|
|
assert(TopCand.Reason != NoCand && "failed to find the first candidate");
|
|
|
|
} else {
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(traceCandidate(TopCand));
|
[AMDGPU] Add VerifyScheduling support.
Summary:
This is cut and pasted from the corresponding GenericScheduler
functions.
Reviewers: arsenm, atrick, tstellar, vpykhtin
Subscribers: MatzeB, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68264
llvm-svn: 373346
2019-10-01 17:45:47 +02:00
|
|
|
#ifndef NDEBUG
|
|
|
|
if (VerifyScheduling) {
|
|
|
|
SchedCandidate TCand;
|
|
|
|
TCand.reset(CandPolicy());
|
|
|
|
pickNodeFromQueue(Top, TopPolicy, DAG->getTopRPTracker(), TCand);
|
|
|
|
assert(TCand.SU == TopCand.SU &&
|
|
|
|
"Last pick result should correspond to re-picking right now");
|
|
|
|
}
|
|
|
|
#endif
|
2016-08-29 21:42:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Pick best from BotCand and TopCand.
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Top Cand: "; traceCandidate(TopCand);
|
|
|
|
dbgs() << "Bot Cand: "; traceCandidate(BotCand););
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 16:33:59 +02:00
|
|
|
SchedCandidate Cand = BotCand;
|
|
|
|
TopCand.Reason = NoCand;
|
|
|
|
GenericScheduler::tryCandidate(Cand, TopCand, nullptr);
|
|
|
|
if (TopCand.Reason != NoCand) {
|
|
|
|
Cand.setBest(TopCand);
|
2016-08-29 21:42:52 +02:00
|
|
|
}
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Picking: "; traceCandidate(Cand););
|
2016-08-29 21:42:52 +02:00
|
|
|
|
|
|
|
IsTopNode = Cand.AtTop;
|
|
|
|
return Cand.SU;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function is mostly cut and pasted from
|
|
|
|
// GenericScheduler::pickNode()
|
|
|
|
SUnit *GCNMaxOccupancySchedStrategy::pickNode(bool &IsTopNode) {
|
|
|
|
if (DAG->top() == DAG->bottom()) {
|
|
|
|
assert(Top.Available.empty() && Top.Pending.empty() &&
|
|
|
|
Bot.Available.empty() && Bot.Pending.empty() && "ReadyQ garbage");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
SUnit *SU;
|
|
|
|
do {
|
|
|
|
if (RegionPolicy.OnlyTopDown) {
|
|
|
|
SU = Top.pickOnlyChoice();
|
|
|
|
if (!SU) {
|
|
|
|
CandPolicy NoPolicy;
|
|
|
|
TopCand.reset(NoPolicy);
|
|
|
|
pickNodeFromQueue(Top, NoPolicy, DAG->getTopRPTracker(), TopCand);
|
|
|
|
assert(TopCand.Reason != NoCand && "failed to find a candidate");
|
|
|
|
SU = TopCand.SU;
|
|
|
|
}
|
|
|
|
IsTopNode = true;
|
|
|
|
} else if (RegionPolicy.OnlyBottomUp) {
|
|
|
|
SU = Bot.pickOnlyChoice();
|
|
|
|
if (!SU) {
|
|
|
|
CandPolicy NoPolicy;
|
|
|
|
BotCand.reset(NoPolicy);
|
|
|
|
pickNodeFromQueue(Bot, NoPolicy, DAG->getBotRPTracker(), BotCand);
|
|
|
|
assert(BotCand.Reason != NoCand && "failed to find a candidate");
|
|
|
|
SU = BotCand.SU;
|
|
|
|
}
|
|
|
|
IsTopNode = false;
|
|
|
|
} else {
|
|
|
|
SU = pickNodeBidirectional(IsTopNode);
|
|
|
|
}
|
|
|
|
} while (SU->isScheduled);
|
|
|
|
|
|
|
|
if (SU->isTopReady())
|
|
|
|
Top.removeReady(SU);
|
|
|
|
if (SU->isBottomReady())
|
|
|
|
Bot.removeReady(SU);
|
|
|
|
|
2021-02-24 00:26:12 +01:00
|
|
|
if (!HasClusteredNodes && SU->getInstr()->mayLoadOrStore()) {
|
|
|
|
for (SDep &Dep : SU->Preds) {
|
|
|
|
if (Dep.isCluster()) {
|
|
|
|
HasClusteredNodes = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Scheduling SU(" << SU->NodeNum << ") "
|
|
|
|
<< *SU->getInstr());
|
2016-08-29 21:42:52 +02:00
|
|
|
return SU;
|
|
|
|
}
|
2017-02-15 18:19:50 +01:00
|
|
|
|
2017-02-28 20:20:33 +01:00
|
|
|
GCNScheduleDAGMILive::GCNScheduleDAGMILive(MachineSchedContext *C,
|
|
|
|
std::unique_ptr<MachineSchedStrategy> S) :
|
|
|
|
ScheduleDAGMILive(C, std::move(S)),
|
2018-07-11 22:59:01 +02:00
|
|
|
ST(MF.getSubtarget<GCNSubtarget>()),
|
2017-02-28 20:20:33 +01:00
|
|
|
MFI(*MF.getInfo<SIMachineFunctionInfo>()),
|
2018-05-31 07:36:04 +02:00
|
|
|
StartingOccupancy(MFI.getOccupancy()),
|
2020-01-24 01:18:16 +01:00
|
|
|
MinOccupancy(StartingOccupancy), Stage(Collect), RegionIdx(0) {
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Starting occupancy is " << StartingOccupancy << ".\n");
|
2017-02-28 20:20:33 +01:00
|
|
|
}
|
|
|
|
|
2017-02-15 18:19:50 +01:00
|
|
|
void GCNScheduleDAGMILive::schedule() {
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == Collect) {
|
2017-05-16 18:11:26 +02:00
|
|
|
// Just record regions at the first pass.
|
|
|
|
Regions.push_back(std::make_pair(RegionBegin, RegionEnd));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-15 18:19:50 +01:00
|
|
|
std::vector<MachineInstr*> Unsched;
|
|
|
|
Unsched.reserve(NumRegionInstrs);
|
2017-12-05 04:09:23 +01:00
|
|
|
for (auto &I : *this) {
|
2017-02-15 18:19:50 +01:00
|
|
|
Unsched.push_back(&I);
|
2017-12-05 04:09:23 +01:00
|
|
|
}
|
2017-02-15 18:19:50 +01:00
|
|
|
|
2017-05-16 17:43:52 +02:00
|
|
|
GCNRegPressure PressureBefore;
|
2017-02-28 18:22:39 +01:00
|
|
|
if (LIS) {
|
2017-05-16 18:11:26 +02:00
|
|
|
PressureBefore = Pressure[RegionIdx];
|
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_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()));
|
2017-02-28 18:22:39 +01:00
|
|
|
}
|
|
|
|
|
2021-02-24 00:26:12 +01:00
|
|
|
GCNMaxOccupancySchedStrategy &S = (GCNMaxOccupancySchedStrategy&)*SchedImpl;
|
2021-02-26 00:03:34 +01:00
|
|
|
// Set HasClusteredNodes to true for late stages where we have already
|
|
|
|
// collected it. That way pickNode() will not scan SDep's when not needed.
|
|
|
|
S.HasClusteredNodes = Stage > InitialSchedule;
|
|
|
|
S.HasExcessPressure = false;
|
2017-02-15 18:19:50 +01:00
|
|
|
ScheduleDAGMILive::schedule();
|
2017-05-16 18:11:26 +02:00
|
|
|
Regions[RegionIdx] = std::make_pair(RegionBegin, RegionEnd);
|
2020-01-24 01:18:16 +01:00
|
|
|
RescheduleRegions[RegionIdx] = false;
|
2021-02-26 00:03:34 +01:00
|
|
|
if (Stage == InitialSchedule && S.HasClusteredNodes)
|
|
|
|
RegionsWithClusters[RegionIdx] = true;
|
|
|
|
if (S.HasExcessPressure)
|
|
|
|
RegionsWithHighRP[RegionIdx] = true;
|
2017-03-28 23:48:54 +02:00
|
|
|
|
2017-02-28 18:22:39 +01:00
|
|
|
if (!LIS)
|
|
|
|
return;
|
2017-02-15 18:19:50 +01:00
|
|
|
|
|
|
|
// Check the results of scheduling.
|
2017-02-28 18:22:39 +01:00
|
|
|
auto PressureAfter = getRealRegPressure();
|
2017-05-16 17:43:52 +02:00
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Pressure after scheduling: ";
|
|
|
|
PressureAfter.print(dbgs()));
|
2017-05-16 17:43:52 +02:00
|
|
|
|
|
|
|
if (PressureAfter.getSGPRNum() <= S.SGPRCriticalLimit &&
|
2021-02-17 22:37:46 +01:00
|
|
|
PressureAfter.getVGPRNum(ST.hasGFX90AInsts()) <= S.VGPRCriticalLimit) {
|
2017-05-16 18:11:26 +02:00
|
|
|
Pressure[RegionIdx] = PressureAfter;
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Pressure in desired limits, done.\n");
|
2017-02-15 18:19:50 +01:00
|
|
|
return;
|
|
|
|
}
|
2018-06-04 19:57:40 +02:00
|
|
|
unsigned Occ = MFI.getOccupancy();
|
|
|
|
unsigned WavesAfter = std::min(Occ, PressureAfter.getOccupancy(ST));
|
|
|
|
unsigned WavesBefore = std::min(Occ, PressureBefore.getOccupancy(ST));
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Occupancy before scheduling: " << WavesBefore
|
|
|
|
<< ", after " << WavesAfter << ".\n");
|
2017-02-28 18:22:39 +01:00
|
|
|
|
2017-02-28 20:20:33 +01:00
|
|
|
// We could not keep current target occupancy because of the just scheduled
|
|
|
|
// region. Record new occupancy for next scheduling cycle.
|
|
|
|
unsigned NewOccupancy = std::max(WavesAfter, WavesBefore);
|
2018-05-25 19:25:12 +02:00
|
|
|
// Allow memory bound functions to drop to 4 waves if not limited by an
|
|
|
|
// attribute.
|
|
|
|
if (WavesAfter < WavesBefore && WavesAfter < MinOccupancy &&
|
2018-05-31 07:36:04 +02:00
|
|
|
WavesAfter >= MFI.getMinAllowedOccupancy()) {
|
2018-05-25 19:25:12 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Function is memory bound, allow occupancy drop up to "
|
2018-05-31 07:36:04 +02:00
|
|
|
<< MFI.getMinAllowedOccupancy() << " waves\n");
|
2018-05-25 19:25:12 +02:00
|
|
|
NewOccupancy = WavesAfter;
|
|
|
|
}
|
2017-02-28 20:20:33 +01:00
|
|
|
if (NewOccupancy < MinOccupancy) {
|
|
|
|
MinOccupancy = NewOccupancy;
|
2018-05-31 07:36:04 +02:00
|
|
|
MFI.limitOccupancy(MinOccupancy);
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Occupancy lowered for the function to "
|
|
|
|
<< MinOccupancy << ".\n");
|
2017-02-28 20:20:33 +01:00
|
|
|
}
|
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
unsigned MaxVGPRs = ST.getMaxNumVGPRs(MF);
|
|
|
|
unsigned MaxSGPRs = ST.getMaxNumSGPRs(MF);
|
2021-02-17 22:37:46 +01:00
|
|
|
if (PressureAfter.getVGPRNum(false) > MaxVGPRs ||
|
|
|
|
PressureAfter.getAGPRNum() > MaxVGPRs ||
|
2021-02-26 00:03:34 +01:00
|
|
|
PressureAfter.getSGPRNum() > MaxSGPRs) {
|
2020-01-24 01:18:16 +01:00
|
|
|
RescheduleRegions[RegionIdx] = true;
|
2021-02-26 00:03:34 +01:00
|
|
|
RegionsWithHighRP[RegionIdx] = true;
|
|
|
|
}
|
2020-01-24 01:18:16 +01:00
|
|
|
|
2018-05-25 19:25:12 +02:00
|
|
|
if (WavesAfter >= MinOccupancy) {
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == UnclusteredReschedule &&
|
|
|
|
!PressureAfter.less(ST, PressureBefore)) {
|
|
|
|
LLVM_DEBUG(dbgs() << "Unclustered reschedule did not help.\n");
|
|
|
|
} else if (WavesAfter > MFI.getMinWavesPerEU() ||
|
2020-01-03 22:19:51 +01:00
|
|
|
PressureAfter.less(ST, PressureBefore) ||
|
2020-01-24 01:18:16 +01:00
|
|
|
!RescheduleRegions[RegionIdx]) {
|
2020-01-03 22:19:51 +01:00
|
|
|
Pressure[RegionIdx] = PressureAfter;
|
2021-02-26 00:03:34 +01:00
|
|
|
if (!RegionsWithClusters[RegionIdx] &&
|
|
|
|
(Stage + 1) == UnclusteredReschedule)
|
2021-02-24 00:26:12 +01:00
|
|
|
RescheduleRegions[RegionIdx] = false;
|
2020-01-03 22:19:51 +01:00
|
|
|
return;
|
2020-01-24 01:18:16 +01:00
|
|
|
} else {
|
|
|
|
LLVM_DEBUG(dbgs() << "New pressure will result in more spilling.\n");
|
2020-01-03 22:19:51 +01:00
|
|
|
}
|
2017-05-16 18:11:26 +02:00
|
|
|
}
|
2017-02-15 18:19:50 +01:00
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Attempting to revert scheduling.\n");
|
2021-02-26 00:03:34 +01:00
|
|
|
RescheduleRegions[RegionIdx] = RegionsWithClusters[RegionIdx] ||
|
2021-02-24 00:26:12 +01:00
|
|
|
(Stage + 1) != UnclusteredReschedule;
|
2017-02-15 18:19:50 +01:00
|
|
|
RegionEnd = RegionBegin;
|
|
|
|
for (MachineInstr *MI : Unsched) {
|
2018-05-09 04:42:00 +02:00
|
|
|
if (MI->isDebugInstr())
|
2017-12-05 04:09:23 +01:00
|
|
|
continue;
|
|
|
|
|
2017-02-15 18:19:50 +01:00
|
|
|
if (MI->getIterator() != RegionEnd) {
|
|
|
|
BB->remove(MI);
|
|
|
|
BB->insert(RegionEnd, MI);
|
2018-05-09 04:42:00 +02:00
|
|
|
if (!MI->isDebugInstr())
|
2017-12-15 04:56:57 +01:00
|
|
|
LIS->handleMove(*MI, true);
|
2017-02-28 17:26:27 +01:00
|
|
|
}
|
|
|
|
// Reset read-undef flags and update them later.
|
|
|
|
for (auto &Op : MI->operands())
|
|
|
|
if (Op.isReg() && Op.isDef())
|
|
|
|
Op.setIsUndef(false);
|
|
|
|
RegisterOperands RegOpers;
|
|
|
|
RegOpers.collect(*MI, *TRI, MRI, ShouldTrackLaneMasks, false);
|
2018-05-09 04:42:00 +02:00
|
|
|
if (!MI->isDebugInstr()) {
|
2017-12-15 04:56:57 +01:00
|
|
|
if (ShouldTrackLaneMasks) {
|
|
|
|
// Adjust liveness and add missing dead+read-undef flags.
|
|
|
|
SlotIndex SlotIdx = LIS->getInstructionIndex(*MI).getRegSlot();
|
|
|
|
RegOpers.adjustLaneLiveness(*LIS, MRI, SlotIdx, MI);
|
|
|
|
} else {
|
|
|
|
// Adjust for missing dead-def flags.
|
|
|
|
RegOpers.detectDeadDefs(*MI, *LIS);
|
|
|
|
}
|
2017-02-15 18:19:50 +01:00
|
|
|
}
|
|
|
|
RegionEnd = MI->getIterator();
|
|
|
|
++RegionEnd;
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "Scheduling " << *MI);
|
2017-02-15 18:19:50 +01:00
|
|
|
}
|
|
|
|
RegionBegin = Unsched.front()->getIterator();
|
2017-05-16 18:11:26 +02:00
|
|
|
Regions[RegionIdx] = std::make_pair(RegionBegin, RegionEnd);
|
2017-02-15 18:19:50 +01:00
|
|
|
|
|
|
|
placeDebugValues();
|
|
|
|
}
|
2017-02-28 18:22:39 +01:00
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
GCNRegPressure GCNScheduleDAGMILive::getRealRegPressure() const {
|
2017-05-16 17:43:52 +02:00
|
|
|
GCNDownwardRPTracker RPTracker(*LIS);
|
2017-05-16 18:11:26 +02:00
|
|
|
RPTracker.advance(begin(), end(), &LiveIns[RegionIdx]);
|
|
|
|
return RPTracker.moveMaxPressure();
|
2017-02-28 18:22:39 +01:00
|
|
|
}
|
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
void GCNScheduleDAGMILive::computeBlockPressure(const MachineBasicBlock *MBB) {
|
2017-05-16 17:43:52 +02:00
|
|
|
GCNDownwardRPTracker RPTracker(*LIS);
|
2017-05-16 18:11:26 +02:00
|
|
|
|
|
|
|
// If the block has the only successor then live-ins of that successor are
|
|
|
|
// live-outs of the current block. We can reuse calculated live set if the
|
|
|
|
// successor will be sent to scheduling past current block.
|
|
|
|
const MachineBasicBlock *OnlySucc = nullptr;
|
|
|
|
if (MBB->succ_size() == 1 && !(*MBB->succ_begin())->empty()) {
|
|
|
|
SlotIndexes *Ind = LIS->getSlotIndexes();
|
|
|
|
if (Ind->getMBBStartIdx(MBB) < Ind->getMBBStartIdx(*MBB->succ_begin()))
|
|
|
|
OnlySucc = *MBB->succ_begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Scheduler sends regions from the end of the block upwards.
|
|
|
|
size_t CurRegion = RegionIdx;
|
|
|
|
for (size_t E = Regions.size(); CurRegion != E; ++CurRegion)
|
|
|
|
if (Regions[CurRegion].first->getParent() != MBB)
|
|
|
|
break;
|
|
|
|
--CurRegion;
|
|
|
|
|
|
|
|
auto I = MBB->begin();
|
|
|
|
auto LiveInIt = MBBLiveIns.find(MBB);
|
|
|
|
if (LiveInIt != MBBLiveIns.end()) {
|
|
|
|
auto LiveIn = std::move(LiveInIt->second);
|
|
|
|
RPTracker.reset(*MBB->begin(), &LiveIn);
|
|
|
|
MBBLiveIns.erase(LiveInIt);
|
|
|
|
} else {
|
2019-06-18 13:43:17 +02:00
|
|
|
auto &Rgn = Regions[CurRegion];
|
|
|
|
I = Rgn.first;
|
|
|
|
auto *NonDbgMI = &*skipDebugInstructionsForward(Rgn.first, Rgn.second);
|
|
|
|
auto LRS = BBLiveInMap.lookup(NonDbgMI);
|
2021-02-23 00:02:37 +01:00
|
|
|
#ifdef EXPENSIVE_CHECKS
|
2019-06-18 13:43:17 +02:00
|
|
|
assert(isEqual(getLiveRegsBefore(*NonDbgMI, *LIS), LRS));
|
2021-02-23 00:02:37 +01:00
|
|
|
#endif
|
2019-06-18 13:43:17 +02:00
|
|
|
RPTracker.reset(*I, &LRS);
|
2017-05-16 18:11:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for ( ; ; ) {
|
|
|
|
I = RPTracker.getNext();
|
|
|
|
|
|
|
|
if (Regions[CurRegion].first == I) {
|
|
|
|
LiveIns[CurRegion] = RPTracker.getLiveRegs();
|
|
|
|
RPTracker.clearMaxPressure();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Regions[CurRegion].second == I) {
|
|
|
|
Pressure[CurRegion] = RPTracker.moveMaxPressure();
|
|
|
|
if (CurRegion-- == RegionIdx)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
RPTracker.advanceToNext();
|
|
|
|
RPTracker.advanceBeforeNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OnlySucc) {
|
|
|
|
if (I != MBB->end()) {
|
|
|
|
RPTracker.advanceToNext();
|
|
|
|
RPTracker.advance(MBB->end());
|
|
|
|
}
|
|
|
|
RPTracker.reset(*OnlySucc->begin(), &RPTracker.getLiveRegs());
|
|
|
|
RPTracker.advanceBeforeNext();
|
|
|
|
MBBLiveIns[OnlySucc] = RPTracker.moveLiveRegs();
|
|
|
|
}
|
2017-02-28 18:22:39 +01:00
|
|
|
}
|
|
|
|
|
2019-06-18 13:43:17 +02:00
|
|
|
DenseMap<MachineInstr *, GCNRPTracker::LiveRegSet>
|
|
|
|
GCNScheduleDAGMILive::getBBLiveInMap() const {
|
|
|
|
assert(!Regions.empty());
|
|
|
|
std::vector<MachineInstr *> BBStarters;
|
|
|
|
BBStarters.reserve(Regions.size());
|
|
|
|
auto I = Regions.rbegin(), E = Regions.rend();
|
|
|
|
auto *BB = I->first->getParent();
|
|
|
|
do {
|
|
|
|
auto *MI = &*skipDebugInstructionsForward(I->first, I->second);
|
|
|
|
BBStarters.push_back(MI);
|
|
|
|
do {
|
|
|
|
++I;
|
|
|
|
} while (I != E && I->first->getParent() == BB);
|
|
|
|
} while (I != E);
|
|
|
|
return getLiveRegMap(BBStarters, false /*After*/, *LIS);
|
|
|
|
}
|
|
|
|
|
2017-02-28 18:22:39 +01:00
|
|
|
void GCNScheduleDAGMILive::finalizeSchedule() {
|
2017-05-16 18:11:26 +02:00
|
|
|
GCNMaxOccupancySchedStrategy &S = (GCNMaxOccupancySchedStrategy&)*SchedImpl;
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "All regions recorded, starting actual scheduling.\n");
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
LiveIns.resize(Regions.size());
|
|
|
|
Pressure.resize(Regions.size());
|
2020-01-24 01:18:16 +01:00
|
|
|
RescheduleRegions.resize(Regions.size());
|
2021-02-26 00:03:34 +01:00
|
|
|
RegionsWithClusters.resize(Regions.size());
|
|
|
|
RegionsWithHighRP.resize(Regions.size());
|
2020-01-24 01:18:16 +01:00
|
|
|
RescheduleRegions.set();
|
2021-02-26 00:03:34 +01:00
|
|
|
RegionsWithClusters.reset();
|
|
|
|
RegionsWithHighRP.reset();
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2019-06-18 13:43:17 +02:00
|
|
|
if (!Regions.empty())
|
|
|
|
BBLiveInMap = getBBLiveInMap();
|
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
std::vector<std::unique_ptr<ScheduleDAGMutation>> SavedMutations;
|
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
do {
|
|
|
|
Stage++;
|
|
|
|
RegionIdx = 0;
|
|
|
|
MachineBasicBlock *MBB = nullptr;
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage > InitialSchedule) {
|
|
|
|
if (!LIS)
|
|
|
|
break;
|
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
// Retry function scheduling if we found resulting occupancy and it is
|
|
|
|
// lower than used for first pass scheduling. This will give more freedom
|
|
|
|
// to schedule low register pressure blocks.
|
|
|
|
// Code is partially copied from MachineSchedulerBase::scheduleRegions().
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == UnclusteredReschedule) {
|
|
|
|
if (RescheduleRegions.none())
|
|
|
|
continue;
|
|
|
|
LLVM_DEBUG(dbgs() <<
|
|
|
|
"Retrying function scheduling without clustering.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Stage == ClusteredLowOccupancyReschedule) {
|
|
|
|
if (StartingOccupancy <= MinOccupancy)
|
|
|
|
break;
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
LLVM_DEBUG(
|
|
|
|
dbgs()
|
|
|
|
<< "Retrying function scheduling with lowest recorded occupancy "
|
|
|
|
<< MinOccupancy << ".\n");
|
2017-05-16 18:11:26 +02:00
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
S.setTargetOccupancy(MinOccupancy);
|
|
|
|
}
|
2017-02-28 20:20:33 +01:00
|
|
|
}
|
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == UnclusteredReschedule)
|
|
|
|
SavedMutations.swap(Mutations);
|
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
for (auto Region : Regions) {
|
2021-02-26 00:03:34 +01:00
|
|
|
if ((Stage == UnclusteredReschedule && !RescheduleRegions[RegionIdx]) ||
|
|
|
|
(Stage == ClusteredLowOccupancyReschedule &&
|
|
|
|
!RegionsWithClusters[RegionIdx] && !RegionsWithHighRP[RegionIdx])) {
|
|
|
|
|
2020-08-07 05:46:27 +02:00
|
|
|
++RegionIdx;
|
2020-01-24 01:18:16 +01:00
|
|
|
continue;
|
2020-08-07 05:46:27 +02:00
|
|
|
}
|
2020-01-24 01:18:16 +01:00
|
|
|
|
2017-05-16 18:11:26 +02:00
|
|
|
RegionBegin = Region.first;
|
|
|
|
RegionEnd = Region.second;
|
|
|
|
|
|
|
|
if (RegionBegin->getParent() != MBB) {
|
|
|
|
if (MBB) finishBlock();
|
|
|
|
MBB = RegionBegin->getParent();
|
|
|
|
startBlock(MBB);
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == InitialSchedule)
|
2017-05-16 18:11:26 +02:00
|
|
|
computeBlockPressure(MBB);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned NumRegionInstrs = std::distance(begin(), end());
|
|
|
|
enterRegion(MBB, begin(), end(), NumRegionInstrs);
|
|
|
|
|
|
|
|
// Skip empty scheduling regions (0 or 1 schedulable instructions).
|
|
|
|
if (begin() == end() || begin() == std::prev(end())) {
|
|
|
|
exitRegion();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-05-14 14:53:11 +02:00
|
|
|
LLVM_DEBUG(dbgs() << "********** MI Scheduling **********\n");
|
|
|
|
LLVM_DEBUG(dbgs() << MF.getName() << ":" << printMBBReference(*MBB) << " "
|
|
|
|
<< MBB->getName() << "\n From: " << *begin()
|
|
|
|
<< " To: ";
|
|
|
|
if (RegionEnd != MBB->end()) dbgs() << *RegionEnd;
|
|
|
|
else dbgs() << "End";
|
|
|
|
dbgs() << " RegionInstrs: " << NumRegionInstrs << '\n');
|
2017-05-16 18:11:26 +02:00
|
|
|
|
|
|
|
schedule();
|
2017-02-28 20:20:33 +01:00
|
|
|
|
|
|
|
exitRegion();
|
2017-05-16 18:11:26 +02:00
|
|
|
++RegionIdx;
|
2017-02-28 20:20:33 +01:00
|
|
|
}
|
2017-05-16 18:11:26 +02:00
|
|
|
finishBlock();
|
2017-02-28 20:20:33 +01:00
|
|
|
|
2020-01-24 01:18:16 +01:00
|
|
|
if (Stage == UnclusteredReschedule)
|
|
|
|
SavedMutations.swap(Mutations);
|
|
|
|
} while (Stage != LastStage);
|
2017-02-28 18:22:39 +01:00
|
|
|
}
|