Remove nodes_in_current_session field and related assertions#154283
Remove nodes_in_current_session field and related assertions#154283rust-bors[bot] merged 1 commit intorust-lang:mainfrom
nodes_in_current_session field and related assertions#154283Conversation
|
rustbot has assigned @jdonszelmann. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
922660c to
267d6cf
Compare
|
This looks reasonable to me, but I'm no expert on the query system. Going to defer to @nnethercote (or someone else if that's better) r? @nnethercote |
| } | ||
|
|
||
| #[cfg(debug_assertions)] | ||
| fn record_edge( |
There was a problem hiding this comment.
I'd prefer to keep this entire function cfg(debug_assertions), and then likewise at the call sites. It makes it clearer that it's all debug-only, and avoids the need for the underscores on the parameter names.
There was a problem hiding this comment.
I was thinking of just converting this to cfg!.
There was a problem hiding this comment.
#[cfg] makes the call sites clearer.
There was a problem hiding this comment.
Why?
I basically always prefer if cfg! to #[cfg] when technically possible because it doesn't hide the configured-out code from type checker and other later passes.
There was a problem hiding this comment.
Fine, whatever, just do cfg! then.
There was a problem hiding this comment.
Should I do it in this PR? I was thinking of making a follow-up PR.
There was a problem hiding this comment.
Just do it here, save the trouble of filing a follow-up
267d6cf to
14b2173
Compare
This comment has been minimized.
This comment has been minimized.
| forbidden_edge, | ||
| #[cfg(debug_assertions)] | ||
| value_fingerprints: Lock::new(IndexVec::from_elem_n(None, new_node_count_estimate)), | ||
| value_fingerprints: Lock::new(if cfg!(debug_assertions) { |
There was a problem hiding this comment.
Now we are always doing work that we were only doing in debug builds, because we have fields in the struct that we used to only have in debug builds.
Sorry, I didn't realize that switching to cfg! would cause this. I think this goes too far. I suggest just removing this second commit and going with the original first commit which uses #[cfg(debug_attributes)] within record_edge.
There was a problem hiding this comment.
I am tempted to add a DebugOnly type so we can have fields only present with debug_assertions, but still get type checking. That would be useful elsewhere too. Would that be sufficient given that the extra work would optimize away?
There was a problem hiding this comment.
Not sure I like that, but it would definitely be a separate PR anyway.
14b2173 to
736242c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
736242c to
0add85c
Compare
|
@bors r+ rollup |
…uwer Rollup of 10 pull requests Successful merges: - #154794 (Add on_unmatch_args) - #155133 (Document precision considerations of `Duration`-float methods) - #154283 (Remove `nodes_in_current_session` field and related assertions) - #155374 (rustdoc: fix a few spots where emit isn't respected) - #155587 (Immediately feed visibility on DefId creation) - #155622 (c-variadic: `va_arg` fixes ) - #155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`) - #155632 (Some metadata cleanups) - #155639 (BinOpAssign always returns unit) - #155647 (rustc-dev-guide subtree update)
Rollup merge of #154283 - Zoxc:rem-nodes_in_current_session, r=nnethercote Remove `nodes_in_current_session` field and related assertions This removes the `nodes_in_current_session` field and related assertions. These are enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. Historically these have been useful to catch query keys with improper `HashStable` impls which lead to collisions. We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session. We also have the `verify_query_key_hashes` which is also enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present. I think these remaining checks are sufficient and so we can remove `nodes_in_current_session`.
|
@rust-timer build 1a7e42e |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (1a7e42e): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -6.1%, secondary -5.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -4.6%, secondary -7.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 492.288s -> 492.321s (0.01%) |
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#154794 (Add on_unmatch_args) - rust-lang/rust#155133 (Document precision considerations of `Duration`-float methods) - rust-lang/rust#154283 (Remove `nodes_in_current_session` field and related assertions) - rust-lang/rust#155374 (rustdoc: fix a few spots where emit isn't respected) - rust-lang/rust#155587 (Immediately feed visibility on DefId creation) - rust-lang/rust#155622 (c-variadic: `va_arg` fixes ) - rust-lang/rust#155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`) - rust-lang/rust#155632 (Some metadata cleanups) - rust-lang/rust#155639 (BinOpAssign always returns unit) - rust-lang/rust#155647 (rustc-dev-guide subtree update)
View all comments
This removes the
nodes_in_current_sessionfield and related assertions. These are enabled if-Z incremental-verify-ichis passed ordebug_assertionsis on. Historically these have been useful to catch query keys with improperHashStableimpls which lead to collisions.We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session.
We also have the
verify_query_key_hasheswhich is also enabled if-Z incremental-verify-ichis passed ordebug_assertionsis on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present.I think these remaining checks are sufficient and so we can remove
nodes_in_current_session.