-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Create a separate query for required and mentioned items instead of tracking them in the MIR body #123488
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
//@revisions: noopt opt | ||
//@build-pass | ||
//@build-fail | ||
//@[noopt] compile-flags: -Copt-level=0 | ||
//@[opt] compile-flags: -O | ||
//! This passes without optimizations, so it can (and should) also pass with optimizations. |
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.
@RalfJung I'm assuming the previous behaviour was a bug?
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 intent was for it to pass with and without optimizations. Making this fail seems like it would be pretty bad for perf as we will have to consider all implicit destructors "mentioned" even when we know for sure they won't be called! I think it is quite important to gather "mentioned" items after drop elaboration, otherwise there's no way we are going to get decent performance here.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Create a separate query for required and mentioned items instead of tracking them in the MIR body implements rust-lang#122862 (comment) May permit further improvements without sacrificing perf... iff this PR isn't horrible for perf 🙃
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Create a separate query for required and mentioned items instead of tracking them in the MIR body implements rust-lang#122862 (comment) May permit further improvements without sacrificing perf... iff this PR isn't horrible for perf 🙃
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
…racking them in the MIR body
729334a
to
c4e09b5
Compare
The Miri subtree was changed cc @rust-lang/miri |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Create a separate query for required and mentioned items instead of tracking them in the MIR body implements rust-lang#122862 (comment) May permit further improvements without sacrificing perf... iff this PR isn't horrible for perf 🙃
A bit busy this weekend, sorry r? compiler |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
r? saethlin |
Finished benchmarking commit (63e1afc): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 668.072s -> 673.251s (0.78%) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Create a separate query for required and mentioned items instead of tracking them in the MIR body implements rust-lang#122862 (comment) May permit further improvements without sacrificing perf... iff this PR isn't horrible for perf 🙃
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (fdf29c5): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 667.559s -> 673.416s (0.88%) |
} | ||
Const::Val(..) | Const::Unevaluated(..) => true, | ||
}, | ||
)); |
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.
Not incorporating inlined consts can lead to ICEs in the interpreter: we may be inlining a function that contains a const that fails. The interpreter will evaluate all required_consts (which would not include the inlined const) and then assert that all const-eval during function evaluation succeeds.
} else { | ||
// If we can't find the callee, there's no point in adding its items. | ||
// Probably it already got removed by being inlined elsewhere in the same function. | ||
} |
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.
Removing this optimization will also not be great for perf, as it means the "mentioned items" traversal has to visit all the functions that got inlined.
A large part of the perf problems probably comes from the fact that mentioned_items is a lot bigger with this PR than it is currently. Ideally we can keep the set itself entirely unchanged, and just change the way it is stored. I don't know what is the best way to do that. Maybe something like this: A MIR body contains something similar to a In the local crate, when we ask for mentioned items, we run the optimized_mir query and then we can return the mentioned_items result. For dependencies, when we ask for mentioned items, we deserialize them from disk -- and we don't have to load the entire MIR body for that. |
implements #122862 (comment)
May permit further improvements without sacrificing perf... iff this PR isn't horrible for perf 🙃