LLVM 20.0.0git
|
#include "llvm/CodeGen/VLIWMachineScheduler.h"
Classes | |
struct | SchedCandidate |
Store the state used by ConvergingVLIWScheduler heuristics, required for the lifetime of one invocation of pickNode(). More... | |
struct | VLIWSchedBoundary |
Each Scheduling boundary is associated with ready queues. More... | |
Public Types | |
enum | { TopQID = 1 , BotQID = 2 , LogMaxQID = 2 } |
SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both) More... | |
Public Member Functions | |
ConvergingVLIWScheduler () | |
virtual | ~ConvergingVLIWScheduler ()=default |
void | initialize (ScheduleDAGMI *dag) override |
Initialize the strategy after building the DAG for a new region. | |
SUnit * | pickNode (bool &IsTopNode) override |
Pick the best node to balance the schedule. Implements MachineSchedStrategy. | |
void | schedNode (SUnit *SU, bool IsTopNode) override |
Update the scheduler's state after scheduling a node. | |
void | releaseTopNode (SUnit *SU) override |
When all predecessor dependencies have been resolved, free this node for top-down scheduling. | |
void | releaseBottomNode (SUnit *SU) override |
When all successor dependencies have been resolved, free this node for bottom-up scheduling. | |
unsigned | reportPackets () |
Public Member Functions inherited from llvm::MachineSchedStrategy | |
virtual | ~MachineSchedStrategy ()=default |
virtual void | initPolicy (MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, unsigned NumRegionInstrs) |
Optionally override the per-region scheduling policy. | |
virtual void | dumpPolicy () const |
virtual bool | shouldTrackPressure () const |
Check if pressure tracking is needed before building the DAG and initializing this strategy. | |
virtual bool | shouldTrackLaneMasks () const |
Returns true if lanemasks should be tracked. | |
virtual bool | doMBBSchedRegionsTopDown () const |
virtual void | initialize (ScheduleDAGMI *DAG)=0 |
Initialize the strategy after building the DAG for a new region. | |
virtual void | enterMBB (MachineBasicBlock *MBB) |
Tell the strategy that MBB is about to be processed. | |
virtual void | leaveMBB () |
Tell the strategy that current MBB is done. | |
virtual void | registerRoots () |
Notify this strategy that all roots have been released (including those that depend on EntrySU or ExitSU). | |
virtual SUnit * | pickNode (bool &IsTopNode)=0 |
Pick the next node to schedule, or return NULL. | |
virtual void | scheduleTree (unsigned SubtreeID) |
Scheduler callback to notify that a new subtree is scheduled. | |
virtual void | schedNode (SUnit *SU, bool IsTopNode)=0 |
Notify MachineSchedStrategy that ScheduleDAGMI has scheduled an instruction and updated scheduled/remaining flags in the DAG nodes. | |
virtual void | releaseTopNode (SUnit *SU)=0 |
When all predecessor dependencies have been resolved, free this node for top-down scheduling. | |
virtual void | releaseBottomNode (SUnit *SU)=0 |
When all successor dependencies have been resolved, free this node for bottom-up scheduling. | |
Protected Types | |
enum | CandResult { NoCand , NodeOrder , SingleExcess , SingleCritical , SingleMax , MultiPressure , BestCost , Weak } |
Represent the type of SchedCandidate found within a single queue. More... | |
Protected Member Functions | |
virtual VLIWResourceModel * | createVLIWResourceModel (const TargetSubtargetInfo &STI, const TargetSchedModel *SchedModel) const |
SUnit * | pickNodeBidrectional (bool &IsTopNode) |
Pick the best candidate node from either the top or bottom queue. | |
int | pressureChange (const SUnit *SU, bool isBotUp) |
Check if the instruction changes the register pressure of a register in the high pressure set. | |
virtual int | SchedulingCost (ReadyQueue &Q, SUnit *SU, SchedCandidate &Candidate, RegPressureDelta &Delta, bool verbose) |
Single point to compute overall scheduling cost. | |
CandResult | pickNodeFromQueue (VLIWSchedBoundary &Zone, const RegPressureTracker &RPTracker, SchedCandidate &Candidate) |
Pick the best candidate from the top queue. | |
void | traceCandidate (const char *Label, const ReadyQueue &Q, SUnit *SU, int Cost, PressureChange P=PressureChange()) |
void | readyQueueVerboseDump (const RegPressureTracker &RPTracker, SchedCandidate &Candidate, ReadyQueue &Q) |
Protected Attributes | |
VLIWMachineScheduler * | DAG = nullptr |
const TargetSchedModel * | SchedModel = nullptr |
VLIWSchedBoundary | Top |
VLIWSchedBoundary | Bot |
SmallVector< bool > | HighPressureSets |
List of pressure sets that have a high pressure level in the region. | |
Static Protected Attributes | |
static constexpr unsigned | PriorityOne = 200 |
static constexpr unsigned | PriorityTwo = 50 |
static constexpr unsigned | PriorityThree = 75 |
static constexpr unsigned | ScaleTwo = 10 |
Definition at line 89 of file VLIWMachineScheduler.h.
anonymous enum |
SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both)
Enumerator | |
---|---|
TopQID | |
BotQID | |
LogMaxQID |
Definition at line 223 of file VLIWMachineScheduler.h.
|
protected |
Represent the type of SchedCandidate found within a single queue.
Enumerator | |
---|---|
NoCand | |
NodeOrder | |
SingleExcess | |
SingleCritical | |
SingleMax | |
MultiPressure | |
BestCost | |
Weak |
Definition at line 106 of file VLIWMachineScheduler.h.
|
inline |
Definition at line 225 of file VLIWMachineScheduler.h.
|
virtualdefault |
|
protectedvirtual |
Reimplemented in llvm::HexagonConvergingVLIWScheduler.
Definition at line 305 of file VLIWMachineScheduler.cpp.
References SchedModel.
Referenced by initialize().
|
overridevirtual |
Initialize the strategy after building the DAG for a new region.
Implements llvm::MachineSchedStrategy.
Definition at line 270 of file VLIWMachineScheduler.cpp.
References assert(), llvm::SmallVectorImpl< T >::assign(), Bot, createVLIWResourceModel(), DAG, llvm::ForceBottomUp, llvm::ForceTopDown, llvm::TargetSubtargetInfo::getInstrInfo(), llvm::TargetSchedModel::getInstrItineraries(), llvm::VLIWMachineScheduler::getRegClassInfo(), llvm::ScheduleDAGMILive::getRegPressure(), llvm::RegisterClassInfo::getRegPressureSetLimit(), llvm::ScheduleDAGInstrs::getSchedModel(), llvm::MachineFunction::getSubtarget(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::HazardRec, HighPressureSets, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::init(), llvm::RegisterPressure::MaxSetPressure, llvm::ScheduleDAG::MF, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::ResourceModel, RPThreshold, SchedModel, TII, and Top.
Pick the best node to balance the schedule. Implements MachineSchedStrategy.
Implements llvm::MachineSchedStrategy.
Definition at line 950 of file VLIWMachineScheduler.cpp.
References assert(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::Available, Bot, llvm::ScheduleDAGMI::bottom(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::CurrCycle, DAG, llvm::dbgs(), llvm::ScheduleDAGInstrs::dumpNode(), llvm::ReadyQueue::empty(), llvm::ForceBottomUp, llvm::ForceTopDown, llvm::ScheduleDAGMILive::getBotRPTracker(), llvm::ScheduleDAGMILive::getTopRPTracker(), llvm::SUnit::isBottomReady(), llvm::SUnit::isTopReady(), LLVM_DEBUG, NoCand, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::Pending, pickNodeBidrectional(), pickNodeFromQueue(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::pickOnlyChoice(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::removeReady(), reportPackets(), llvm::ConvergingVLIWScheduler::SchedCandidate::SU, llvm::ScheduleDAGMI::top(), and Top.
Pick the best candidate node from either the top or bottom queue.
Definition at line 884 of file VLIWMachineScheduler.cpp.
References assert(), Bot, DAG, llvm::dbgs(), llvm::ScheduleDAGMILive::getBotRPTracker(), llvm::ScheduleDAGMILive::getTopRPTracker(), LLVM_DEBUG, NoCand, pickNodeFromQueue(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::pickOnlyChoice(), llvm::ConvergingVLIWScheduler::SchedCandidate::SCost, SingleCritical, SingleExcess, SingleMax, llvm::ConvergingVLIWScheduler::SchedCandidate::SU, and Top.
Referenced by pickNode().
|
protected |
Pick the best candidate from the top queue.
TODO: getMaxPressureDelta results can be mostly cached for each SUnit during DAG building. To adjust for the current scheduling location we need to maintain the number of vreg uses remaining to be top-scheduled.
Definition at line 769 of file VLIWMachineScheduler.cpp.
References llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::Available, llvm::ReadyQueue::begin(), BestCost, BotQID, DAG, llvm::ReadyQueue::dump(), llvm::ReadyQueue::end(), llvm::ReadyQueue::getID(), llvm::ScheduleDAGMILive::getRegionCriticalPSets(), llvm::ScheduleDAGMILive::getRegPressure(), llvm::getWeakLeft(), I, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::isLatencyBound(), LLVM_DEBUG, llvm::RegisterPressure::MaxSetPressure, NoCand, llvm::SUnit::NodeNum, NodeOrder, llvm::SUnit::Preds, readyQueueVerboseDump(), llvm::ConvergingVLIWScheduler::SchedCandidate::RPDelta, SchedDebugVerboseLevel, SchedulingCost(), llvm::ConvergingVLIWScheduler::SchedCandidate::SCost, llvm::ConvergingVLIWScheduler::SchedCandidate::SU, llvm::SUnit::Succs, TopQID, traceCandidate(), UseNewerCandidate, and Weak.
Referenced by pickNode(), and pickNodeBidrectional().
Check if the instruction changes the register pressure of a register in the high pressure set.
The function returns a negative value if the pressure decreases and a positive value is the pressure increases. If the instruction doesn't use a high pressure register or doesn't change the register pressure, then return 0.
Definition at line 580 of file VLIWMachineScheduler.cpp.
References DAG, llvm::ScheduleDAGMILive::getPressureDiff(), HighPressureSets, and P.
Referenced by SchedulingCost().
|
protected |
Definition at line 524 of file VLIWMachineScheduler.cpp.
References llvm::ReadyQueue::begin(), DAG, llvm::dbgs(), llvm::ReadyQueue::end(), llvm::RegPressureTracker::getMaxPressureDelta(), llvm::ReadyQueue::getName(), llvm::ScheduleDAGMILive::getRegionCriticalPSets(), llvm::ScheduleDAGMILive::getRegPressure(), I, llvm::RegisterPressure::MaxSetPressure, and SchedulingCost().
Referenced by pickNodeFromQueue().
|
overridevirtual |
When all successor dependencies have been resolved, free this node for bottom-up scheduling.
Implements llvm::MachineSchedStrategy.
Definition at line 325 of file VLIWMachineScheduler.cpp.
References assert(), Bot, llvm::SUnit::BotReadyCycle, llvm::SUnit::getInstr(), I, llvm::SUnit::isScheduled, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::MaxMinLatency, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::releaseNode(), and llvm::SUnit::Succs.
|
overridevirtual |
When all predecessor dependencies have been resolved, free this node for top-down scheduling.
Implements llvm::MachineSchedStrategy.
Definition at line 310 of file VLIWMachineScheduler.cpp.
References llvm::SDep::getLatency(), llvm::SDep::getSUnit(), llvm::SUnit::isScheduled, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::MaxMinLatency, llvm::SUnit::Preds, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::releaseNode(), Top, and llvm::SUnit::TopReadyCycle.
|
inline |
Definition at line 238 of file VLIWMachineScheduler.h.
References Bot, llvm::VLIWResourceModel::getTotalPackets(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::ResourceModel, and Top.
Referenced by pickNode().
Update the scheduler's state after scheduling a node.
This is the same node that was just returned by pickNode(). However, VLIWMachineScheduler needs to update it's state based on the current cycle before MachineSchedStrategy does.
Implements llvm::MachineSchedStrategy.
Definition at line 999 of file VLIWMachineScheduler.cpp.
References Bot, llvm::SUnit::BotReadyCycle, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::bumpNode(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::CurrCycle, Top, and llvm::SUnit::TopReadyCycle.
|
protectedvirtual |
Single point to compute overall scheduling cost.
TODO: More heuristics will be used soon.
Reimplemented in llvm::HexagonConvergingVLIWScheduler.
Definition at line 596 of file VLIWMachineScheduler.cpp.
References Bot, BotQID, CheckEarlyAvail, llvm::RegPressureDelta::CriticalMax, llvm::RegPressureDelta::CurrentMax, llvm::dbgs(), llvm::RegPressureDelta::Excess, llvm::SUnit::getDepth(), llvm::SUnit::getHeight(), llvm::ReadyQueue::getID(), llvm::SUnit::getInstr(), llvm::SDep::getLatency(), llvm::SDep::getSUnit(), llvm::PressureChange::getUnitInc(), llvm::getWeakLeft(), IgnoreBBRegPressure, llvm::SDep::isAssignedRegDep(), llvm::VLIWResourceModel::isInPacket(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::isLatencyBound(), llvm::MachineInstr::isPseudo(), llvm::VLIWResourceModel::isResourceAvailable(), llvm::SUnit::isScheduled, llvm::SUnit::isScheduleHigh, isSingleUnscheduledPred(), isSingleUnscheduledSucc(), LLVM_DEBUG, llvm::SUnit::Preds, pressureChange(), PriorityOne, PriorityThree, PriorityTwo, llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::ResourceModel, ScaleTwo, llvm::SUnit::Succs, Top, and TopQID.
Referenced by pickNodeFromQueue(), readyQueueVerboseDump(), and llvm::HexagonConvergingVLIWScheduler::SchedulingCost().
|
protected |
Definition at line 510 of file VLIWMachineScheduler.cpp.
References DAG, llvm::dbgs(), llvm::ScheduleDAGInstrs::dumpNode(), llvm::ReadyQueue::getName(), llvm::TargetRegisterInfo::getRegPressureSetName(), P, and llvm::ScheduleDAG::TRI.
Referenced by pickNodeFromQueue().
|
protected |
Definition at line 216 of file VLIWMachineScheduler.h.
Referenced by initialize(), pickNode(), pickNodeBidrectional(), releaseBottomNode(), reportPackets(), schedNode(), SchedulingCost(), and llvm::HexagonConvergingVLIWScheduler::SchedulingCost().
|
protected |
Definition at line 211 of file VLIWMachineScheduler.h.
Referenced by initialize(), pickNode(), pickNodeBidrectional(), pickNodeFromQueue(), pressureChange(), readyQueueVerboseDump(), llvm::HexagonConvergingVLIWScheduler::SchedulingCost(), and traceCandidate().
|
protected |
List of pressure sets that have a high pressure level in the region.
Definition at line 219 of file VLIWMachineScheduler.h.
Referenced by initialize(), and pressureChange().
|
staticconstexprprotected |
Definition at line 119 of file VLIWMachineScheduler.h.
Referenced by SchedulingCost().
|
staticconstexprprotected |
Definition at line 121 of file VLIWMachineScheduler.h.
Referenced by SchedulingCost().
|
staticconstexprprotected |
Definition at line 120 of file VLIWMachineScheduler.h.
Referenced by SchedulingCost(), and llvm::HexagonConvergingVLIWScheduler::SchedulingCost().
|
staticconstexprprotected |
Definition at line 122 of file VLIWMachineScheduler.h.
Referenced by SchedulingCost().
|
protected |
Definition at line 212 of file VLIWMachineScheduler.h.
Referenced by llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::bumpCycle(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::bumpNode(), llvm::ConvergingVLIWScheduler::VLIWSchedBoundary::checkHazard(), createVLIWResourceModel(), llvm::HexagonConvergingVLIWScheduler::createVLIWResourceModel(), and initialize().
|
protected |
Definition at line 215 of file VLIWMachineScheduler.h.
Referenced by initialize(), pickNode(), pickNodeBidrectional(), releaseTopNode(), reportPackets(), schedNode(), SchedulingCost(), and llvm::HexagonConvergingVLIWScheduler::SchedulingCost().