Move more functions off of ScheduleGraph
#21817
Open
+1,052
−669
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
ScheduleGraphimplementation surface and extract reusable parts.This is the final mile of cleanup I want to do for
ScheduleGraph's implementation surface for now, I'll be focusing on other schedule bits after.Solution
Dag<N>as a fully-fledged directed acyclic graph type.dirtyflag. All modifications to the graph (viaDerefMutorDag::graph_mut) cause the DAG to be marked as dirty.Dag::toposort: if the DAG is dirty, computes topological order, caches it, and marks the DAG as clean. If already clean, returns the cached topological order. We now also reuse the previous toposortVecallocation.Dag::get_toposort: can be used to access the topological order with&self, with the stipulation that it returns anOption, andNoneif the DAG is dirty.check_graphwithDag::analyze, and made it publicly accessible.Dag::remove_redundant_edges, which uses the output ofDag::analyze.CheckGraphResultstoDagAnalysis.DagAnalysis::check_for_redundant_edges, replacingScheduleGraph::optionally_check_hierarchy_conflicts.DagAnalysis::check_for_cross_dependencies, replacingScheduleGraph::check_for_cross_dependencies. It now takes two fullDagAnalysisfor comparison.DagAnalysis::check_for_cross_intersection, replacingScheduleGraph::check_order_but_intersect.DagGroupsto encapsulate theHashMap<SystemSetKey, Vec<SystemKey>>with additional capabilities:DagGroups::flattenandDagGroups::flatten_undirectedhandle the graph reduction operations previously performed by functions onScheduleGraph.ConflictingSystemsto encapsulateVec<(SystemKey, SystemKey, ComponentId)>with additional capabilities and type safety.See the included migration guide for breaking changes.
Testing
Future work
HashSet<SystemKey>with aFixedBitSet-like type for better performance.