CIRCT 21.0.0git
|
This class models a resource-constrained scheduling problem. More...
#include <Problems.h>
Public Member Functions | |
std::optional< unsigned > | getLimit (ResourceType rsrc) |
The limit is the maximum number of operations using rsrc that are available in the target hardware. | |
void | setLimit (ResourceType rsrc, unsigned val) |
virtual PropertyStringVector | getProperties (ResourceType rsrc) override |
virtual LogicalResult | verify () override |
Return success if the computed solution is valid. | |
Problem (Operation *containingOp) | |
Construct an empty scheduling problem. | |
Problem ()=default | |
![]() | |
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 OperationSet & | getOperations () |
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 OperatorTypeSet & | getOperatorTypes () |
Return the set of operator types. | |
bool | hasResourceType (ResourceType rsrc) |
Return true if rsrc is part of this problem. | |
const ResourceTypeSet & | getResourceTypes () |
Return the set of resource types. | |
std::optional< OperatorType > | getLinkedOperatorType (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 (Operation *op) |
virtual PropertyStringVector | getProperties (Dependence dep) |
virtual PropertyStringVector | getProperties (OperatorType opr) |
virtual PropertyStringVector | getProperties () |
virtual LogicalResult | check () |
Return success if the constructed scheduling problem is valid. | |
Static Public Attributes | |
static constexpr auto | name = "SharedOperatorsProblem" |
![]() | |
static constexpr auto | name = "Problem" |
Protected Member Functions | |
SharedOperatorsProblem ()=default | |
virtual LogicalResult | checkLatency (Operation *op) override |
If op is limited, it has a non-zero latency. | |
virtual LogicalResult | verifyUtilization (ResourceType rsrc) |
rsrc is not oversubscribed in any time step. | |
![]() | |
Problem ()=default | |
virtual LogicalResult | checkLinkedOperatorType (Operation *op) |
op is linked to a registered operator type. | |
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 | |
ResourceTypeProperty< unsigned > | limit |
Additional Inherited Members | |
![]() | |
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 > |
![]() | |
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 > |
This class models a resource-constrained scheduling problem.
An optional, non-zero limit marks resource 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 486 of file Problems.h.
|
protecteddefault |
|
overrideprotectedvirtual |
If op
is limited, it has a non-zero latency.
Reimplemented from circt::scheduling::Problem.
Definition at line 344 of file Problems.cpp.
References circt::scheduling::Problem::checkLatency(), circt::scheduling::Problem::getContainingOp(), circt::scheduling::Problem::getLatency(), getLimit(), circt::scheduling::Problem::getLinkedOperatorType(), circt::scheduling::Problem::getLinkedResourceTypes(), circt::scheduling::Problem::OperatorType::getValue(), and limit.
|
inline |
The limit is the maximum number of operations using rsrc
that are available in the target hardware.
Definition at line 500 of file Problems.h.
References limit.
Referenced by checkLatency(), getProperties(), isLimited(), circt::scheduling::scheduleCPSAT(), verifyUtilization(), and circt::scheduling::ModuloProblem::verifyUtilization().
|
overridevirtual |
Reimplemented from circt::scheduling::Problem.
Definition at line 337 of file Problems.cpp.
References getLimit(), circt::scheduling::Problem::getProperties(), and limit.
|
default |
|
inlineexplicit |
Construct an empty scheduling problem.
containingOp
is used for its MLIRContext and to emit diagnostics.
Definition at line 81 of file Problems.h.
|
inline |
Definition at line 503 of file Problems.h.
References limit.
|
overridevirtual |
Return success if the computed solution is valid.
Reimplemented from circt::scheduling::Problem.
Reimplemented in circt::scheduling::ModuloProblem.
Definition at line 396 of file Problems.cpp.
References circt::scheduling::Problem::getResourceTypes(), circt::scheduling::Problem::verify(), and verifyUtilization().
|
protectedvirtual |
rsrc
is not oversubscribed in any time step.
Reimplemented in circt::scheduling::ModuloProblem.
Definition at line 367 of file Problems.cpp.
References circt::scheduling::Problem::getContainingOp(), getLimit(), circt::scheduling::Problem::getLinkedResourceTypes(), circt::scheduling::Problem::getOperations(), circt::scheduling::Problem::getStartTime(), circt::scheduling::Problem::ResourceType::getValue(), and limit.
Referenced by verify().
|
private |
Definition at line 495 of file Problems.h.
Referenced by checkLatency(), getLimit(), getProperties(), setLimit(), verifyUtilization(), and circt::scheduling::ModuloProblem::verifyUtilization().
|
staticconstexpr |
Definition at line 488 of file Problems.h.