|
LLVM
7.0.0
|
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 612 of file MachineScheduler.h.
| anonymous enum |
SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both)
| Enumerator | |
|---|---|
| TopQID | |
| BotQID | |
| LogMaxQID | |
Definition at line 615 of file MachineScheduler.h.
Pending queues extend the ready queues with the same ID and the PendingFlag set.
Definition at line 687 of file MachineScheduler.h.
References llvm::cl::init().
| SchedBoundary::~SchedBoundary | ( | ) |
Definition at line 1819 of file MachineScheduler.cpp.
| void SchedBoundary::bumpCycle | ( | unsigned | NextCycle | ) |
Move the boundary of scheduled code by one cycle.
Definition at line 2053 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 2136 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 1936 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 2105 of file MachineScheduler.cpp.
References assert(), llvm::dbgs(), and LLVM_DEBUG.
Referenced by incExecutedResources().
| LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState | ( | ) | const |
Definition at line 2356 of file MachineScheduler.cpp.
References llvm::dbgs(), and llvm::GenericSchedulerBase::SchedCandidate::initResourceDelta().
Definition at line 1981 of file MachineScheduler.cpp.
References llvm::dbgs(), getOtherResourceCount(), LLVM_DEBUG, and llvm::SUnit::NodeNum.
Referenced by checkHazard(), and llvm::GenericSchedulerBase::setPolicy().
|
inline |
Get the scaled count of scheduled micro-ops and resources, including executed resources.
Definition at line 729 of file MachineScheduler.h.
References llvm::TargetSchedModel::getMicroOpFactor().
|
inline |
Number of cycles to issue the instructions scheduled in this zone.
Definition at line 704 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
|
inline |
Micro-ops issued in the current cycle.
Definition at line 707 of file MachineScheduler.h.
Referenced by llvm::GenericScheduler::tryCandidate().
|
inline |
Definition at line 710 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
|
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 738 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 1899 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 1912 of file MachineScheduler.cpp.
Referenced by getLatencyStallCycles().
Definition at line 2002 of file MachineScheduler.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
Referenced by findMaxLatency(), and llvm::GenericSchedulerBase::setPolicy().
Definition at line 723 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 715 of file MachineScheduler.h.
References llvm::max().
Referenced by llvm::tryLatency().
Definition at line 719 of file MachineScheduler.h.
References llvm::SUnit::getDepth(), and llvm::SUnit::getHeight().
|
inline |
Definition at line 743 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
Definition at line 2091 of file MachineScheduler.cpp.
References countResource().
| void SchedBoundary::init | ( | ScheduleDAGMI * | dag, |
| const TargetSchedModel * | smodel, | ||
| SchedRemainder * | rem | ||
| ) |
Definition at line 1881 of file MachineScheduler.cpp.
References InvalidCycle.
Referenced by llvm::SchedRemainder::init().
|
inline |
Definition at line 746 of file MachineScheduler.h.
Referenced by llvm::GenericSchedulerBase::setPolicy().
|
inline |
Definition at line 699 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 2321 of file MachineScheduler.cpp.
References I, and LLVM_DEBUG.
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize(), and llvm::GCNMaxOccupancySchedStrategy::pickNode().
Definition at line 2028 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 2277 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 2309 of file MachineScheduler.cpp.
References assert().
Referenced by llvm::GCNMaxOccupancySchedStrategy::pickNode().
| void SchedBoundary::reset | ( | ) |
Definition at line 1828 of file MachineScheduler.cpp.
References assert(), llvm::SchedRemainder::init(), and llvm::max().
| ReadyQueue llvm::SchedBoundary::Available |
Definition at line 625 of file MachineScheduler.h.
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize(), llvm::GCNMaxOccupancySchedStrategy::pickNode(), llvm::GenericScheduler::pickNodeFromQueue(), and llvm::GenericSchedulerBase::setPolicy().
| ScheduleDAGMI* llvm::SchedBoundary::DAG = nullptr |
Definition at line 621 of file MachineScheduler.h.
Referenced by llvm::GCNMaxOccupancySchedStrategy::initialize().
| ScheduleHazardRecognizer* llvm::SchedBoundary::HazardRec = nullptr |
Definition at line 628 of file MachineScheduler.h.
| ReadyQueue llvm::SchedBoundary::Pending |
Definition at line 626 of file MachineScheduler.h.
Referenced by llvm::GCNMaxOccupancySchedStrategy::pickNode(), and llvm::GenericSchedulerBase::setPolicy().
| SchedRemainder* llvm::SchedBoundary::Rem = nullptr |
Definition at line 623 of file MachineScheduler.h.
| const TargetSchedModel* llvm::SchedBoundary::SchedModel = nullptr |
Definition at line 622 of file MachineScheduler.h.
1.8.13