We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c47faff commit 38e28b8Copy full SHA for 38e28b8
xls/passes/resource_sharing_pass.cc
@@ -2757,6 +2757,16 @@ FoldingGraph::FoldingGraph(
2757
// Allocate the graph
2758
graph_ = std::make_unique<Graph>();
2759
2760
+ // Ensure deterministic construction of FoldingGraph
2761
+ std::sort(foldable_actions.begin(), foldable_actions.end(),
2762
+ [](const std::unique_ptr<BinaryFoldingAction>& a,
2763
+ const std::unique_ptr<BinaryFoldingAction>& b) {
2764
+ if (a->GetFrom()->id() == b->GetFrom()->id()) {
2765
+ return a->GetTo()->id() < b->GetTo()->id();
2766
+ }
2767
+ return a->GetFrom()->id() < b->GetFrom()->id();
2768
+ });
2769
+
2770
// Add the nodes
2771
AddNodes(foldable_actions);
2772
0 commit comments