-
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
Optimize incremental_verify_ich
#109371
Optimize incremental_verify_ich
#109371
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
These commits modify compiler targets. These commits modify the If this was intentional then you can ignore this comment. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit a00cf9280d48328a9f31c1f212d4f843b05ff5c4 with merge 057c6329ca8ff62e8e5c6a26d5fd1d6b7b6fbc12... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (057c6329ca8ff62e8e5c6a26d5fd1d6b7b6fbc12): comparison URL. Overall result: ✅ improvements - no 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. @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.
|
Let's do a perf run with |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 2e7c50f62afbdf4fea28ea789d5d1a2d8ddee77f with merge 64c144e1a80f93ec678f258c8569a703deef71ad... |
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (64c144e1a80f93ec678f258c8569a703deef71ad): comparison URL. Overall result: ✅ improvements - no 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. @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.
|
pub fn is_green(&self, dep_node: &DepNode<K>) -> bool { | ||
self.node_color(dep_node).map_or(false, |c| c.is_green()) | ||
#[inline] | ||
pub fn is_index_green(&self, prev_index: SerializedDepNodeIndex) -> bool { |
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.
Can this still be called is_green
, or is there a conflict?
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.
It can. I just renamed it to contrast with the other is_green
method.
let _current_fingerprint = | ||
crate::query::incremental_verify_ich(cx, data, result, &node, hash_result); | ||
if let Some(prev_index) = data.previous.node_to_index_opt(&node) | ||
&& let Some(dep_node_index) = { data.current.prev_index_to_index.lock()[prev_index] } |
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.
&& let Some(dep_node_index) = { data.current.prev_index_to_index.lock()[prev_index] } | |
// Wrap the call to `lock()` in braces to unlock it before proceeding. | |
&& let Some(dep_node_index) = { data.current.prev_index_to_index.lock()[prev_index] } |
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.
You can't use braces like that to shorted lifetimes. I changed it to use nested if
s instead.
}, | ||
} | ||
} | ||
Tcx::with_context(|tcx| { |
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.
Can we just pass tcx
as an argument to incremental_verify_ich_not_green
?
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.
Yes. I avoided passing it so it wouldn't affect the hot path. It's a quite minor improvement though.
#[cold] | ||
fn incremental_verify_ich_failed(sess: &Session, dep_node: DebugArg<'_>, result: DebugArg<'_>) { | ||
#[inline(never)] | ||
fn incremental_verify_ich_failed<Tcx>(prev_index: SerializedDepNodeIndex, result: &dyn Debug) |
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.
Likewise, can we pass tcx
here?
I changed it to pass |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 820e3a8 with merge 223ac5351eb2e7ef0fc641afb06ec00d6fae10b5... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (223ac5351eb2e7ef0fc641afb06ec00d6fae10b5): comparison URL. Overall result: ✅ improvements - no 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. @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.
|
@bors r+ |
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
Finished benchmarking commit (e10eab5): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression 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.
|
This optimizes
incremental_verify_ich
by operating onSerializedDepNodeIndex
, saving 2 hashmap lookups. The panic paths are also changed to get aTyCtxt
reference using TLS.