CIRCT  20.0.0git
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
circt::scheduling::SharedOperatorsProblem Class Reference

This class models a resource-constrained scheduling problem. More...

#include <Problems.h>

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

Public Member Functions

std::optional< unsigned > getLimit (OperatorType opr)
 The limit is the maximum number of operations using opr that are allowed to start in the same time step. More...
 
void setLimit (OperatorType opr, unsigned val)
 
virtual PropertyStringVector getProperties (OperatorType opr) override
 
virtual LogicalResult verify () override
 Return success if the computed solution is valid. More...
 
 Problem (Operation *containingOp)
 Construct an empty scheduling problem. More...
 
 Problem ()=default
 
- Public Member Functions inherited from circt::scheduling::Problem
 Problem (Operation *containingOp)
 Construct an empty scheduling problem. More...
 
virtual ~Problem ()=default
 
void insertOperation (Operation *op)
 Include op in this scheduling problem. More...
 
LogicalResult insertDependence (Dependence dep)
 Include dep in the scheduling problem. More...
 
void insertOperatorType (OperatorType opr)
 Include opr in this scheduling problem. More...
 
OperatorType getOrInsertOperatorType (StringRef name)
 Retrieves the operator type identified by the client-specific name. More...
 
Operation * getContainingOp ()
 Return the operation containing this problem, e.g. to emit diagnostics. More...
 
void setContainingOp (Operation *op)
 Set the operation containing this problem, e.g. to emit diagnostics. More...
 
bool hasOperation (Operation *op)
 Return true if op is part of this problem. More...
 
const OperationSetgetOperations ()
 Return the set of operations. More...
 
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. More...
 
bool hasOperatorType (OperatorType opr)
 Return true if opr is part of this problem. More...
 
const OperatorTypeSetgetOperatorTypes ()
 Return the set of operator types. More...
 
std::optional< OperatorTypegetLinkedOperatorType (Operation *op)
 The linked operator type provides the runtime characteristics for op. More...
 
void setLinkedOperatorType (Operation *op, OperatorType opr)
 
std::optional< unsigned > getLatency (OperatorType opr)
 The latency is the number of cycles opr needs to compute its result. More...
 
void setLatency (OperatorType opr, unsigned val)
 
std::optional< unsigned > getStartTime (Operation *op)
 Return the start time for op, as computed by the scheduler. More...
 
void setStartTime (Operation *op, unsigned val)
 
std::optional< unsigned > getEndTime (Operation *op)
 Returns the end time for op, as computed by the scheduler. More...
 
StringAttr getInstanceName ()
 
void setInstanceName (StringAttr name)
 
StringAttr getLibraryName ()
 
void setLibraryName (StringAttr name)
 
StringAttr getOperationName (Operation *op)
 
void setOperationName (Operation *op, StringAttr name)
 
virtual PropertyStringVector getProperties (Operation *op)
 
virtual PropertyStringVector getProperties (Dependence dep)
 
virtual PropertyStringVector getProperties ()
 
virtual LogicalResult check ()
 Return success if the constructed scheduling problem is valid. More...
 

Static Public Attributes

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

Protected Member Functions

 SharedOperatorsProblem ()=default
 
virtual LogicalResult checkLatency (OperatorType opr) override
 If opr is limited, it has a non-zero latency. More...
 
virtual LogicalResult verifyUtilization (OperatorType opr)
 opr is not oversubscribed in any time step. More...
 
- Protected Member Functions inherited from circt::scheduling::Problem
 Problem ()=default
 
virtual LogicalResult checkLinkedOperatorType (Operation *op)
 op is linked to a registered operator type. More...
 
virtual LogicalResult verifyStartTime (Operation *op)
 op has a start time. More...
 
virtual LogicalResult verifyPrecedence (Dependence dep)
 dep's source operation is available before dep's destination operation starts. More...
 

Private Attributes

OperatorTypeProperty< unsigned > limit
 

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. More...
 
using OperatorType = mlir::StringAttr
 Operator types are distinguished by name (chosen by the client). More...
 
using OperationSet = llvm::SetVector< Operation * >
 
using DependenceRange = llvm::iterator_range< detail::DependenceIterator >
 
using OperatorTypeSet = llvm::SetVector< OperatorType >
 
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 InstanceProperty = std::optional< T >
 

Detailed Description

This class models a resource-constrained scheduling problem.

An optional, non-zero limit marks operator types to be shared by the operations using them. In an HLS setting, this corresponds to multiplexing multiple operations onto a pre-allocated number of operator instances. These instances are assumed to be fully pipelined, meaning each instance can accept new operands (coming from a distinct operation) in each time step.

A solution to this problem is feasible iff the number of operations that use a certain limited operator type, and start in the same time step, does not exceed the operator type's limit. These constraints do not apply to operator types without a limit (not set, or 0).

Definition at line 413 of file Problems.h.

Constructor & Destructor Documentation

◆ SharedOperatorsProblem()

circt::scheduling::SharedOperatorsProblem::SharedOperatorsProblem ( )
protecteddefault

Member Function Documentation

◆ checkLatency()

LogicalResult SharedOperatorsProblem::checkLatency ( OperatorType  opr)
overrideprotectedvirtual

If opr is limited, it has a non-zero latency.

Reimplemented from circt::scheduling::Problem.

Definition at line 329 of file Problems.cpp.

References circt::scheduling::Problem::checkLatency().

◆ getLimit()

std::optional<unsigned> circt::scheduling::SharedOperatorsProblem::getLimit ( OperatorType  opr)
inline

The limit is the maximum number of operations using opr that are allowed to start in the same time step.

Definition at line 427 of file Problems.h.

References limit.

Referenced by isLimited(), and circt::scheduling::scheduleCPSAT().

◆ getProperties()

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

Reimplemented from circt::scheduling::Problem.

Definition at line 322 of file Problems.cpp.

References circt::scheduling::Problem::getProperties().

◆ Problem() [1/2]

circt::scheduling::Problem::Problem
default

◆ Problem() [2/2]

circt::scheduling::Problem::Problem
inlineexplicit

Construct an empty scheduling problem.

containingOp is used for its MLIRContext and to emit diagnostics.

Definition at line 81 of file Problems.h.

◆ setLimit()

void circt::scheduling::SharedOperatorsProblem::setLimit ( OperatorType  opr,
unsigned  val 
)
inline

Definition at line 430 of file Problems.h.

References limit.

◆ verify()

LogicalResult SharedOperatorsProblem::verify ( )
overridevirtual

Return success if the computed solution is valid.

Reimplemented from circt::scheduling::Problem.

Reimplemented in circt::scheduling::ModuloProblem.

Definition at line 361 of file Problems.cpp.

References circt::scheduling::Problem::verify().

◆ verifyUtilization()

LogicalResult SharedOperatorsProblem::verifyUtilization ( OperatorType  opr)
protectedvirtual

opr is not oversubscribed in any time step.

Reimplemented in circt::scheduling::ModuloProblem.

Definition at line 341 of file Problems.cpp.

Member Data Documentation

◆ limit

OperatorTypeProperty<unsigned> circt::scheduling::SharedOperatorsProblem::limit
private

Definition at line 422 of file Problems.h.

Referenced by getLimit(), and setLimit().

◆ name

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

Definition at line 415 of file Problems.h.


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