LLVM
8.0.1
|
Each Scheduling boundary is associated with ready queues. More...
#include "llvm/CodeGen/MachineScheduler.h"
Public Types | |
enum | { TopQID = 1, BotQID = 2, LogMaxQID = 2 } |
SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both) More... | |
Public Member Functions | |
SchedBoundary (unsigned ID, const Twine &Name) | |
Pending queues extend the ready queues with the same ID and the PendingFlag set. More... | |
~SchedBoundary () | |
void | reset () |
void | init (ScheduleDAGMI *dag, const TargetSchedModel *smodel, SchedRemainder *rem) |
bool | isTop () const |
unsigned | getCurrCycle () const |
Number of cycles to issue the instructions scheduled in this zone. More... | |
unsigned | getCurrMOps () const |
Micro-ops issued in the current cycle. More... | |
unsigned | getDependentLatency () const |
unsigned | getScheduledLatency () const |
Get the number of latency cycles "covered" by the scheduled instructions. More... | |
unsigned | getUnscheduledLatency (SUnit *SU) const |
unsigned | getResourceCount (unsigned ResIdx) const |
unsigned | getCriticalCount () const |
Get the scaled count of scheduled micro-ops and resources, including executed resources. More... | |
unsigned | getExecutedCount () const |
Get a scaled count for the minimum execution time of the scheduled micro-ops that are ready to execute by getExecutedCount. More... | |
unsigned | getZoneCritResIdx () const |
bool | isResourceLimited () const |
unsigned | getLatencyStallCycles (SUnit *SU) |
Get the difference between the given SUnit's ready time and the current cycle. More... | |
unsigned | getNextResourceCycle (unsigned PIdx, unsigned Cycles) |
Compute the next cycle at which the given processor resource can be scheduled. More... | |
bool | checkHazard (SUnit *SU) |
Does this SU have a hazard within the current instruction group. More... | |
unsigned | findMaxLatency (ArrayRef< SUnit *> ReadySUs) |
unsigned | getOtherResourceCount (unsigned &OtherCritIdx) |
void | releaseNode (SUnit *SU, unsigned ReadyCycle) |
void | bumpCycle (unsigned NextCycle) |
Move the boundary of scheduled code by one cycle. More... | |
void | incExecutedResources (unsigned PIdx, unsigned Count) |
unsigned | countResource (unsigned PIdx, unsigned Cycles, unsigned ReadyCycle) |
Add the given processor resource to this scheduled zone. More... | |
void | bumpNode (SUnit *SU) |
Move the boundary of scheduled code by one SUnit. More... | |
void | releasePending () |
Release pending ready nodes in to the available queue. More... | |
void | removeReady (SUnit *SU) |
Remove SU from the ready set for this boundary. More... | |
SUnit * | pickOnlyChoice () |
Call this before applying any other heuristics to the Available queue. More... | |
void | dumpScheduledState () const |
Public Attributes | |
ScheduleDAGMI * | DAG = nullptr |
const TargetSchedModel * | SchedModel = nullptr |
SchedRemainder * | Rem = nullptr |
ReadyQueue | Available |
ReadyQueue | Pending |
ScheduleHazardRecognizer * | HazardRec = nullptr |
Each Scheduling boundary is associated with ready queues.
It tracks the current cycle in the direction of movement, and maintains the state of "hazards" and other interlocks at the current cycle.
Definition at line 619 of file MachineScheduler.h.
anonymous enum |
SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both)
Enumerator | |
---|---|
TopQID | |
BotQID | |
LogMaxQID |
Definition at line 622 of file MachineScheduler.h.
Pending queues extend the ready queues with the same ID and the PendingFlag set.
Definition at line 694 of file MachineScheduler.h.
References llvm::cl::init().
SchedBoundary::~SchedBoundary | ( | ) |
Definition at line 1856 of file MachineScheduler.cpp.
void SchedBoundary::bumpCycle | ( | unsigned | NextCycle | ) |
Move the boundary of scheduled code by one cycle.
Definition at line 2090 of file MachineScheduler.cpp.
References assert(), checkResourceLimit(), llvm::dbgs(), LLVM_DEBUG, and llvm::max().
void SchedBoundary::bumpNode | ( | SUnit * | SU | ) |
Move the boundary of scheduled code by one SUnit.
Definition at line 2173 of file MachineScheduler.cpp.
References assert(), llvm::SUnit::BotReadyCycle, checkResourceLimit(), llvm::dbgs(), llvm::SUnit::getDepth(), llvm::SUnit::getHeight(), llvm::SUnit::getInstr(), llvm::ScheduleDAGInstrs::getSchedClass(), llvm::SUnit::hasReservedResource, llvm::SUnit::isCall, llvm::SUnit::isUnbuffered, LLVM_DEBUG, llvm::max(), llvm::SUnit::NodeNum, llvm::PPCISD::SC, and llvm::SUnit::TopReadyCycle.
Does this SU have a hazard within the current instruction group.
The scheduler supports two modes of hazard recognition. The first is the ScheduleHazardRecognizer API. It is a fully general hazard recognizer that supports highly complicated in-order reservation tables (ScoreboardHazardRecognizer) and arbitrary target-specific logic.
The second is a streamlined mechanism that checks for hazards based on simple counters that the scheduler itself maintains. It explicitly checks for instruction dispatch limitations, including the number of micro-ops that can dispatch per cycle.
TODO: Also check whether the SU must start a new group.
Definition at line 1973 of file MachineScheduler.cpp.
References llvm::dbgs(), findMaxLatency(), llvm::SUnit::getInstr(), llvm::ScheduleDAGInstrs::getSchedClass(), llvm::SUnit::hasReservedResource, LLVM_DEBUG, llvm::make_range(), llvm::max(), llvm::SUnit::NodeNum, llvm::ScheduleHazardRecognizer::NoHazard, and llvm::PPCISD::SC.
Add the given processor resource to this scheduled zone.
Cycles | indicates the number of consecutive (non-pipelined) cycles during which this resource is consumed. |
Definition at line 2142 of file MachineScheduler.cpp.
References assert(), llvm::dbgs(), and LLVM_DEBUG.
Referenced by incExecutedResources().
LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState | ( | ) | const |
Definition at line 2393 of file MachineScheduler.cpp.
References llvm::dbgs(), and llvm::GenericSchedulerBase::SchedCandidate::initResourceDelta().
Definition at line 2018 of file MachineScheduler.cpp.
References llvm::dbgs(), getOtherResourceCount(), LLVM_DEBUG, and llvm::SUnit::NodeNum.
Referenced by checkHazard(), and computeRemLatency().
|
inline |
Get the scaled count of scheduled micro-ops and resources, including executed resources.
Definition at line 736 of file MachineScheduler.h.
References llvm::TargetSchedModel::getMicroOpFactor().
|
inline |
Number of cycles to issue the instructions scheduled in this zone.
Definition at line 711 of file MachineScheduler.h.
Referenced by computeRemLatency(), and llvm::GenericSchedulerBase::setPolicy().
|
inline |
Micro-ops issued in the current cycle.
Definition at line 714 of file MachineScheduler.h.
Referenced by llvm::GenericScheduler::tryCandidate().
|
inline |
Definition at line 717 of file MachineScheduler.h.
Referenced by computeRemLatency().
|
inline |
Get a scaled count for the minimum execution time of the scheduled micro-ops that are ready to execute by getExecutedCount.
Notice the feedback loop.
Definition at line 745 of file MachineScheduler.h.
References llvm::TargetSchedModel::getLatencyFactor(), and llvm::max().
Get the difference between the given SUnit's ready time and the current cycle.
Compute the stall cycles based on this SUnit's ready time.
Heuristics treat these "soft stalls" differently than the hard stall cycles based on CPU resources and computed by checkHazard(). A fully in-order model (MicroOpBufferSize==0) will not make use of this since instructions are not available for scheduling until they are ready. However, a weaker in-order model may use this for heuristics. For example, if a processor has in-order behavior when reading certain resources, this may come into play.
Definition at line 1936 of file MachineScheduler.cpp.
References llvm::SUnit::BotReadyCycle, getNextResourceCycle(), llvm::SUnit::isUnbuffered, and llvm::SUnit::TopReadyCycle.
Referenced by llvm::GenericScheduler::tryCandidate().
Compute the next cycle at which the given processor resource can be scheduled.
Definition at line 1949 of file MachineScheduler.cpp.
Referenced by getLatencyStallCycles().
Definition at line 2039 of file MachineScheduler.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
Referenced by findMaxLatency(), and llvm::GenericSchedulerBase::setPolicy().
Definition at line 730 of file MachineScheduler.h.
|
inline |
Get the number of latency cycles "covered" by the scheduled instructions.
This is the larger of the critical path within the zone and the number of cycles required to issue the instructions.
Definition at line 722 of file MachineScheduler.h.
References llvm::max().
Referenced by llvm::tryLatency().
Definition at line 726 of file MachineScheduler.h.
References llvm::SUnit::getDepth(), and llvm::SUnit::getHeight().
|
inline |
Definition at line 750 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
Definition at line 2128 of file MachineScheduler.cpp.
References countResource().
void SchedBoundary::init | ( | ScheduleDAGMI * | dag, |
const TargetSchedModel * | smodel, | ||
SchedRemainder * | rem | ||
) |
Definition at line 1918 of file MachineScheduler.cpp.
References InvalidCycle.
Referenced by llvm::SchedRemainder::init().
|
inline |
Definition at line 753 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
|
inline |
Definition at line 706 of file MachineScheduler.h.
References llvm::ReadyQueue::getID().
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize(), llvm::GenericScheduler::pickNodeFromQueue(), llvm::GenericScheduler::tryCandidate(), and llvm::tryLatency().
SUnit * SchedBoundary::pickOnlyChoice | ( | ) |
Call this before applying any other heuristics to the Available queue.
If this queue only has one ready candidate, return it.
Updates the Available/Pending Q's if necessary and returns the single available instruction, or NULL if there are multiple candidates.
As a side effect, defer any nodes that now hit a hazard, and advance the cycle until at least one node is ready. If multiple instructions are ready, return NULL.
Definition at line 2358 of file MachineScheduler.cpp.
References I, and LLVM_DEBUG.
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize(), and llvm::GCNMaxOccupancySchedStrategy::pickNode().
Definition at line 2065 of file MachineScheduler.cpp.
References assert(), llvm::SUnit::getInstr(), llvm::max(), and ReadyListLimit.
Referenced by llvm::PostGenericScheduler::releaseTopNode().
void SchedBoundary::releasePending | ( | ) |
Release pending ready nodes in to the available queue.
This makes them visible to heuristics.
Definition at line 2314 of file MachineScheduler.cpp.
References llvm::SUnit::BotReadyCycle, llvm::max(), ReadyListLimit, and llvm::SUnit::TopReadyCycle.
void SchedBoundary::removeReady | ( | SUnit * | SU | ) |
Remove SU from the ready set for this boundary.
Definition at line 2346 of file MachineScheduler.cpp.
References assert().
Referenced by llvm::GCNMaxOccupancySchedStrategy::pickNode().
void SchedBoundary::reset | ( | ) |
Definition at line 1865 of file MachineScheduler.cpp.
References assert(), llvm::SchedRemainder::init(), and llvm::max().
ReadyQueue llvm::SchedBoundary::Available |
Definition at line 632 of file MachineScheduler.h.
Referenced by computeRemLatency(), llvm::GCNMaxOccupancySchedStrategy::initialize(), llvm::GCNMaxOccupancySchedStrategy::pickNode(), llvm::GenericScheduler::pickNodeFromQueue(), and llvm::GenericSchedulerBase::setPolicy().
ScheduleDAGMI* llvm::SchedBoundary::DAG = nullptr |
Definition at line 628 of file MachineScheduler.h.
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize().
ScheduleHazardRecognizer* llvm::SchedBoundary::HazardRec = nullptr |
Definition at line 635 of file MachineScheduler.h.
ReadyQueue llvm::SchedBoundary::Pending |
Definition at line 633 of file MachineScheduler.h.
Referenced by computeRemLatency(), and llvm::GCNMaxOccupancySchedStrategy::pickNode().
SchedRemainder* llvm::SchedBoundary::Rem = nullptr |
Definition at line 630 of file MachineScheduler.h.
const TargetSchedModel* llvm::SchedBoundary::SchedModel = nullptr |
Definition at line 629 of file MachineScheduler.h.