class SchedBoundary

Declaration

class SchedBoundary { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:611

Member Variables

public llvm::ScheduleDAGMI* DAG = nullptr
public const llvm::TargetSchedModel* SchedModel = nullptr
public llvm::SchedRemainder* Rem = nullptr
public llvm::ReadyQueue Available
public llvm::ReadyQueue Pending
public llvm::ScheduleHazardRecognizer* HazardRec = nullptr
private bool CheckPending
True if the pending Q should be checked/updated before scheduling another instruction.
private unsigned int CurrCycle
Number of cycles it takes to issue the instructions scheduled in this zone. It is defined as: scheduled-micro-ops / issue-width + stalls. See getStalls().
private unsigned int CurrMOps
Micro-ops issued in the current cycle
private unsigned int MinReadyCycle
MinReadyCycle - Cycle of the soonest available instruction.
private unsigned int ExpectedLatency
private unsigned int DependentLatency
private unsigned int RetiredMOps
Count the scheduled (issued) micro-ops that can be retired by time=CurrCycle assuming the first scheduled instr is retired at time=0.
private SmallVector<unsigned int, 16> ExecutedResCounts
private unsigned int MaxExecutedResCount
Cache the max count for a single resource.
private unsigned int ZoneCritResIdx
private bool IsResourceLimited
private SmallVector<unsigned int, 16> ReservedCycles
private SmallVector<unsigned int, 16> ReservedCyclesIndex
private SmallVector<llvm::APInt, 16> ResourceGroupSubUnitMasks

Method Overview

Methods

SchedBoundary(unsigned int ID,
              const llvm::Twine& Name)

Description

Pending queues extend the ready queues with the same ID and the PendingFlag set.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:693

Parameters

unsigned int ID
const llvm::Twine& Name

void bumpCycle(unsigned int NextCycle)

Description

Move the boundary of scheduled code by one cycle.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:787

Parameters

unsigned int NextCycle

void bumpNode(llvm::SUnit* SU)

Description

Move the boundary of scheduled code by one SUnit.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:794

Parameters

llvm::SUnit* SU

bool checkHazard(llvm::SUnit* SU)

Description

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.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:770

Parameters

llvm::SUnit* SU

unsigned int countResource(
    const llvm::MCSchedClassDesc* SC,
    unsigned int PIdx,
    unsigned int Cycles,
    unsigned int ReadyCycle)

Description

Add the given processor resource to this scheduled zone.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:791

Parameters

const llvm::MCSchedClassDesc* SC
unsigned int PIdx
unsigned int Cycles
indicates the number of consecutive (non-pipelined) cycles during which this resource is consumed.
unsigned int ReadyCycle

Returns

the next cycle at which the instruction may execute without oversubscribing resources.

void dumpScheduledState() const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:805

unsigned int findMaxLatency(
    ArrayRef<llvm::SUnit*> ReadySUs)

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:772

Parameters

ArrayRef<llvm::SUnit*> ReadySUs

unsigned int getCriticalCount() const

Description

Get the scaled count of scheduled micro-ops and resources, including executed resources.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:735

unsigned int getCurrCycle() const

Description

Number of cycles to issue the instructions scheduled in this zone.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:710

unsigned int getCurrMOps() const

Description

Micro-ops issued in the current cycle

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:713

unsigned int getDependentLatency() const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:716

unsigned int getExecutedCount() const

Description

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.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:744

unsigned int getLatencyStallCycles(
    llvm::SUnit* SU)

Description

Get the difference between the given SUnit's ready time and the current cycle.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:756

Parameters

llvm::SUnit* SU

std::pair<unsigned int, unsigned int>
getNextResourceCycle(
    const llvm::MCSchedClassDesc* SC,
    unsigned int PIdx,
    unsigned int Cycles)

Description

Compute the next cycle at which the given processor resource can be scheduled. Returns the next cycle and the index of the processor resource instance in the reserved cycles vector.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:761

Parameters

const llvm::MCSchedClassDesc* SC
unsigned int PIdx
unsigned int Cycles

unsigned int getNextResourceCycleByInstance(
    unsigned int InstanceIndex,
    unsigned int Cycles)

Description

Compute the next cycle at which the given processor resource unit can be scheduled.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:758

Parameters

unsigned int InstanceIndex
unsigned int Cycles

unsigned int getOtherResourceCount(
    unsigned int& OtherCritIdx)

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:774

Parameters

unsigned int& OtherCritIdx

unsigned int getResourceCount(
    unsigned int ResIdx) const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:729

Parameters

unsigned int ResIdx

unsigned int getScheduledLatency() const

Description

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.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:721

unsigned int getUnscheduledLatency(
    llvm::SUnit* SU) const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:725

Parameters

llvm::SUnit* SU

unsigned int getZoneCritResIdx() const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:749

void incExecutedResources(unsigned int PIdx,
                          unsigned int Count)

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:789

Parameters

unsigned int PIdx
unsigned int Count

void init(llvm::ScheduleDAGMI* dag,
          const llvm::TargetSchedModel* smodel,
          llvm::SchedRemainder* rem)

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:702

Parameters

llvm::ScheduleDAGMI* dag
const llvm::TargetSchedModel* smodel
llvm::SchedRemainder* rem

bool isResourceLimited() const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:752

bool isTop() const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:705

bool isUnbufferedGroup(unsigned int PIdx) const

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:765

Parameters

unsigned int PIdx

llvm::SUnit* pickOnlyChoice()

Description

Call this before applying any other heuristics to the Available queue. Updates the Available/Pending Q's if necessary and returns the single available instruction, or NULL if there are multiple candidates.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:803

void releaseNode(llvm::SUnit* SU,
                 unsigned int ReadyCycle,
                 bool InPQueue,
                 unsigned int Idx = 0)

Description

Release SU to make it ready. If it's not in hazard, remove it from pending queue (if already in) and push into available queue. Otherwise, push the SU into pending queue.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:784

Parameters

llvm::SUnit* SU
The unit to be released.
unsigned int ReadyCycle
Until which cycle the unit is ready.
bool InPQueue
Whether SU is already in pending queue.
unsigned int Idx = 0
Position offset in pending queue (if in it).

void releasePending()

Description

Release pending ready nodes in to the available queue. This makes them visible to heuristics.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:796

void removeReady(llvm::SUnit* SU)

Description

Remove SU from the ready set for this boundary.

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:798

Parameters

llvm::SUnit* SU

void reset()

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:700

~SchedBoundary()

Declared at: llvm/include/llvm/CodeGen/MachineScheduler.h:698