Skip to content
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

feed resolver_for_lowering instead of storing it in a field #105220

Merged
merged 3 commits into from
Dec 6, 2022

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 3, 2022

r? @cjgillot

opening this as

  • a discussion for no_hash + feedable queries. I think we'll want those, but I don't quite understand why they are rejected beyond a double check of the stable hashes for situations where the query is fed but also read from incremental caches.
  • and a discussion on removing all untracked fields from TyCtxt and setting it up so that they are fed queries instead

@rustbot
Copy link
Collaborator

rustbot commented Dec 3, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cjgillot (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 3, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 3, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 3, 2022

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 3, 2022
@bors
Copy link
Contributor

bors commented Dec 3, 2022

⌛ Trying commit 8eaad0d80b335214431ae613c66b11ff12cb36ff with merge 9ab71a5530ee352a73aeea36f60a172ce1f332ea...

@bors
Copy link
Contributor

bors commented Dec 3, 2022

☀️ Try build successful - checks-actions
Build commit: 9ab71a5530ee352a73aeea36f60a172ce1f332ea (9ab71a5530ee352a73aeea36f60a172ce1f332ea)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9ab71a5530ee352a73aeea36f60a172ce1f332ea): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-3.5%, -1.1%] 6
All ❌✅ (primary) - - 0

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
9.6% [9.6%, 9.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.3% [-1.8%, -0.9%] 10
Improvements ✅
(secondary)
-3.0% [-4.2%, -1.4%] 14
All ❌✅ (primary) -0.3% [-1.8%, 9.6%] 11

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 4, 2022
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason I disallowed no_hash was because I hadn't found a use case.
This one is great! I have 2 suggestions, and r=me.

compiler/rustc_middle/src/ty/query.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/context.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 5, 2022

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Dec 5, 2022

📌 Commit f693b78 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2022
@bors
Copy link
Contributor

bors commented Dec 6, 2022

⌛ Testing commit f693b78 with merge ed61c13...

@bors
Copy link
Contributor

bors commented Dec 6, 2022

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing ed61c13 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 6, 2022
@bors bors merged commit ed61c13 into rust-lang:master Dec 6, 2022
@rustbot rustbot added this to the 1.67.0 milestone Dec 6, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ed61c13): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.3%] 2
Regressions ❌
(secondary)
0.5% [0.1%, 0.8%] 15
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) 0.2% [0.2%, 0.3%] 2

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
7.7% [7.7%, 7.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-6.5%, -1.6%] 3
All ❌✅ (primary) 0.1% [0.1%, 0.1%] 1

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

@rustbot rustbot added the perf-regression Performance regression. label Dec 6, 2022
@oli-obk oli-obk deleted the feeding branch December 6, 2022 08:14
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 6, 2022

While the performance looks like it is not noise, looking at it with cachegrind yields only inliner noise:

110,101,744  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::is_terminal_path
 67,503,324  ???:<rustc_infer::infer::combine::CombineFields>::instantiate
-54,068,248  ???:<rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::tys
-14,745,244  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_dataflow::impls::MaybeUninitializedPlaces as rustc_mir_dataflow::framework::GenKillAnalysis>::statement_effect<rustc_index::bit_set::ChunkedBitSet<rustc_mir_dataflow::move_paths::MovePathIndex>>::{closure
-13,892,472  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_dataflow::impls::MaybeInitializedPlaces as rustc_mir_dataflow::framework::GenKillAnalysis>::statement_effect<rustc_index::bit_set::ChunkedBitSet<rustc_mir_dataflow::move_paths::MovePathIndex>>::{closure
 -6,814,818  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<&mut rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_dataflow::impls::MaybeUninitializedPlaces as rustc_mir_dataflow::framework::GenKillAnalysis>::statement_effect<rustc_index::bit_set::ChunkedBitSet<rustc_mir_dataflow::move_paths::MovePathIndex>>::{closure
 -6,418,962  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<&mut rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_dataflow::impls::MaybeInitializedPlaces as rustc_mir_dataflow::framework::GenKillAnalysis>::statement_effect<rustc_index::bit_set::ChunkedBitSet<rustc_mir_dataflow::move_paths::MovePathIndex>>::{closure
 -4,980,660  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_transform::elaborate_drops::ElaborateDropsCtxt>::drop_flags_for_locs::{closure
 -2,752,512  ???:rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<&mut rustc_mir_dataflow::drop_flag_effects::drop_flag_effects_for_location<<rustc_mir_transform::elaborate_drops::ElaborateDropsCtxt>::drop_flags_for_locs::{closure
 -1,965,767  ???:<rustc_trait_selection::traits::select::SelectionContext>::select
   -983,094  ???:<ena::unify::UnificationTable<ena::unify::backing_vec::InPlace<rustc_type_ir::TyVid, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_type_ir::TyVid>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs>>>::uninlined_get_root_key
   -917,494  ???:<rustc_middle::mir::syntax::Rvalue>::ty::<rustc_middle::mir::Body>
   -917,490  ???:<rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::statement
   -851,932  ???:<rustc_middle::mir::BasicBlockData>::expand_statements::<<rustc_mir_transform::deaggregator::Deaggregator as rustc_middle::mir::MirPass>::run_pass::{closure
   -786,405  ???:<rustc_mir_dataflow::framework::engine::Engine<rustc_borrowck::dataflow::Borrows>>::iterate_to_fixpoint
    524,329  ???:<rustc_borrowck::type_check::TypeChecker>::typeck_mir
    524,304  ???:<rustc_borrowck::borrow_set::BorrowSet>::build
    524,280  ???:<core::iter::adapters::map::Map<core::ops::range::Range<usize>, <rustc_const_eval::interpret::validity::ValidityVisitor<rustc_const_eval::const_eval::machine::CompileTimeInterpreter> as rustc_const_eval::interpret::visitor::ValueVisitor<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::walk_value::{closure
    262,152  ???:rustc_mir_transform::check_unsafety::unsafety_check_result
   -131,074  ???:<rustc_mir_build::build::Builder>::as_operand

@pnkfelix
Copy link
Member

pnkfelix commented Dec 6, 2022

Visiting for weekly performance triage

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 6, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
feed resolver_for_lowering instead of storing it in a field

r? `@cjgillot`

opening this as

* a discussion for `no_hash` + `feedable` queries. I think we'll want those, but I don't quite understand why they are rejected beyond a double check of the stable hashes for situations where the query is fed but also read from incremental caches.
* and a discussion on removing all untracked fields from TyCtxt and setting it up so that they are fed queries instead
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 18, 2023
… r=cjgillot

Don't allow evaluating queries that were fed in a previous compiler run

r? `@cjgillot`

this code was already unreachable. Also we removed the no_hash + feeding restriction in rust-lang#105220.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants