class GenericScheduler

Declaration

class GenericScheduler : public GenericSchedulerBase { /* full declaration omitted */ };

Description

GenericScheduler shrinks the unscheduled zone using heuristics to balance the schedule.

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

Inherits from: GenericSchedulerBase

Member Variables

protected llvm::ScheduleDAGMILive* DAG = nullptr
protected llvm::MachineSchedPolicy RegionPolicy
protected llvm::SchedBoundary Top
protected llvm::SchedBoundary Bot
protected llvm::GenericSchedulerBase::SchedCandidate TopCand
Candidate last picked from Top boundary.
protected llvm::GenericSchedulerBase::SchedCandidate BotCand
Candidate last picked from Bot boundary.

Inherited from GenericSchedulerBase:

protected Context
protected SchedModel = nullptr
protected TRI = nullptr
protected Rem

Method Overview

  • public GenericScheduler(const llvm::MachineSchedContext * C)
  • protected void checkAcyclicLatency()
  • public void dumpPolicy() const
  • protected void initCandidate(llvm::GenericSchedulerBase::SchedCandidate & Cand, llvm::SUnit * SU, bool AtTop, const llvm::RegPressureTracker & RPTracker, llvm::RegPressureTracker & TempTracker)
  • public void initPolicy(MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, unsigned int NumRegionInstrs)
  • public void initialize(llvm::ScheduleDAGMI * dag)
  • public llvm::SUnit * pickNode(bool & IsTopNode)
  • protected llvm::SUnit * pickNodeBidirectional(bool & IsTopNode)
  • protected void pickNodeFromQueue(llvm::SchedBoundary & Zone, const llvm::GenericSchedulerBase::CandPolicy & ZonePolicy, const llvm::RegPressureTracker & RPTracker, llvm::GenericSchedulerBase::SchedCandidate & Candidate)
  • public void registerRoots()
  • public void releaseBottomNode(llvm::SUnit * SU)
  • public void releaseTopNode(llvm::SUnit * SU)
  • protected void reschedulePhysReg(llvm::SUnit * SU, bool isTop)
  • public void schedNode(llvm::SUnit * SU, bool IsTopNode)
  • public bool shouldTrackLaneMasks() const
  • public bool shouldTrackPressure() const
  • protected virtual bool tryCandidate(llvm::GenericSchedulerBase::SchedCandidate & Cand, llvm::GenericSchedulerBase::SchedCandidate & TryCand, llvm::SchedBoundary * Zone) const

Inherited from GenericSchedulerBase:

Inherited from MachineSchedStrategy:

Methods

GenericScheduler(
    const llvm::MachineSchedContext* C)

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

Parameters

const llvm::MachineSchedContext* C

void checkAcyclicLatency()

Description

Set IsAcyclicLatencyLimited if the acyclic path is longer than the cyclic critical path by more cycles than it takes to drain the instruction buffer. We estimate an upper bounds on in-flight instructions as: CyclesPerIteration = max( CyclicPath, Loop-Resource-Height ) InFlightIterations = AcyclicPath / CyclesPerIteration InFlightResources = InFlightIterations * LoopResources TODO: Check execution resources in addition to IssueCount.

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

void dumpPolicy() const

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

void initCandidate(
    llvm::GenericSchedulerBase::SchedCandidate&
        Cand,
    llvm::SUnit* SU,
    bool AtTop,
    const llvm::RegPressureTracker& RPTracker,
    llvm::RegPressureTracker& TempTracker)

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

Parameters

llvm::GenericSchedulerBase::SchedCandidate& Cand
llvm::SUnit* SU
bool AtTop
const llvm::RegPressureTracker& RPTracker
llvm::RegPressureTracker& TempTracker

void initPolicy(MachineBasicBlock::iterator Begin,
                MachineBasicBlock::iterator End,
                unsigned int NumRegionInstrs)

Description

Initialize the per-region scheduling policy.

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

Parameters

MachineBasicBlock::iterator Begin
MachineBasicBlock::iterator End
unsigned int NumRegionInstrs

void initialize(llvm::ScheduleDAGMI* dag)

Description

Initialize the strategy after building the DAG for a new region.

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

Parameters

llvm::ScheduleDAGMI* dag

llvm::SUnit* pickNode(bool& IsTopNode)

Description

Pick the best node to balance the schedule. Implements MachineSchedStrategy.

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

Parameters

bool& IsTopNode

llvm::SUnit* pickNodeBidirectional(
    bool& IsTopNode)

Description

Pick the best candidate node from either the top or bottom queue.

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

Parameters

bool& IsTopNode

void pickNodeFromQueue(
    llvm::SchedBoundary& Zone,
    const llvm::GenericSchedulerBase::CandPolicy&
        ZonePolicy,
    const llvm::RegPressureTracker& RPTracker,
    llvm::GenericSchedulerBase::SchedCandidate&
        Candidate)

Description

Pick the best candidate from the 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.

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

Parameters

llvm::SchedBoundary& Zone
const llvm::GenericSchedulerBase::CandPolicy& ZonePolicy
const llvm::RegPressureTracker& RPTracker
llvm::GenericSchedulerBase::SchedCandidate& Candidate

void registerRoots()

Description

Notify this strategy that all roots have been released (including those that depend on EntrySU or ExitSU).

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

void releaseBottomNode(llvm::SUnit* SU)

Description

When all successor dependencies have been resolved, free this node for bottom-up scheduling.

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

Parameters

llvm::SUnit* SU

void releaseTopNode(llvm::SUnit* SU)

Description

When all predecessor dependencies have been resolved, free this node for top-down scheduling.

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

Parameters

llvm::SUnit* SU

void reschedulePhysReg(llvm::SUnit* SU,
                       bool isTop)

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

Parameters

llvm::SUnit* SU
bool isTop

void schedNode(llvm::SUnit* SU, bool IsTopNode)

Description

Update the scheduler's state after scheduling a node. This is the same node that was just returned by pickNode(). However, ScheduleDAGMILive needs to update it's state based on the current cycle before MachineSchedStrategy does. FIXME: Eventually, we may bundle physreg copies rather than rescheduling them here. See comments in biasPhysReg.

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

Parameters

llvm::SUnit* SU
bool IsTopNode

bool shouldTrackLaneMasks() const

Description

Returns true if lanemasks should be tracked. LaneMask tracking is necessary to reorder independent subregister defs for the same vreg. This has to be enabled in combination with shouldTrackPressure().

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

bool shouldTrackPressure() const

Description

Check if pressure tracking is needed before building the DAG and initializing this strategy. Called after initPolicy.

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

virtual bool tryCandidate(
    llvm::GenericSchedulerBase::SchedCandidate&
        Cand,
    llvm::GenericSchedulerBase::SchedCandidate&
        TryCand,
    llvm::SchedBoundary* Zone) const

Description

Apply a set of heuristics to a new candidate. Heuristics are currently hierarchical. This may be more efficient than a graduated cost model because we don't need to evaluate all aspects of the model for each node in the queue. But it's really done to make the heuristics easier to debug and statistically analyze.

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

Parameters

llvm::GenericSchedulerBase::SchedCandidate& Cand
provides the policy and current best candidate.
llvm::GenericSchedulerBase::SchedCandidate& TryCand
refers to the next SUnit candidate, otherwise uninitialized.
llvm::SchedBoundary* Zone
describes the scheduled zone that we are extending, or nullptr if Cand is from a different zone than TryCand.

Returns

\c true if TryCand is better than Cand (Reason is NOT NoCand)