Compute MTask affinity in V3VariableOrder (#4991)

Instead of carrying around MTask affinity from scheduling, compute it in
V3VariableOrder (where it is used), by tracing through the code. This
simplifies some code and has the benefit of handling variables
introduced after scheduling. It's worth a few % speed at run-time, and
the new implementation of V3VariableOrder is slightly more efficient,
though the speed/space is still dominated by the TSP sort.
This commit is contained in:
Geza Lore
2024-03-16 16:32:12 +00:00
committed by GitHub
parent e8a9662eb5
commit 292cc54768
6 changed files with 118 additions and 51 deletions
-16
View File
@@ -2464,22 +2464,6 @@ AstExecGraph* V3Order::createParallel(const OrderGraph& orderGraph, const std::s
// Add this logic to the per-mtask order
mtaskStates[mtaskId].m_logics.push_back(movep->logicp());
// Since we happen to be iterating over every logic node,
// take this opportunity to annotate each AstVar with the id's
// of mTaskGraphp that consume it and produce it. We'll use this
// information in V3EmitC when we lay out var's in memory.
const OrderLogicVertex* const logicp = movep->logicp();
for (const V3GraphEdge* edgep = logicp->inBeginp(); edgep; edgep = edgep->inNextp()) {
const OrderVarVertex* const vVtxp = edgep->fromp()->cast<const OrderVarVertex>();
if (!vVtxp) continue;
vVtxp->vscp()->varp()->addMTaskId(mtaskId);
}
for (const V3GraphEdge* edgep = logicp->outBeginp(); edgep; edgep = edgep->outNextp()) {
const OrderVarVertex* const vVtxp = edgep->top()->cast<const OrderVarVertex>();
if (!vVtxp) continue;
vVtxp->vscp()->varp()->addMTaskId(mtaskId);
}
}
// Create the AstExecGraph node which represents the execution