From f0040c7b9a9a60510f16f32903d8d1b23f8e2f0b Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Mon, 15 Aug 2022 20:33:20 +0100 Subject: [PATCH] Remove reliance on pointer comparison in MT scheduling The critical path propagation used to rely on a pointer comparison to break equal scoring critical path updates. Use the corresponding mtask ids instead, which is deterministic across invocations. --- src/V3Partition.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index 5e8cd4d01..f6dd5c05a 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -161,7 +161,7 @@ static void partCheckCachedScoreVsActual(uint32_t cached, uint32_t actual) { // * Client calls PartPropagateCp::go(). Internally, this iteratively // propagates the new CPs wayward through the graph. // -template +template > class PartPropagateCp final : GraphAlg<> { private: // MEMBERS @@ -171,7 +171,7 @@ private: T_CostAccessor* const m_accessp; // Access cost and CPs on V3GraphVertex's. // // confirm we only process each vertex once. const bool m_slowAsserts; // Enable nontrivial asserts - SortByValueMap m_pending; // Pending rescores + SortByValueMap m_pending; // Pending rescores public: // CONSTRUCTORS @@ -361,6 +361,10 @@ public: bool operator()(const LogicMTask* ap, const LogicMTask* bp) const { return ap->id() < bp->id(); } + bool operator()(const V3GraphVertex* ap, const V3GraphVertex* bp) const { + return operator()(static_cast(ap), + static_cast(bp)); + } }; // This adaptor class allows the PartPropagateCp class to be somewhat @@ -1380,10 +1384,10 @@ private: << donorNewCpFwd.propagateCp << endl); LogicMTask::CpCostAccessor cpAccess; - PartPropagateCp forwardPropagator(m_mtasksp, GraphWay::FORWARD, - &cpAccess, m_slowAsserts); - PartPropagateCp reversePropagator(m_mtasksp, GraphWay::REVERSE, - &cpAccess, m_slowAsserts); + PartPropagateCp forwardPropagator( + m_mtasksp, GraphWay::FORWARD, &cpAccess, m_slowAsserts); + PartPropagateCp reversePropagator( + m_mtasksp, GraphWay::REVERSE, &cpAccess, m_slowAsserts); recipientp->setCritPathCost(GraphWay::FORWARD, recipientNewCpFwd.cp); if (recipientNewCpFwd.propagate) {