Rewrite the Versioned Dependency Resolver for determinism, simplicity, and performance#1014
Merged
ras0219-msft merged 15 commits intomicrosoft:mainfrom Apr 26, 2023
Merged
Conversation
BillyONeal
reviewed
Apr 11, 2023
BillyONeal
reviewed
Apr 17, 2023
Member
BillyONeal
left a comment
There was a problem hiding this comment.
Still not a fan of CHECK_LINES/require losing the context in terms of where the failure happens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Primary Problem
Today, dependency resolution depends on evaluation order of dependencies due to "dynamic occlusion":
A -> B -> D>=1
A -> C -> D>=2
A -> E
D@1 -> E>=2
D@2 -> E>=1
All packages have baseline @0.
Eval Order: A@0, B@0, D@1, E@2, C@0, D@2
Result: A=0, B=0, D=2, E=2, C=0
Eval Order: A@0, C@0, D@2, E@1, B@0
Result: A=0, B=0, D=2, E=1, C=0
This fundamentally occurs due to "occluding" versions earlier than the current "best" version along a schema. For the example above, if D>=2 has been considered, we don't consider D@1 at all.
Solution
The decision to occlude a port must be known based on "static" information. There are two obvious sets of static, up-front information: the baseline and the top-level manifest's core dependencies. While the core dependencies of the top-level manifest are static, treating them differently than feature dependencies would result in a much more confusing user experience.
Therefore, we use the baseline values as the sole occlusion. All versions referenced that compare >= the baseline are considered. Any versions less than the baseline or incomparable[1] are not considered. For every required feature, we consider the dependencies of that feature for all considered versions.
boostas a dependency this results in 24 fewer calls to CMake, each of which costs ~50ms on Windows (1.2 seconds of wall-clock-time savings!)dependencies.cppsince it's unrelated to the classic-mode algorithm."dependencies"list have defaults applied."default-features": falseapplies defaults.Drive-by Improvements
ExpectedT::thenUtil::filter()InstallPlanActionsBefore:
Before:
Before:
(Resolves internal bug https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1791323)
[1]: We can exclude incomparable versions because any valid plan action MUST satisfy the baseline -- and so must be comparable.