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

Only use normalize_param_env when normalizing predicate in check_item_bounds #117542

Merged
merged 1 commit into from Nov 8, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Nov 3, 2023

Only use the normalize_param_env when normalizing the item bound predicate in check_item_bounds, instead of using it when processing this obligation as well. This causes #117606 to reoccur, but hopefully with better caching in the future, we can fix this without having such bad effects on perf.

This PR also fixes #117598. It turns out that the GAT predicate that we install is actually wrong -- given code like:

impl<'r> HasValueRef<'r> for Any {
    type Database = Any;
}

We currently generate a predicate that looks like <Any as HasValueRef<'r>>::Database = Any, where 'r is an early-bound variable. Really this GAT assumption should be universally quantified over the impl's args, i.e. for<'r> <Any as HasValueRef<'r>>::Database = Any, but then we'd need the binder to also include all the WC of the impl as well, which we don't support yet, lol.

@rustbot rustbot added 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 Nov 3, 2023
@compiler-errors
Copy link
Member Author

@bors try @rust-timer queue

cc #117131 (comment)

@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 Nov 3, 2023
@bors
Copy link
Contributor

bors commented Nov 3, 2023

⌛ Trying commit 66a1d57 with merge 950874d...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 3, 2023
…cate, r=<try>

Only use `normalize_param_env` when normalizing predicate in `check_item_bounds`

r? `@ghost`
@bors
Copy link
Contributor

bors commented Nov 3, 2023

☀️ Try build successful - checks-actions
Build commit: 950874d (950874d8c4bc441630d6dc485be7b87f9c3d97e4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (950874d): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

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-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)
1.5% [1.3%, 1.7%] 5
Improvements ✅
(primary)
-17.7% [-50.0%, -0.2%] 21
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) -17.7% [-50.0%, -0.2%] 21

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)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-12.8% [-19.0%, -2.8%] 14
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.4%] 3
All ❌✅ (primary) -11.8% [-19.0%, 1.5%] 15

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)
3.5% [2.4%, 4.4%] 5
Improvements ✅
(primary)
-27.5% [-50.9%, -7.1%] 13
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -27.5% [-50.9%, -7.1%] 13

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 637.051s -> 637.852s (0.13%)
Artifact size: 304.48 MiB -> 304.51 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 3, 2023
@compiler-errors
Copy link
Member Author

r? lcnr

@rust-log-analyzer

This comment has been minimized.

@@ -2217,8 +2217,11 @@ pub(super) fn check_type_bounds<'tcx>(
.collect();
debug!("check_type_bounds: item_bounds={:?}", obligations);

// Normalize predicates with the assumption
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a fixme that we should use this param_env everywhere, but can't due to perf, referencing this PR? At least that's my understanding here?

r=me afterwards

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 7, 2023
Only instantiate binder during dyn's built-in trait candidate probe once

See UI test for demonstration of the issue.

This was "caused" by rust-lang#117131, but only because we're using the `normalize_param_env` (which has been augmented with a projection clause used to normalize GATs) which features non-lifetime bound vars in it.

Fixes rust-lang#117602 technically, though that's also fixed by rust-lang#117542.

r? types
@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Nov 8, 2023

📌 Commit 97c9d8f has been approved by lcnr

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 Nov 8, 2023
@bors
Copy link
Contributor

bors commented Nov 8, 2023

⌛ Testing commit 97c9d8f with merge fab1054...

@bors
Copy link
Contributor

bors commented Nov 8, 2023

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing fab1054 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 8, 2023
@bors bors merged commit fab1054 into rust-lang:master Nov 8, 2023
12 checks passed
@rustbot rustbot added this to the 1.75.0 milestone Nov 8, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fab1054): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
1.4% [0.8%, 2.3%] 12
Improvements ✅
(primary)
-18.4% [-49.6%, -0.2%] 20
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -17.5% [-49.6%, 0.4%] 21

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)
1.3% [0.4%, 4.5%] 6
Regressions ❌
(secondary)
4.6% [4.6%, 4.6%] 1
Improvements ✅
(primary)
-10.7% [-20.4%, -0.5%] 17
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) -7.5% [-20.4%, 4.5%] 23

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.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
3.7% [3.5%, 3.9%] 3
Improvements ✅
(primary)
-25.3% [-50.9%, -0.5%] 14
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -23.5% [-50.9%, 0.5%] 15

Binary size

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.0% [0.0%, 0.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 664.216s -> 664.739s (0.08%)
Artifact size: 308.79 MiB -> 308.70 MiB (-0.03%)

@nnethercote
Copy link
Contributor

Amazing improvements for bitmaps-3.1.0! And the perf wins outweigh the losses in general.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Nov 8, 2023
@lqd
Copy link
Member

lqd commented Nov 8, 2023

(Note: the wins are fixing #117131 (comment))

@compiler-errors
Copy link
Member Author

Yeah sorry y'all, this PR simplify fixes a regression both in behavior and perf.

@compiler-errors compiler-errors deleted the only-normalize-predicate branch November 8, 2023 20:22
akoshelev added a commit to akoshelev/raw-ipa that referenced this pull request Nov 10, 2023
Fixes private-attribution#837 because the underlying issue rust-lang/rust#117542 is fixed
akoshelev added a commit to private-attribution/ipa that referenced this pull request Nov 17, 2023
Fixes #837 because the underlying issue rust-lang/rust#117542 is fixed
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. 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
None yet
Development

Successfully merging this pull request may close these issues.

Recent nightly causes [E0308]: mismatched types
8 participants