-
Notifications
You must be signed in to change notification settings - Fork 41
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
Planner comparison and update #1061
Conversation
6721221
to
ebfe372
Compare
0328643
to
32e97ca
Compare
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.
Were there more changes you wanted to add @milroy ? It looks reasonable to me, although the commits need bodies.
Question though--is the motivation for this mostly to make the code more idiomatic? It doesn't look like it saves much complexity.
32e97ca
to
3f6b884
Compare
95cd5a7
to
ca89c6e
Compare
2bac648
to
6d6ce89
Compare
1f47fe3
to
cbfdcae
Compare
Deleting a question I asked above because there's a pretty obvious answer that just took a bit of searching. |
c6fea94
to
a28e6fc
Compare
Guessing the answer was UB propagation from the undefined value of bo? I started to type an answer earlier but didn’t get it done before we had to board. Starting a review. |
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.
Pending the value safety question this looks great.
@@ -193,6 +229,26 @@ int planner::restore_track_points () | |||
return rc; | |||
} | |||
|
|||
int planner::update_total (uint64_t resource_total) | |||
{ | |||
int64_t delta = resource_total - m_total_resources; |
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.
Is m_total_resources guaranteed to be smaller than resource_total?
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.
The case where resource_total
> m_total_resources
is when the graph is being grown, and resource_total
< m_total_resources
means the graph is being shrunk. There aren't any guarantees on the value of resource_total
except that it's nonnegative.
@jameshcorbett asked a form of this question, too, and my reasoning has been that negative values for point->remaining
(e.g., when (point->remaining + delta) < 0
) shouldn't cause problems because they should only happen for reservations (which will be cleared at the next schedule loop). I was thinking that adding a check for negative remaining wasn't worth the performance penalty.
That said, I don't expect update_total
to be called often, and adding a guard check may prevent complicated problems with removing spans if that process isn't carefully performed upstream (i.e., in planner_c_interface
).
Yeah, that was it, and I added two commits to fix other occurrences in the unit tests. I thought I was right about the comma-separated syntax for declaration and initialization and went down the wrong investigative hole for a while.
Thanks for the review and have a good flight! |
Problem: to update the Fluxion resource graph, the traverser will need to be reinitialized, which assembles vectors of resource counts and types. The ordering of the counts and types depends on how graph is mutated. Currently, counts and types are stored as separate vectors in `planner_multi` under the assumption that their order and size don't change. Removing that assumption will cause inconsistency in scheduling. Add a `boost::multi_index` container to replace and simplify `planner_multi` member data. The `boost::multi_index` container has the important capability of searching and comparing by multiple indices which can be vector-like (`random_access`), and hash-like (`hashed_unique`). Adding two indexes for lookups enables support for altering resource types, counts, and their orders (indices) in a natural way. Performing these transformations with `vectors` would be high-complexity both in time and code.
2c8d0bf
to
9038b13
Compare
Problem: when updating the Fluxion resource graph the `planner` scheduled points' remaining resource count must be updated. Add an `update` function to add or subtract from the current remaining resource count at each scheduled point. Create a guard to ensure the remaining count is nonnegative.
Problem: when updating the Fluxion resource graph `request_multi` `counts`' indices can be reordered. Reordering will cause inconsistent lookups. Update the `request_multi` `counts` to be map-based to handle reordering of indices.
Problem: when updating the Fluxion resource graph planners, resources, counts, and their orders can be changed by mutation of the resource graph topology and attributes. Add `update` functionality to `planner_multi` and the C interface to add new resources and planners, reorder, modify, and permute existing resources, and delete removed resources.
Problem: updating a `planner` requires unit tests to maintain correct functionality. Add update unit tests for `planner`.
Problem: updating a `planner_multi` requires unit tests to maintain correct functionality. Add update unit tests for `planner_multi`.
Problem: the migration to cmake broke the ability to run Valngrind tests, and Valgrind doesn't detect leaks in important Fluxion components when running under Flux. Add capability to find Valgrind and run Valgrind tests. Add additional tests for planner and schema.
Problem: the current planner tests do not destroy the planners created during the tests, resulting in memory leaks that will pollute Valgrind test output. Add calls to destroy the planners to eliminate the memory leaks.
Problem: planner_multi_t contexts are declared and initialized using a comma-separated list that can result in UB. Correct the declaration and initialization.
Problem: planner_multi_t contexts and ints are declared and initialized using a comma-separated list that can result in UB. Correct the declarations and initializations.
9038b13
to
6f16387
Compare
Thanks for the reviews all! Setting MWP. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1061 +/- ##
========================================
+ Coverage 70.6% 70.9% +0.2%
========================================
Files 95 96 +1
Lines 12744 12819 +75
========================================
+ Hits 9010 9099 +89
+ Misses 3734 3720 -14
|
Edit: this PR has grown in scope to enable updates to
planner
andplanner_multi
To update the Fluxion resource graph, its traverser will need to be reinitialized. The initialization process assembles vectors of resource counts and types via graph traversal to update the
planner_multi
pruning filters. Currently, counts and types are stored as separate vectors inplanner_multi
under the assumption that their order and size don't change. The index of a count must be the same as the index of the corresponding resource type string. This assumption is valid as long as the resource graph is static, but allowing the resource graph to change without updating the planners and their metadata will cause scheduling inconsistency (e.g., incorrect traversal pruning) because of incorrect resource types and counts.This PR adds comparison operators for fundamental
planner
member data classes to scope the comparison to the correct part of the code. The rescoping avoids relying on awkward class functions for comparison of member data objects and their data.The PR also restructures
planner_multi
to useboost::multi_index
container to replace and simplifyplanner_multi
member data. Theboost::multi_index
container has the important capability of searching and comparing by multiple indices which can be vector-like (random_access
), and hash-like (hashed_unique
). Adding two indexes for lookups enables support for altering resource types, counts, and their orders (indices) in a natural way. Performing these transformations withvectors
would be higher complexity both in time and lines of code.Finally, the PR enables the update functionality in the
planner
andplanner_multi
C interfaces and creates unit tests for updatingplanner
andplanner_multi
.Edit: this PR also re-enables the Valgrind tests and fixes UB in planner unit tests.