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

Don't use projection cache or candidate cache in intercrate mode #89125

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

Aaron1011
Copy link
Member

Fixes #88969

It appears that just disabling the evaluation cache (in #88994)
leads to other issues involving intercrate mode caching. I suspect
that since we now always end up performing the full evaluation
in intercrate mode, we end up 'polluting' the candidate and projection
caches with results that depend on being in intercrate mode in some way.
Previously, we might have hit a cached evaluation (stored during
non-intercrate mode), and skipped doing this extra work in
intercrate mode.

The whole situation with intercrate mode caching is turning into
a mess. Ideally, we would remove intercrate mode entirely - however,
this might require waiting on Chalk.

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

cc @rust-lang/wg-traits

@jackh726
Copy link
Member

If this is only disabling caches, the r=me with appropriate comments added

Fixes rust-lang#88969

It appears that *just* disabling the evaluation cache (in rust-lang#88994)
leads to other issues involving intercrate mode caching. I suspect
that since we now always end up performing the full evaluation
in intercrate mode, we end up 'polluting' the candidate and projection
caches with results that depend on being in intercrate mode in some way.
Previously, we might have hit a cached evaluation (stored during
non-intercrate mode), and skipped doing this extra work in
intercrate mode.

The whole situation with intercrate mode caching is turning into
a mess. Ideally, we would remove intercrate mode entirely - however,
this might require waiting on Chalk.
@Aaron1011
Copy link
Member Author

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Sep 20, 2021

📌 Commit 6dbb9d4 has been approved by 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 20, 2021
@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

@bors
Copy link
Contributor

bors commented Sep 20, 2021

🙅 Please do not try after a pull request has been r+ed. If you need to try, unapprove (r-) it first.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 20, 2021
@Aaron1011
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 20, 2021
@Aaron1011
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Sep 20, 2021

⌛ Trying commit 6dbb9d4 with merge 8d03c9c947571bf681dc63b203b921ee9f76eed5...

@bors
Copy link
Contributor

bors commented Sep 20, 2021

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

1 similar comment
@bors
Copy link
Contributor

bors commented Sep 20, 2021

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

@rust-timer
Copy link
Collaborator

Queued 8d03c9c947571bf681dc63b203b921ee9f76eed5 with parent 3bb9eec, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8d03c9c947571bf681dc63b203b921ee9f76eed5): comparison url.

Summary: This change led to moderate relevant regressions 😿 in compiler performance.

  • Moderate regression in instruction counts (up to 1.0% on incr-full builds of diesel)

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. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 20, 2021
@Aaron1011
Copy link
Member Author

This is a correctness fix, so we'll need to take the performance hit (at least until we can come up with a better solution).

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Sep 21, 2021

📌 Commit 6dbb9d4 has been approved by 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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 21, 2021
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

(Also, do we have a test case?)

// Don't use the projection cache in intercrate mode -
// the `infcx` may be re-used between intercrate in non-intercrate
// mode, which could lead to using incorrect cache results.
let use_cache = !selcx.is_intercrate();
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably the right answer is that the cache key incorporates the environment, and intercrate mode is part of the environment (this is how chalk approaches it).

@bors
Copy link
Contributor

bors commented Sep 21, 2021

⌛ Testing commit 6dbb9d4 with merge 7743c9f...

@bors
Copy link
Contributor

bors commented Sep 21, 2021

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing 7743c9f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 21, 2021
@bors bors merged commit 7743c9f into rust-lang:master Sep 21, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 21, 2021
@apiraino
Copy link
Contributor

@Aaron1011 should this be nominated for beta-backport?

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 29, 2021
@Aaron1011 Aaron1011 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 29, 2021
@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Sep 30, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 1, 2021
Add regression test for issues rust-lang#88969 and rust-lang#89119

This adds a regression test to complete rust-lang#89125, and thus for issues rust-lang#88969 and rust-lang#89119, which needed a test.

Used with multiple crates, [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f665e7e882059157e0f86cfb09c47187) minimized from `zvariant-2.8.0` reproduces the error on `nightly-2021-09-19`.

The test in this PR fails on master if the commit 6dbb9d4 from rust-lang#89125 is reverted, and passes otherwise since it's now fixed.

r? `@Aaron1011`
ehuss pushed a commit to ehuss/rust that referenced this pull request Oct 4, 2021
…jackh726

Don't use projection cache or candidate cache in intercrate mode

Fixes rust-lang#88969

It appears that *just* disabling the evaluation cache (in rust-lang#88994)
leads to other issues involving intercrate mode caching. I suspect
that since we now always end up performing the full evaluation
in intercrate mode, we end up 'polluting' the candidate and projection
caches with results that depend on being in intercrate mode in some way.
Previously, we might have hit a cached evaluation (stored during
non-intercrate mode), and skipped doing this extra work in
intercrate mode.

The whole situation with intercrate mode caching is turning into
a mess. Ideally, we would remove intercrate mode entirely - however,
this might require waiting on Chalk.
@ehuss ehuss mentioned this pull request Oct 4, 2021
@ehuss ehuss removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 4, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 4, 2021
[beta] Beta rollup

* Fix WinUWP std compilation errors due to I/O safety rust-lang#88587
* Disable RemoveZsts in generators to avoid query cycles rust-lang#88979
* Disable the evaluation cache when in intercrate mode rust-lang#88994
* Fix linting when trailing macro expands to a trailing semi rust-lang#88996
* Don't use projection cache or candidate cache in intercrate mode rust-lang#89125
* 2229: Mark insignificant dtor in stdlib rust-lang#89144
* Temporarily rename int_roundings functions to avoid conflicts rust-lang#89184
* [rfc 2229] Drop fully captured upvars in the same order as the regular drop code rust-lang#89208
* Use the correct edition for syntax highlighting doctests rust-lang#89277
* Don't normalize opaque types with escaping late-bound regions rust-lang#89285
* Update Let's Encrypt ROOT CA certificate in dist-(i686|x86_64)-linux docker images rust-lang#89486

Cargo update:
* - [beta] 1.56 backports (rust-lang/cargo#9958)
* - [beta] Revert "When a dependency does not have a version, git or path… (rust-lang/cargo#9912)
* - [beta] Fix rustc --profile=dev unstable check. (rust-lang/cargo#9901)
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.57.0, 1.56.0 Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression: Copy no longer implemented