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:
Geza Lore
2022-08-19 14:06:11 +01:00
parent f0040c7b9a
commit cd50949a7e
3 changed files with 47 additions and 27 deletions
+8
View File
@@ -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);