17 #include "mlir/IR/Operation.h"
19 using namespace circt;
26 SmallVectorImpl<Dependence> &result) {
33 <<
"Delays of operator type '" << opr.getValue()
34 <<
"' exceed maximum cycle time: " << cycleTime;
38 DenseMap<Operation *, SmallDenseMap<Operation *, float>> chains;
44 chains[op][op] = 0.0f;
48 if (dep.isAuxiliary())
51 Operation *pred = dep.getSource();
52 if (!chains.count(pred))
55 auto predOpr = *prob.getLinkedOperatorType(pred);
56 if (*prob.getLatency(predOpr) > 0) {
60 chains[op][pred] = *prob.getOutgoingDelay(predOpr);
66 for (
auto incomingChain : chains[pred]) {
67 Operation *origin = incomingChain.first;
68 float delay = incomingChain.second;
76 for (
auto incomingChain : chains[op]) {
77 Operation *origin = incomingChain.first;
78 float delay = incomingChain.second;
83 result.emplace_back(origin, op);
85 chains[op].erase(origin);
99 float startTimeInCycle = 0.0f;
103 if (dep.isAuxiliary())
106 Operation *pred = dep.getSource();
107 auto predStartTimeInCycle = prob.getStartTimeInCycle(pred);
108 if (!predStartTimeInCycle)
111 auto predOpr = *prob.getLinkedOperatorType(pred);
112 unsigned predStartTime = *prob.getStartTime(pred);
113 unsigned predEndTime = predStartTime + *prob.getLatency(predOpr);
115 if (predEndTime < startTime)
121 assert(predEndTime == startTime);
123 float predEndTimeInCycle =
124 (predStartTime == predEndTime ? *predStartTimeInCycle : 0.0f) +
125 *prob.getOutgoingDelay(predOpr);
126 startTimeInCycle = std::max(predEndTimeInCycle, startTimeInCycle);
This class models the accumulation of physical propagation delays on combinational paths along SSA de...
void setStartTimeInCycle(Operation *op, float time)
std::optional< float > getIncomingDelay(OperatorType opr)
The incoming delay denotes the propagation time from the operand inputs to either the result outputs ...
std::optional< float > getOutgoingDelay(OperatorType opr)
The outgoing delay denotes the propagation time from either the operand inputs (combinational operato...
void clearStartTimeInCycle()
std::optional< OperatorType > getLinkedOperatorType(Operation *op)
The linked operator type provides the runtime characteristics for op.
const OperatorTypeSet & getOperatorTypes()
Return the set of operator types.
std::optional< unsigned > getStartTime(Operation *op)
Return the start time for op, as computed by the scheduler.
detail::Dependence Dependence
A thin wrapper to allow a uniform handling of def-use and auxiliary dependences.
DependenceRange getDependences(Operation *op)
Return a range object to transparently iterate over op's incoming 1) implicit def-use dependences (ba...
Operation * getContainingOp()
Return the operation containing this problem, e.g. to emit diagnostics.
A wrapper class to uniformly handle def-use and auxiliary dependence edges.
LogicalResult handleOperationsInTopologicalOrder(Problem &prob, HandleOpFn fun)
Visit prob's operations in topological order, using an internal worklist.
LogicalResult computeChainBreakingDependences(ChainingProblem &prob, float cycleTime, SmallVectorImpl< Problem::Dependence > &result)
Analyse combinational chains in prob's dependence graph and determine pairs of operations that must b...
LogicalResult computeStartTimesInCycle(ChainingProblem &prob)
Assuming prob is scheduled and contains (integer) start times, this method fills in the start times i...
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.