-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Move more functions off of ScheduleGraph
#21817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Moved some functions to `CheckGraphResults` which don't make use of `ScheduleGraph` internals. - Encapsulated conflicting systems into its own struct and moved related functions off of `ScheduleGraph`.
d14f0f6 to
84c0ca6
Compare
hymm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments on the code are all minor. I'd like to see a run of the schedule_build benchmarks as a sanity check before approving.
I'm not sure how many other changes you have planned, but we should maybe make a pr to update bevy_mod_debug_dump to main when you're done to make sure we haven't broken anything serious for that crate.
|
After that latest commit (which was making the EDIT: Yea, that SingleThreaded bench is just noise; here's another run: |
hymm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiousity how much slower was the HashSet?
Just a tad /s |
Objective
ScheduleGraphimplementation surface and extract reusable parts.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
Dag,DagAnalysis, andDagGroupsfunctionality.Future work
HashSet<SystemKey>with aFixedBitSet-like type for better performance.