Skip to content

Enable CrateNum query feeding via TyCtxt #123126

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

Merged
merged 5 commits into from
Apr 23, 2024
Merged

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Mar 27, 2024

Instead of having a magic function that violates some TyCtxtFeed invariants, add a create_def equivalent for CrateNums.

Note that this still isn't tracked by the query system (unlike create_def), and that feeding most CrateNum queries for crates other than the local one will likely cause performance regressions.

These things should be attempted on their own separately, but this PR should stand on its own

@rustbot
Copy link
Collaborator

rustbot commented Mar 27, 2024

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Mar 27, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 27, 2024

@bors try @rust-timer queue

@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 Mar 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2024
Enable `CrateNum` query feeding via `TyCtxt`

Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s.

Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions.

These things should be attempted on their own separately, but this PR should stand on its own
@bors
Copy link
Collaborator

bors commented Mar 27, 2024

⌛ Trying commit 36c0890 with merge 6244bac...

@bors
Copy link
Collaborator

bors commented Mar 27, 2024

☀️ Try build successful - checks-actions
Build commit: 6244bac (6244bacfe63a742193b8045731b144919700baae)

1 similar comment
@bors
Copy link
Collaborator

bors commented Mar 27, 2024

☀️ Try build successful - checks-actions
Build commit: 6244bac (6244bacfe63a742193b8045731b144919700baae)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6244bac): 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-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.3% [0.1%, 0.5%] 19
Regressions ❌
(secondary)
0.4% [0.2%, 0.6%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.1%, 0.5%] 19

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-5.0%, -0.6%] 13
Improvements ✅
(secondary)
-3.1% [-5.7%, -1.9%] 32
All ❌✅ (primary) -1.9% [-5.0%, -0.6%] 13

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.7% [0.6%, 0.8%] 4
Regressions ❌
(secondary)
4.8% [4.8%, 4.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.6%, 0.8%] 4

Binary size

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

Bootstrap: 669.488s -> 670.641s (0.17%)
Artifact size: 315.76 MiB -> 315.72 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 Mar 27, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 28, 2024

it looks like there are extra executions of incr_comp_encode_dep_graph, but I can't tell how that happens ☹️

@davidtwco
Copy link
Member

r=me unless you want to investigate this.

@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 19, 2024

@bors try @rust-timer queue

@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 Apr 19, 2024
@bors
Copy link
Collaborator

bors commented Apr 19, 2024

⌛ Trying commit e9a2f8f with merge 73c144d...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
Enable `CrateNum` query feeding via `TyCtxt`

Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s.

Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions.

These things should be attempted on their own separately, but this PR should stand on its own
@bors
Copy link
Collaborator

bors commented Apr 19, 2024

☀️ Try build successful - checks-actions
Build commit: 73c144d (73c144da054a01b634f764a9a60fb9e619a2cb14)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (73c144d): 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-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.3% [0.2%, 0.6%] 16
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.6%] 16

Max RSS (memory usage)

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

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

Binary size

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

Bootstrap: 672.208s -> 672.202s (-0.00%)
Artifact size: 315.30 MiB -> 315.27 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 19, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 23, 2024

I did some cachegrind runs, and it looks like a lot of inliner noise with some occasional extra DefId reads from cache. Afaict my code does not change how we interact with the cache, I went over it a few times and don't see anything.

@bors r=davidtwco

@bors
Copy link
Collaborator

bors commented Apr 23, 2024

📌 Commit e9a2f8f has been approved by davidtwco

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 Apr 23, 2024
@bors
Copy link
Collaborator

bors commented Apr 23, 2024

⌛ Testing commit e9a2f8f with merge 244da22...

@bors
Copy link
Collaborator

bors commented Apr 23, 2024

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 244da22 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 23, 2024
@bors bors merged commit 244da22 into rust-lang:master Apr 23, 2024
@rustbot rustbot added this to the 1.79.0 milestone Apr 23, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (244da22): 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.3% [0.2%, 0.6%] 19
Regressions ❌
(secondary)
0.4% [0.3%, 0.5%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 2
All ❌✅ (primary) 0.3% [0.2%, 0.6%] 19

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.9% [1.3%, 2.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [1.3%, 2.6%] 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 674.241s -> 674.182s (-0.01%)
Artifact size: 316.22 MiB -> 316.23 MiB (0.00%)

@oli-obk oli-obk deleted the feed_crate_num branch April 24, 2024 07:38
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 24, 2024

@rustbot label: +perf-regression-triaged

#123126 (comment)

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Apr 24, 2024
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
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants