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

Address performance regression introduced by #90218 #90845

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

JakobDegen
Copy link
Contributor

As part of the changes in #90218 , the adt_drop_tys and friends code stopped recursing through the query system, meaning that intermediate computations did not get cached. This change adds the recursions back in without re-introducing any of the old issues.

On local benchmarks this fixes the 5% regressions in #90504 ; the wg-grammar regressions didn't seem to move too much. I may take some time later to look into those.

Not sure who to request for review here, so will leave it up to whoever gets it.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 12, 2021
@matthewjasper
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Nov 13, 2021

⌛ Trying commit e0269a0aa302126ff020ff09791bfde05f8620dd with merge 5edbd592d7d24d3910283d67f944fc057d860f7d...

@Mark-Simulacrum
Copy link
Member

(Feel free to review as well, but I can try to help if you don't have a chance)

@bors
Copy link
Contributor

bors commented Nov 13, 2021

☀️ Try build successful - checks-actions
Build commit: 5edbd592d7d24d3910283d67f944fc057d860f7d (5edbd592d7d24d3910283d67f944fc057d860f7d)

@rust-timer
Copy link
Collaborator

Queued 5edbd592d7d24d3910283d67f944fc057d860f7d with parent e90c5fb, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5edbd592d7d24d3910283d67f944fc057d860f7d): comparison url.

Summary: This change led to very large relevant improvements 🎉 in compiler performance.

  • Very large improvement in instruction counts (up to -5.1% on full builds of regression-31157)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 13, 2021
compiler/rustc_ty_utils/src/needs_drop.rs Outdated Show resolved Hide resolved
compiler/rustc_ty_utils/src/needs_drop.rs Outdated Show resolved Hide resolved
@JakobDegen
Copy link
Contributor Author

Refactored more generally and extracted some of the uglyness out into a function, this both avoids the double allocation and makes things more readable

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

but I think this looks good to me -- presuming perf is still good after refactoring (as expected), r=me

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Nov 14, 2021

⌛ Trying commit 746091c with merge 922d360035cc6fd56a30063435326ce1495ea99c...

@bors
Copy link
Contributor

bors commented Nov 14, 2021

☀️ Try build successful - checks-actions
Build commit: 922d360035cc6fd56a30063435326ce1495ea99c (922d360035cc6fd56a30063435326ce1495ea99c)

@rust-timer
Copy link
Collaborator

Queued 922d360035cc6fd56a30063435326ce1495ea99c with parent 3b2c454, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (922d360035cc6fd56a30063435326ce1495ea99c): comparison url.

Summary: This change led to very large relevant improvements 🎉 in compiler performance.

  • Very large improvement in instruction counts (up to -5.1% on full builds of regression-31157)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 14, 2021
@JakobDegen
Copy link
Contributor Author

@Mark-Simulacrum perf seems to look good, but I believe I don't have perms to r= you

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 14, 2021

📌 Commit 746091c has been approved by Mark-Simulacrum

@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 Nov 14, 2021
@bors
Copy link
Contributor

bors commented Nov 14, 2021

⌛ Testing commit 746091c with merge 3a744751d561e69b5e3e5468db5223ad04c81368...

@bors
Copy link
Contributor

bors commented Nov 15, 2021

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 15, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@JakobDegen
Copy link
Contributor Author

Is this a genuine failure or spurious? I'm not terribly great at reading Bors logs

@the8472
Copy link
Member

the8472 commented Nov 15, 2021

Segfault during bootstrap, CI has been having a few of those lately (#90812)

@bors retry

@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 Nov 15, 2021
@bors
Copy link
Contributor

bors commented Nov 16, 2021

⌛ Testing commit 746091c with merge a2a7683...

@bors
Copy link
Contributor

bors commented Nov 16, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing a2a7683 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 16, 2021
@bors bors merged commit a2a7683 into rust-lang:master Nov 16, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 16, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a2a7683): comparison url.

Summary: This change led to very large relevant improvements 🎉 in compiler performance.

  • Very large improvement in instruction counts (up to -5.1% on full builds of regression-31157)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@JakobDegen JakobDegen deleted the adt-drop-perf branch November 17, 2021 02:36
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 26, 2022
…ion, r=cjgillot

Restrict query recursion in `needs_significant_drop`

Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct.

Closes rust-lang#92725 .

This is essentially a revert of rust-lang#90845 for the significant drop case only. The general `needs_drop` still does the same thing. The hope is that this is enough to preserve the performance improvements of that PR while fixing the ICE. Should get a perf run to verify that this is the case.

cc `@cjgillot`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants