mirror of
https://github.com/verilator/verilator.git
synced 2026-08-30 01:38:21 +02:00
Reuse MTaskEdge instances in MT scheduling
Instead of deleting then re-allocating MTaskEdge instances when merging two MTasks, just redirect the edged of the donor MTask to the recipient MTask. This is both faster as it avoids an allocation and a deletion, together with one update of the sibling maps, and also makes the algorithm more stable due to MergeCandidate IDs being stable and allocated up front for all MTaskEdges, before any SiblingMCs are allocated. Perturbations in output are expected as the IDs used to break ties between merge candidates with equal costs are not updated when redirecting an edge (on purpose). The relinking of only one end of the graph edges also perturbs the order in which they are enumerated, which does change candidate opportunities when the number of edges is larger than PART_SIBLING_EDGE_LIMIT. Confirmed output is identical when IDs are updated and edges are updated to appear in their original order.
This commit is contained in:
@@ -182,6 +182,14 @@ V3GraphEdge* V3GraphEdge::relinkFromp(V3GraphVertex* newFromp) {
|
||||
return oldNxt;
|
||||
}
|
||||
|
||||
V3GraphEdge* V3GraphEdge::relinkTop(V3GraphVertex* newTop) {
|
||||
V3GraphEdge* oldNxt = inNextp();
|
||||
m_ins.unlink(m_top->m_ins, this);
|
||||
m_top = newTop;
|
||||
inPushBack();
|
||||
return oldNxt;
|
||||
}
|
||||
|
||||
void V3GraphEdge::unlinkDelete() {
|
||||
// Unlink from side
|
||||
m_outs.unlink(m_fromp->m_outs, this);
|
||||
|
||||
Reference in New Issue
Block a user