Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::MCSchedModel Struct Reference

Machine model for scheduling, bundling, and heuristics. More...

#include "llvm/MC/MCSchedule.h"

Public Member Functions

bool hasExtraProcessorInfo () const
unsigned getProcessorID () const
bool hasInstrSchedModel () const
 Does this machine model include instruction-level scheduling.
const MCExtraProcessorInfogetExtraProcessorInfo () const
bool isComplete () const
 Return true if this machine model data for all instructions with a scheduling class (itinerary class or SchedRW list).
bool isOutOfOrder () const
 Return true if machine supports out of order execution.
unsigned getNumProcResourceKinds () const
const MCProcResourceDescgetProcResource (unsigned ProcResourceIdx) const
const MCSchedClassDescgetSchedClassDesc (unsigned SchedClassIdx) const
StringRef getSchedClassName (unsigned SchedClassIdx) const
LLVM_ABI int computeInstrLatency (const MCSubtargetInfo &STI, unsigned SClass) const
LLVM_ABI int computeInstrLatency (const MCSubtargetInfo &STI, const MCInstrInfo &MCII, const MCInst &Inst) const
template<typename MCSubtargetInfo, typename MCInstrInfo, typename InstrItineraryData, typename MCInstOrMachineInstr>
int computeInstrLatency (const MCSubtargetInfo &STI, const MCInstrInfo &MCII, const MCInstOrMachineInstr &Inst, llvm::function_ref< const MCSchedClassDesc *(const MCSchedClassDesc *)> ResolveVariantSchedClass=[](const MCSchedClassDesc *SCDesc) { return SCDesc;}) const
LLVM_ABI double getReciprocalThroughput (const MCSubtargetInfo &STI, const MCInstrInfo &MCII, const MCInst &Inst) const

Static Public Member Functions

