CIRCT 21.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
circt::scheduling::ChainingProblem Class Reference

This class models the accumulation of physical propagation delays on combinational paths along SSA dependences. More...

#include <Problems.h>

Inheritance diagram for circt::scheduling::ChainingProblem:
Inheritance graph
[legend]
Collaboration diagram for circt::scheduling::ChainingProblem:
Collaboration graph
[legend]

Public Member Functions

std::optional< float > getIncomingDelay (OperatorType opr)
 The incoming delay denotes the propagation time from the operand inputs to either the result outputs (combinational operators) or the first internal register stage.
 
void setIncomingDelay (OperatorType opr, float delay)
 
std::optional< float > getOutgoingDelay (OperatorType opr)
 The outgoing delay denotes the propagation time from either the operand inputs (combinational operators) or the last internal register stage to the result outputs.
 
void setOutgoingDelay (OperatorType opr, float delay)
 
std::optional< float > getStartTimeInCycle (Operation *op)
 Computed by the scheduler, this start time is relative to the beginning of the cycle that op starts in.
 
void setStartTimeInCycle (Operation *op, float time)
 
void clearStartTimeInCycle ()
 
virtual PropertyStringVector getProperties (Operation *op) override
 
virtual PropertyStringVector getProperties (OperatorType opr) override
 
virtual LogicalResult check () override
 Return success if the constructed scheduling problem is valid.
 
virtual LogicalResult verify () override
 Return success if the computed solution is valid.
 
 Problem (Operation *containingOp)
 Construct an empty scheduling problem.
 
 Problem ()=default
 
- Public Member Functions inherited from circt::scheduling::Problem
 Problem (Operation *containingOp)
 Construct an empty scheduling problem.
 
virtual ~Problem ()=default
 
void insertOperation (Operation *op)
 Include op in this scheduling problem.
 
LogicalResult insertDependence (Dependence dep)
 Include dep in the scheduling problem.
 
void insertOperatorType (OperatorType opr)
 Include opr in this scheduling problem.
 
void insertResourceType (ResourceType rsrc)
 Include rsrc in this scheduling problem.
 
OperatorType getOrInsertOperatorType (StringRef name)
 Retrieves the operator type identified by the client-specific name.
 
ResourceType getOrInsertResourceType (StringRef name)
 Retrieves the resource type identified by the client-specific name.
 
Operation * getContainingOp ()
 Return the operation containing this problem, e.g. to emit diagnostics.
 
void setContainingOp (Operation *op)
 Set the operation containing this problem, e.g. to emit diagnostics.
 
bool hasOperation (Operation *op)
 Return true if op is part of this problem.
 
const OperationSetgetOperations ()
 Return the set of operations.
 
DependenceRange getDependences (Operation *op)
 Return a range object to transparently iterate over op's incoming 1) implicit def-use dependences (backed by the SSA graph), and then 2) explictly added auxiliary dependences.
 
bool hasOperatorType (OperatorType opr)
 Return true if opr is part of this problem.
 
const OperatorTypeSetgetOperatorTypes ()
 Return the set of operator types.
 
bool hasResourceType (ResourceType rsrc)
 Return true if rsrc is part of this problem.
 
const ResourceTypeSetgetResourceTypes ()
 Return the set of resource types.
 
std::optional< OperatorTypegetLinkedOperatorType (Operation *op)
 The linked operator type provides the runtime characteristics for op.
 
void setLinkedOperatorType (Operation *op, OperatorType opr)
 
std::optional< SmallVector< ResourceType > > getLinkedResourceTypes (Operation *op)
 The linked resource type provides the available resources for op.
 
void setLinkedResourceTypes (Operation *op, SmallVector< ResourceType > rsrc)
 
std::optional< unsigned > getLatency (OperatorType opr)
 The latency is the number of cycles opr needs to compute its result.
 
void setLatency (OperatorType opr, unsigned val)
 
std::optional< unsigned > getStartTime (Operation *op)
 Return the start time for op, as computed by the scheduler.
 
void setStartTime (Operation *op, unsigned val)
 
std::optional< unsigned > getEndTime (Operation *op)
 Returns the end time for op, as computed by the scheduler.
 
StringAttr getInstanceName ()
 
void setInstanceName (StringAttr name)
 
StringAttr getLibraryName ()
 
void setLibraryName (StringAttr name)
 
StringAttr getRsrcLibraryName ()
 
void setRsrcLibraryName (StringAttr name)
 
StringAttr getOperationName (Operation *op)
 
void setOperationName (Operation *op, StringAttr name)
 
virtual PropertyStringVector getProperties (Dependence dep)
 
virtual PropertyStringVector getProperties ()
 
virtual PropertyStringVector getProperties (ResourceType rsrc)
 

Static Public Attributes

static constexpr auto name = "ChainingProblem"
 
- Static Public Attributes inherited from circt::scheduling::Problem
static constexpr auto name = "Problem"
 

Protected Member Functions

 ChainingProblem ()=default
 
virtual LogicalResult checkDelays (OperatorType opr)
 Incoming/outgoing delays are set for opr and non-negative.
 
virtual LogicalResult verifyStartTimeInCycle (Operation *op)
 op has a non-negative start time in its cycle.
 
virtual LogicalResult verifyPrecedenceInCycle (Dependence dep)
 If dep is an SSA edge and its source operation finishes in the same time step as the destination operation, the source's result is available before the destination starts in that cycle.
 
- Protected Member Functions inherited from circt::scheduling::Problem
 Problem ()=default
 
virtual LogicalResult checkLinkedOperatorType (Operation *op)
 op is linked to a registered operator type.
 
virtual LogicalResult checkLatency (Operation *op)
 op has a latency.
 
virtual LogicalResult verifyStartTime (Operation *op)
 op has a start time.
 
virtual LogicalResult verifyPrecedence (Dependence dep)
 dep's source operation is available before dep's destination operation starts.
 

Private Attributes

OperatorTypeProperty< float > incomingDelay
 
OperatorTypeProperty< float > outgoingDelay
 
OperationProperty< float > startTimeInCycle
 

Additional Inherited Members

- Public Types inherited from circt::scheduling::Problem
using Dependence = detail::Dependence
 A thin wrapper to allow a uniform handling of def-use and auxiliary dependences.
 
using OperationSet = llvm::SetVector< Operation * >
 
using DependenceRange = llvm::iterator_range< detail::DependenceIterator >
 
using OperatorTypeSet = llvm::SetVector< OperatorType >
 
using ResourceTypeSet = llvm::SetVector< ResourceType >
 
using PropertyStringVector = llvm::SmallVector< std::pair< std::string, std::string >, 2 >
 
- Protected Types inherited from circt::scheduling::Problem
using AuxDependenceMap = llvm::DenseMap< Operation *, llvm::SmallSetVector< Operation *, 4 > >
 
template<typename T >
using OperationProperty = llvm::DenseMap< Operation *, std::optional< T > >
 
template<typename T >
using DependenceProperty = llvm::DenseMap< Dependence, std::optional< T > >
 
template<typename T >
using OperatorTypeProperty = llvm::DenseMap< OperatorType, std::optional< T > >
 
template<typename T >
using ResourceTypeProperty = llvm::DenseMap< ResourceType, std::optional< T > >
 
template<typename T >
using InstanceProperty = std::optional< T >
 

Detailed Description

This class models the accumulation of physical propagation delays on combinational paths along SSA dependences.

Each operator type is annotated with estimated values for incoming and outgoing delays. Combinational operators (zero-latency, no internal registers) have only a single delay; this important special case is modeled by setting the incoming and outgoing delays to the same value.

A solution to this problem comprises per-operation start times in a continuous unit, e.g. in nanoseconds, inside the discrete time steps/cycles determined by the underlying scheduling problem.

Definition at line 412 of file Problems.h.

Constructor & Destructor Documentation

◆ ChainingProblem()

circt::scheduling::ChainingProblem::ChainingProblem ( )
protecteddefault

Member Function Documentation

◆ check()

LogicalResult ChainingProblem::check ( )
overridevirtual

Return success if the constructed scheduling problem is valid.

Reimplemented from circt::scheduling::Problem.

Reimplemented in circt::scheduling::ChainingCyclicProblem.

Definition at line 305 of file Problems.cpp.

References circt::scheduling::Problem::check(), checkDelays(), and circt::scheduling::Problem::getOperatorTypes().

Referenced by circt::scheduling::ChainingCyclicProblem::check().

◆ checkDelays()

LogicalResult ChainingProblem::checkDelays ( OperatorType  opr)
protectedvirtual

Incoming/outgoing delays are set for opr and non-negative.

The delays are equal if opr is a zero-latency operator type.

Definition at line 239 of file Problems.cpp.

References circt::scheduling::Problem::OperatorType::getAttr(), circt::scheduling::Problem::getContainingOp(), getIncomingDelay(), circt::scheduling::Problem::getLatency(), getOutgoingDelay(), incomingDelay, and outgoingDelay.

Referenced by check().

◆ clearStartTimeInCycle()

void circt::scheduling::ChainingProblem::clearStartTimeInCycle ( )
inline

Definition at line 453 of file Problems.h.

References startTimeInCycle.

Referenced by circt::scheduling::computeStartTimesInCycle().

◆ getIncomingDelay()

std::optional< float > circt::scheduling::ChainingProblem::getIncomingDelay ( OperatorType  opr)
inline

The incoming delay denotes the propagation time from the operand inputs to either the result outputs (combinational operators) or the first internal register stage.

Definition at line 428 of file Problems.h.

References incomingDelay.

Referenced by checkDelays(), and getProperties().

◆ getOutgoingDelay()

std::optional< float > circt::scheduling::ChainingProblem::getOutgoingDelay ( OperatorType  opr)
inline

The outgoing delay denotes the propagation time from either the operand inputs (combinational operators) or the last internal register stage to the result outputs.

Definition at line 438 of file Problems.h.

References outgoingDelay.

Referenced by checkDelays(), circt::scheduling::computeStartTimesInCycle(), getProperties(), and verifyPrecedenceInCycle().

◆ getProperties() [1/2]

Problem::PropertyStringVector ChainingProblem::getProperties ( Operation *  op)
overridevirtual

Reimplemented from circt::scheduling::Problem.

Definition at line 223 of file Problems.cpp.

References circt::scheduling::Problem::getProperties(), and getStartTimeInCycle().

◆ getProperties() [2/2]

Problem::PropertyStringVector ChainingProblem::getProperties ( OperatorType  opr)
overridevirtual

◆ getStartTimeInCycle()

std::optional< float > circt::scheduling::ChainingProblem::getStartTimeInCycle ( Operation *  op)
inline

Computed by the scheduler, this start time is relative to the beginning of the cycle that op starts in.

Definition at line 447 of file Problems.h.

References startTimeInCycle.

Referenced by circt::scheduling::computeStartTimesInCycle(), getProperties(), verifyPrecedenceInCycle(), and verifyStartTimeInCycle().

◆ Problem() [1/2]

circt::scheduling::Problem::Problem ( )
default

◆ Problem() [2/2]

circt::scheduling::Problem::Problem ( Operation *  containingOp)
inlineexplicit

Construct an empty scheduling problem.

containingOp is used for its MLIRContext and to emit diagnostics.

Definition at line 81 of file Problems.h.

◆ setIncomingDelay()

void circt::scheduling::ChainingProblem::setIncomingDelay ( OperatorType  opr,
float  delay 
)
inline

Definition at line 431 of file Problems.h.

References incomingDelay.

◆ setOutgoingDelay()

void circt::scheduling::ChainingProblem::setOutgoingDelay ( OperatorType  opr,
float  delay 
)
inline

Definition at line 441 of file Problems.h.

References outgoingDelay.

◆ setStartTimeInCycle()

void circt::scheduling::ChainingProblem::setStartTimeInCycle ( Operation *  op,
float  time 
)
inline

Definition at line 450 of file Problems.h.

References startTimeInCycle.

Referenced by circt::scheduling::computeStartTimesInCycle().

◆ verify()

LogicalResult ChainingProblem::verify ( )
overridevirtual

◆ verifyPrecedenceInCycle()

LogicalResult ChainingProblem::verifyPrecedenceInCycle ( Dependence  dep)
protectedvirtual

If dep is an SSA edge and its source operation finishes in the same time step as the destination operation, the source's result is available before the destination starts in that cycle.

Definition at line 270 of file Problems.cpp.

References circt::scheduling::Problem::getContainingOp(), circt::scheduling::detail::Dependence::getDestination(), circt::scheduling::Problem::getLatency(), circt::scheduling::Problem::getLinkedOperatorType(), getOutgoingDelay(), circt::scheduling::detail::Dependence::getSource(), circt::scheduling::Problem::getStartTime(), getStartTimeInCycle(), and circt::scheduling::detail::Dependence::isAuxiliary().

Referenced by verify().

◆ verifyStartTimeInCycle()

LogicalResult ChainingProblem::verifyStartTimeInCycle ( Operation *  op)
protectedvirtual

op has a non-negative start time in its cycle.

Definition at line 263 of file Problems.cpp.

References getStartTimeInCycle(), and startTimeInCycle.

Referenced by verify().

Member Data Documentation

◆ incomingDelay

OperatorTypeProperty<float> circt::scheduling::ChainingProblem::incomingDelay
private

Definition at line 421 of file Problems.h.

Referenced by checkDelays(), getIncomingDelay(), and setIncomingDelay().

◆ name

constexpr auto circt::scheduling::ChainingProblem::name = "ChainingProblem"
staticconstexpr

Definition at line 414 of file Problems.h.

◆ outgoingDelay

OperatorTypeProperty<float> circt::scheduling::ChainingProblem::outgoingDelay
private

Definition at line 421 of file Problems.h.

Referenced by checkDelays(), getOutgoingDelay(), and setOutgoingDelay().

◆ startTimeInCycle

OperationProperty<float> circt::scheduling::ChainingProblem::startTimeInCycle
private

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