17#include "mlir/IR/Operation.h"
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))
66 for (
auto incomingChain : chains[pred]) {
67 Operation *origin = incomingChain.first;
68 float delay = incomingChain.second;
77 SmallVector<Operation *, 4> chainsToBreak;
78 for (
auto incomingChain : chains[op]) {
79 Operation *origin = incomingChain.first;
80 float delay = incomingChain.second;
84 chainsToBreak.push_back(origin);
88 for (Operation *origin : chainsToBreak) {
89 result.emplace_back(origin, op);
90 chains[op].erase(origin);
103 float startTimeInCycle = 0.0f;
107 if (dep.isAuxiliary())
110 Operation *pred = dep.getSource();
112 if (!predStartTimeInCycle)
117 unsigned predEndTime = predStartTime + *prob.
getLatency(predOpr);
119 if (predEndTime < startTime)
125 assert(predEndTime == startTime);
127 float predEndTimeInCycle =
128 (predStartTime == predEndTime ? *predStartTimeInCycle : 0.0f) +
130 startTimeInCycle = std::max(predEndTimeInCycle, startTimeInCycle);
assert(baseType &&"element must be base type")
Problem::Dependence Dependence
false return failure()
Parse an optional keyword or string and set instance into 'result'.
This class models the accumulation of physical propagation delays on combinational paths along SSA de...
std::optional< float > getOutgoingDelay(OperatorType opr)
The outgoing delay denotes the propagation time from either the operand inputs (combinational operato...
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 ...
void clearStartTimeInCycle()
std::optional< float > getStartTimeInCycle(Operation *op)
Computed by the scheduler, this start time is relative to the beginning of the cycle that op starts i...
std::optional< unsigned > getLatency(OperatorType opr)
The latency is the number of cycles opr needs to compute its result.
std::optional< OperatorType > getLinkedOperatorType(Operation *op)
The linked operator type provides the runtime characteristics for op.
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.
const OperatorTypeSet & getOperatorTypes()
Return the set of operator types.
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.