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

Remove concept of 'completion' from the projection cache #88945

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

Aaron1011
Copy link
Member

Fixes #88910

When we initially store a NormalizedTy in the projection cache,
we discard all obligations that we can (while ensuring that we
don't cause any issues with incremental compilation).

Marking a projection cache entry as 'completed' discards all
obligations associated with it. This can only cause problems,
since any obligations stored in the cache are there for a reason
(e.g. they evaluate to EvaluatedToOkModuloRegions).

This commit removes complete and complete_normalized entirely.

Fixes rust-lang#88910

When we initially store a `NormalizedTy` in the projection cache,
we discard all obligations that we can (while ensuring that we
don't cause any issues with incremental compilation).

Marking a projection cache entry as 'completed' discards all
obligations associated with it. This can only cause problems,
since any obligations stored in the cache are there for a reason
(e.g. they evaluate to `EvaluatedToOkModuloRegions`).

This commit removes `complete` and `complete_normalized` entirely.
@rust-highfive
Copy link
Collaborator

r? @wesleywiser

(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 Sep 14, 2021
@Aaron1011
Copy link
Member Author

I've verified locally that this fixes #88910. However, the substrate-node-template project is enormous (it has 834 dependencies, and the crate itself takes a few minutes to compile on my machine), so I haven't attempted a minimization yet.

This PR can only ever cause us to preserve more sub-obligations in the cache, so this can't cause any correctness issues.

@Aaron1011
Copy link
Member Author

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

bors commented Sep 14, 2021

⌛ Trying commit 055651d with merge aefb79dfee71c0899b706198d9d9f4ca30ca395d...

@bors
Copy link
Contributor

bors commented Sep 14, 2021

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

@rust-timer
Copy link
Collaborator

Queued aefb79dfee71c0899b706198d9d9f4ca30ca395d with parent c3c0f80, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (aefb79dfee71c0899b706198d9d9f4ca30ca395d): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Very small improvement in instruction counts (up to -0.3% on incr-patched: println builds of deep-vector)
  • Moderate regression in instruction counts (up to 0.9% on full builds of wg-grammar)

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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 14, 2021
Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

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

The reasoning and code look good to me and the perf regression seems acceptable since this closes an incremental issue, but I would like to make sure wg-traits is aware this is happening. r=me with an acknowledgement from them.

cc @nikomatsakis @jackh726

@jackh726
Copy link
Member

This looks fine to me; these obligations can get cached in the fulfill code anyways (which is probably why there isn't a big regression).

Though I don't think this change in particular will cause any regressions, I do just want to register a slight worry, particularly seeing issues like #88969 pop up. I suppose this mostly just stems from the fact that we still don't have a test for #85868. The more we mess with this code, the more I'd really like a regression test.

@jackh726
Copy link
Member

@bors r=wesleywiser,jackh726

@bors
Copy link
Contributor

bors commented Sep 16, 2021

📌 Commit 055651d has been approved by wesleywiser,jackh726

@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 Sep 16, 2021
@bors
Copy link
Contributor

bors commented Sep 17, 2021

⌛ Testing commit 055651d with merge e0c38af...

@bors
Copy link
Contributor

bors commented Sep 17, 2021

☀️ Test successful - checks-actions
Approved by: wesleywiser,jackh726
Pushing e0c38af to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 17, 2021
@bors bors merged commit e0c38af into rust-lang:master Sep 17, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 17, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e0c38af): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Small improvement in instruction counts (up to -0.4% on incr-full builds of ctfe-stress-4)
  • Moderate regression in instruction counts (up to 0.8% on full builds of wg-grammar)

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

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

@pnkfelix
Copy link
Member

Visited for weekly performance triage. All wg-grammar-* consistently regressed by about 0.75% (both full and incr-full). The builds for regression-31157-check regressed by about 0.36%, which isn't as bad.

Under our new significance metrics, the ctfe-stress-4 changes are not considered signficant.

Seems like something might be worth looking into here. (But did not hit very many benchmarks, so time might be better spent elsewhere. Definitely don't spend too much time on it.)

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. perf-regression Performance regression. 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.

incremental compilation error with evaluate_obligation when building substrate
8 participants