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

Move most of TyCtxtAt::$name into a generic evaluate_query function #101178

Closed
wants to merge 2 commits into from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Aug 30, 2022

Helps with #96524. This is based on #100943, so it looks larger than it is.

r? @cjgillot

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

jyn514 commented Aug 30, 2022

@bors try @rust-timer queue (will be noisy because the other PRs results are mixed in, but the other PR was mostly neutral)

@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 Aug 30, 2022
@bors
Copy link
Contributor

bors commented Aug 30, 2022

⌛ Trying commit 945c5aa1c444ce371df6331df39b15e0695132bd with merge 3a9c65e699f299095772bc2c587402acc7dfa3cb...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 30, 2022

💔 Test failed - checks-actions

@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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2022
@rust-log-analyzer

This comment has been minimized.

compiler/rustc_middle/src/ty/query.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/query.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Sep 1, 2022

☔ The latest upstream changes (presumably #100869) made this pull request unmergeable. Please resolve the merge conflicts.

@jyn514 jyn514 force-pushed the query-system-4 branch 2 times, most recently from 91a5a06 to c1584fa Compare September 2, 2022 00:28
@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 2, 2022
@cjgillot
Copy link
Contributor

cjgillot commented Sep 2, 2022

@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 2, 2022

⌛ Trying commit c1584fa72d4b55f73511e40558fc3b209551563e with merge cc5741e85142c1055aaecb2ce088feb90a8b5ab8...

@bors
Copy link
Contributor

bors commented Sep 2, 2022

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

@rust-timer
Copy link
Collaborator

Queued cc5741e85142c1055aaecb2ce088feb90a8b5ab8 with parent 9353538, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cc5741e85142c1055aaecb2ce088feb90a8b5ab8): comparison URL.

Overall result: ❌ regressions - 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-review -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.

mean1 range count2
Regressions ❌
(primary)
0.6% [0.3%, 1.2%] 16
Regressions ❌
(secondary)
1.0% [0.2%, 2.4%] 25
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.0% [-1.0%, -1.0%] 1
All ❌✅ (primary) 0.6% [0.3%, 1.2%] 16

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.

mean1 range count2
Regressions ❌
(primary)
2.2% [2.0%, 2.4%] 2
Regressions ❌
(secondary)
3.0% [2.0%, 4.0%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.8% [-7.5%, -1.6%] 5
All ❌✅ (primary) 2.2% [2.0%, 2.4%] 2

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.1% [2.3%, 15.8%] 17
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 2, 2022
@bors
Copy link
Contributor

bors commented Sep 7, 2022

⌛ Trying commit 3d9e006874c1230a89ea43942f314ce5ba23f8f4 with merge 43ab395f7c492c9ec65610e092ad26cb9879373e...

@jyn514
Copy link
Member Author

jyn514 commented Sep 7, 2022

It will be a shame to have to add back OnHit but I can do so if it improves perf.

@jyn514
Copy link
Member Author

jyn514 commented Sep 7, 2022

I can also split d2c53ca to a separate PR to rule out any perf impact, I'll do that this evening.

@bors
Copy link
Contributor

bors commented Sep 7, 2022

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

@cjgillot
Copy link
Contributor

cjgillot commented Sep 8, 2022

@rust-timer build 43ab395f7c492c9ec65610e092ad26cb9879373e

@rust-timer
Copy link
Collaborator

Queued 43ab395f7c492c9ec65610e092ad26cb9879373e with parent e7c7aa7, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (43ab395f7c492c9ec65610e092ad26cb9879373e): 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-review -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.

mean1 range count2
Regressions ❌
(primary)
0.7% [0.2%, 1.0%] 19
Regressions ❌
(secondary)
1.0% [0.3%, 2.4%] 41
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-1.3% [-1.4%, -1.1%] 3
All ❌✅ (primary) 0.6% [-0.4%, 1.0%] 20

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.0% [2.1%, 5.1%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-6.2%, -1.3%] 4
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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.8% [4.0%, 14.1%] 14
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@jyn514 jyn514 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 10, 2022
…ly returning Option

I think `copy` may have added some overhead? unclear what's causing the perf impact.
@jyn514
Copy link
Member Author

jyn514 commented Sep 10, 2022

If this doesn't work, I think I may just close the PR; this seems like unnecessarily much work for how little duplication it removes.

@jyn514
Copy link
Member Author

jyn514 commented Sep 10, 2022

@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 10, 2022
@bors
Copy link
Contributor

bors commented Sep 10, 2022

⌛ Trying commit 3675fdd with merge 9c9dde98c61b16603a24ce49807ef1c314a751d2...

@bors
Copy link
Contributor

bors commented Sep 10, 2022

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

@rust-timer
Copy link
Collaborator

Queued 9c9dde98c61b16603a24ce49807ef1c314a751d2 with parent 1d37ed6, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9c9dde98c61b16603a24ce49807ef1c314a751d2): comparison URL.

Overall result: ❌ regressions - 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-review -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.

mean1 range count2
Regressions ❌
(primary)
0.7% [0.2%, 1.9%] 60
Regressions ❌
(secondary)
1.8% [0.2%, 9.2%] 70
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 1
All ❌✅ (primary) 0.7% [0.2%, 1.9%] 60

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.

mean1 range count2
Regressions ❌
(primary)
1.3% [1.0%, 1.5%] 3
Regressions ❌
(secondary)
2.0% [1.3%, 2.4%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [1.0%, 1.5%] 3

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.

mean1 range count2
Regressions ❌
(primary)
2.5% [2.1%, 2.9%] 4
Regressions ❌
(secondary)
5.5% [2.2%, 15.1%] 21
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [2.1%, 2.9%] 4

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 10, 2022
…llot

Move `Queries::new` out of the macro

Split out from rust-lang#101178 to make sure it's not contributing to the perf impact.

r? `@cjgillot`
@jyn514 jyn514 closed this Sep 10, 2022
@jyn514 jyn514 deleted the query-system-4 branch September 10, 2022 13:57
#[inline(always)]
fn copy<T: Copy>(x: &T) -> T {
*x
fn evaluate_query<'tcx, Cache>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try this with #[inline(always)]? The callers all have that so this should regress without it.

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) perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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.

8 participants