-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc: Sort CGUs before merging #46918
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
Merged
Merged
Conversation
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
This commit fixes some nondeterminism in compilation when using multiple codegen units. The algorithm for splitting codegen units currently takes the otherwise-would-be-for-incremental partitioning and then continuously merges the two smallest codegen units until the desired number of codegen units are reached. We want to be sure to merge the same codegen units each time a compilation is run but there's some subtle reorderings amongst all the items which was causing this step to be slightly buggy. Notably this step involves sorting codegen units by size, but if two codegen units had the same size they would appear in different locations in the list each time. This commit fixes this issue by sorting codegen units by name before doing the loop to merge the two smallest. This means that we've got a deterministic order going in and since we're using a stable sort this should mean that we're always now getting a deterministic merging of codegen units. Closes rust-lang#46846
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ Thanks, @alexcrichton! |
📌 Commit 427e630 has been approved by |
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Dec 21, 2017
…lwoerister rustc: Sort CGUs before merging This commit fixes some nondeterminism in compilation when using multiple codegen units. The algorithm for splitting codegen units currently takes the otherwise-would-be-for-incremental partitioning and then continuously merges the two smallest codegen units until the desired number of codegen units are reached. We want to be sure to merge the same codegen units each time a compilation is run but there's some subtle reorderings amongst all the items which was causing this step to be slightly buggy. Notably this step involves sorting codegen units by size, but if two codegen units had the same size they would appear in different locations in the list each time. This commit fixes this issue by sorting codegen units by name before doing the loop to merge the two smallest. This means that we've got a deterministic order going in and since we're using a stable sort this should mean that we're always now getting a deterministic merging of codegen units. Closes rust-lang#46846
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
This commit fixes some nondeterminism in compilation when using multiple codegen
units. The algorithm for splitting codegen units currently takes the
otherwise-would-be-for-incremental partitioning and then continuously merges the
two smallest codegen units until the desired number of codegen units are
reached.
We want to be sure to merge the same codegen units each time a compilation is
run but there's some subtle reorderings amongst all the items which was causing
this step to be slightly buggy. Notably this step involves sorting codegen units
by size, but if two codegen units had the same size they would appear in
different locations in the list each time.
This commit fixes this issue by sorting codegen units by name before doing the
loop to merge the two smallest. This means that we've got a deterministic
order going in and since we're using a stable sort this should mean that we're
always now getting a deterministic merging of codegen units.
Closes #46846