static LLVM_ABI int computeInstrLatency (const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
 Returns the latency value for the scheduling class.
static LLVM_ABI double getReciprocalThroughput (const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
static LLVM_ABI double getReciprocalThroughput (unsigned SchedClass, const InstrItineraryData &IID)
static LLVM_ABI unsigned getForwardingDelayCycles (ArrayRef< MCReadAdvanceEntry > Entries, unsigned WriteResourceIdx=0)
 Returns the maximum forwarding delay for register reads dependent on writes of scheduling class WriteResourceIdx.
static LLVM_ABI unsigned getBypassDelayCycles (const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
 Returns the bypass delay cycle for the maximum latency write cycle.

Public Attributes

unsigned IssueWidth
unsigned MicroOpBufferSize
unsigned LoopMicroOpBufferSize
unsigned LoadLatency
unsigned HighLatency
unsigned MispredictPenalty
bool PostRAScheduler
bool CompleteModel
bool EnableIntervals
unsigned ProcID
const MCProcResourceDescProcResourceTable
const MCSchedClassDescSchedClassTable
unsigned NumProcResourceKinds
unsigned NumSchedClasses
const StringTableSchedClassNames
const InstrItineraryInstrItineraries
const MCExtraProcessorInfoExtraProcessorInfo

Static Public Attributes

static const unsigned DefaultIssueWidth = 1
static const unsigned DefaultMicroOpBufferSize = 0
static const unsigned DefaultLoopMicroOpBufferSize = 0
static const unsigned DefaultLoadLatency = 4
static const unsigned DefaultHighLatency = 10
static const unsigned DefaultMispredictPenalty = 10
static LLVM_ABI const MCSchedModel Default
 Returns the default initialized model.

Friends

class InstrItineraryData

Detailed Description

Machine model for scheduling, bundling, and heuristics.

The machine model directly provides basic information about the microarchitecture to the scheduler in the form of properties. It also optionally refers to scheduler resource tables and itinerary tables. Scheduler resource tables model the latency and cost for each instruction type. Itinerary tables are an independent mechanism that provides a detailed reservation table describing each cycle of instruction execution. Subtargets may define any or all of the above categories of data depending on the type of CPU and selected scheduler.

The machine independent properties defined here are used by the scheduler as an abstract machine model. A real micro-architecture has a number of buffers, queues, and stages. Declaring that a given machine-independent abstract property corresponds to a specific physical property across all subtargets can't be done. Nonetheless, the abstract model is useful. Futhermore, subtargets typically extend this model with processor specific resources to model any hardware features that can be exploited by scheduling heuristics and aren't sufficiently represented in the abstract.

The abstract pipeline is built around the notion of an "issue point". This is merely a reference point for counting machine cycles. The physical machine will have pipeline stages that delay execution. The scheduler does not model those delays because they are irrelevant as long as they are consistent. Inaccuracies arise when instructions have different execution delays relative to each other, in addition to their intrinsic latency. Those special cases can be handled by TableGen constructs such as, ReadAdvance, which reduces latency when reading data, and ReleaseAtCycles, which consumes a processor resource when writing data for a number of abstract cycles.

TODO: One tool currently missing is the ability to add a delay to ReleaseAtCycles. That would be easy to add and would likely cover all cases currently handled by the legacy itinerary tables.

A note on out-of-order execution and, more generally, instruction buffers. Part of the CPU pipeline is always in-order. The issue point, which is the point of reference for counting cycles, only makes sense as an in-order part of the pipeline. Other parts of the pipeline are sometimes falling behind and sometimes catching up. It's only interesting to model those other, decoupled parts of the pipeline if they may be predictably resource constrained in a way that the scheduler can exploit.

The LLVM machine model distinguishes between in-order constraints and out-of-order constraints so that the target's scheduling strategy can apply appropriate heuristics. For a well-balanced CPU pipeline, out-of-order resources would not typically be treated as a hard scheduling constraint. For example, in the GenericScheduler, a delay caused by limited out-of-order resources is not directly reflected in the number of cycles that the scheduler sees between issuing an instruction and its dependent instructions. In other words, out-of-order resources don't directly increase the latency between pairs of instructions. However, they can still be used to detect potential bottlenecks across a sequence of instructions and bias the scheduling heuristics appropriately.

Definition at line 258 of file MCSchedule.h.

Member Function Documentation

◆ computeInstrLatency() [1/4]

int MCSchedModel::computeInstrLatency ( const MCSubtargetInfo & STI,
const MCInstrInfo & MCII,
const MCInst & Inst ) const

◆ computeInstrLatency() [2/4]

◆ computeInstrLatency() [3/4]

◆ computeInstrLatency() [4/4]

int MCSchedModel::computeInstrLatency ( const MCSubtargetInfo & STI,
unsigned SClass ) const

◆ getBypassDelayCycles()

◆ getExtraProcessorInfo()

const MCExtraProcessorInfo & llvm::MCSchedModel::getExtraProcessorInfo ( ) const
inline

◆ getForwardingDelayCycles()

unsigned MCSchedModel::getForwardingDelayCycles ( ArrayRef< MCReadAdvanceEntry > Entries,
unsigned WriteResourceIdx = 0 )
static

Returns the maximum forwarding delay for register reads dependent on writes of scheduling class WriteResourceIdx.

Definition at line 167 of file MCSchedule.cpp.

References llvm::ArrayRef< T >::empty().

◆ getNumProcResourceKinds()

unsigned llvm::MCSchedModel::getNumProcResourceKinds ( ) const
inline

◆ getProcessorID()

unsigned llvm::MCSchedModel::getProcessorID ( ) const
inline

Definition at line 337 of file MCSchedule.h.

References ProcID.

Referenced by computeInstrLatency(), and getReciprocalThroughput().

◆ getProcResource()

◆ getReciprocalThroughput() [1/3]

◆ getReciprocalThroughput() [2/3]

◆ getReciprocalThroughput() [3/3]

double MCSchedModel::getReciprocalThroughput ( unsigned SchedClass,
const InstrItineraryData & IID )
static

◆ getSchedClassDesc()

◆ getSchedClassName()

StringRef llvm::MCSchedModel::getSchedClassName ( unsigned SchedClassIdx) const
inline

Definition at line 373 of file MCSchedule.h.

References SchedClassNames, and SchedClassTable.

Referenced by llvm::mca::initializeUsedResources().

◆ hasExtraProcessorInfo()

bool llvm::MCSchedModel::hasExtraProcessorInfo ( ) const
inline

◆ hasInstrSchedModel()

bool llvm::MCSchedModel::hasInstrSchedModel ( ) const
inline

Does this machine model include instruction-level scheduling.

Definition at line 340 of file MCSchedule.h.

References SchedClassTable.

Referenced by computeInstrLatency(), getProcResource(), and getSchedClassDesc().

◆ isComplete()

bool llvm::MCSchedModel::isComplete ( ) const
inline

Return true if this machine model data for all instructions with a scheduling class (itinerary class or SchedRW list).

Definition at line 350 of file MCSchedule.h.

References CompleteModel.

◆ isOutOfOrder()

bool llvm::MCSchedModel::isOutOfOrder ( ) const
inline

Return true if machine supports out of order execution.

Definition at line 353 of file MCSchedule.h.

References MicroOpBufferSize.

Referenced by llvm::mca::Context::createDefaultPipeline(), and llvm::mca::RetireControlUnit::RetireControlUnit().

◆ InstrItineraryData

friend class InstrItineraryData
friend

Member Data Documentation

◆ CompleteModel

bool llvm::MCSchedModel::CompleteModel

Definition at line 316 of file MCSchedule.h.

Referenced by isComplete().

◆ Default

const MCSchedModel MCSchedModel::Default
static
Initial value:
false,
true,
false,
0,
nullptr,
nullptr,
0,
0,
nullptr,
nullptr,
nullptr}
static const unsigned DefaultLoopMicroOpBufferSize
Definition MCSchedule.h:296
static const unsigned DefaultHighLatency
Definition MCSchedule.h:307
static const unsigned DefaultLoadLatency
Definition MCSchedule.h:300
static const unsigned DefaultMicroOpBufferSize
Definition MCSchedule.h:288
static const unsigned DefaultMispredictPenalty
Definition MCSchedule.h:312
static const unsigned DefaultIssueWidth
Definition MCSchedule.h:271

Returns the default initialized model.

Definition at line 424 of file MCSchedule.h.

Referenced by llvm::MCSubtargetInfo::getSchedModelForCPU(), and llvm::MCSubtargetInfo::InitMCProcessorInfo().

◆ DefaultHighLatency

const unsigned llvm::MCSchedModel::DefaultHighLatency = 10
static

Definition at line 307 of file MCSchedule.h.

◆ DefaultIssueWidth

const unsigned llvm::MCSchedModel::DefaultIssueWidth = 1
static

Definition at line 271 of file MCSchedule.h.

Referenced by getReciprocalThroughput().

◆ DefaultLoadLatency

const unsigned llvm::MCSchedModel::DefaultLoadLatency = 4
static

Definition at line 300 of file MCSchedule.h.

◆ DefaultLoopMicroOpBufferSize

const unsigned llvm::MCSchedModel::DefaultLoopMicroOpBufferSize = 0
static

Definition at line 296 of file MCSchedule.h.

◆ DefaultMicroOpBufferSize

const unsigned llvm::MCSchedModel::DefaultMicroOpBufferSize = 0
static

Definition at line 288 of file MCSchedule.h.

◆ DefaultMispredictPenalty

const unsigned llvm::MCSchedModel::DefaultMispredictPenalty = 10
static

Definition at line 312 of file MCSchedule.h.

◆ EnableIntervals

bool llvm::MCSchedModel::EnableIntervals

Definition at line 321 of file MCSchedule.h.

◆ ExtraProcessorInfo

const MCExtraProcessorInfo* llvm::MCSchedModel::ExtraProcessorInfo

Definition at line 333 of file MCSchedule.h.

Referenced by getExtraProcessorInfo(), and hasExtraProcessorInfo().

◆ HighLatency

unsigned llvm::MCSchedModel::HighLatency

Definition at line 306 of file MCSchedule.h.

Referenced by llvm::TargetInstrInfo::defaultDefLatency().

◆ InstrItineraries

◆ IssueWidth

unsigned llvm::MCSchedModel::IssueWidth

◆ LoadLatency

unsigned llvm::MCSchedModel::LoadLatency

Definition at line 299 of file MCSchedule.h.

Referenced by llvm::TargetInstrInfo::defaultDefLatency().

◆ LoopMicroOpBufferSize

unsigned llvm::MCSchedModel::LoopMicroOpBufferSize

Definition at line 295 of file MCSchedule.h.

◆ MicroOpBufferSize

unsigned llvm::MCSchedModel::MicroOpBufferSize

Definition at line 287 of file MCSchedule.h.

Referenced by isOutOfOrder().

◆ MispredictPenalty

unsigned llvm::MCSchedModel::MispredictPenalty

Definition at line 311 of file MCSchedule.h.

◆ NumProcResourceKinds

unsigned llvm::MCSchedModel::NumProcResourceKinds

Definition at line 326 of file MCSchedule.h.

Referenced by getNumProcResourceKinds(), and getProcResource().

◆ NumSchedClasses

unsigned llvm::MCSchedModel::NumSchedClasses

Definition at line 327 of file MCSchedule.h.

Referenced by getSchedClassDesc().

◆ PostRAScheduler

bool llvm::MCSchedModel::PostRAScheduler

Definition at line 314 of file MCSchedule.h.

Referenced by llvm::TargetSubtargetInfo::enablePostRAScheduler().

◆ ProcID

unsigned llvm::MCSchedModel::ProcID

Definition at line 323 of file MCSchedule.h.

Referenced by getProcessorID().

◆ ProcResourceTable

const MCProcResourceDesc* llvm::MCSchedModel::ProcResourceTable

Definition at line 324 of file MCSchedule.h.

Referenced by getProcResource().

◆ SchedClassNames

const StringTable* llvm::MCSchedModel::SchedClassNames

Definition at line 328 of file MCSchedule.h.

Referenced by getSchedClassName().

◆ SchedClassTable

const MCSchedClassDesc* llvm::MCSchedModel::SchedClassTable

Definition at line 325 of file MCSchedule.h.

Referenced by getSchedClassDesc(), getSchedClassName(), and hasInstrSchedModel().


The documentation for this struct was generated from the following files: