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

Get rid of the hir_owner query. #120006

Merged
merged 3 commits into from
Jan 19, 2024
Merged

Get rid of the hir_owner query. #120006

merged 3 commits into from
Jan 19, 2024

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Jan 15, 2024

This query was meant as a firewall between hir_owner_nodes which is supposed to change often, and the queries that only depend on the item signature. That firewall was inefficient, leaking the contents of the HIR body through HirIds.

hir_owner incurs a significant cost, as we need to hash HIR twice in multiple modes. This PR proposes to remove it, and simplify the hashing scheme.

For the future, def_kind, def_span... are much more efficient for incremental decoupling, and should be preferred.

@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 Jan 15, 2024
@cjgillot
Copy link
Contributor Author

@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 Jan 15, 2024
@bors
Copy link
Contributor

bors commented Jan 15, 2024

⌛ Trying commit d63eab3 with merge a14c977...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2024
PERF: Get rid of the hir_owner query.

r? `@ghost`
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 16, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a14c977): comparison URL.

Overall result: ✅ improvements - no 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.

@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)
0.2% [0.2%, 0.3%] 3
Improvements ✅
(primary)
-1.8% [-5.4%, -0.2%] 127
Improvements ✅
(secondary)
-2.2% [-4.2%, -0.3%] 42
All ❌✅ (primary) -1.8% [-5.4%, -0.2%] 127

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)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
2.8% [1.5%, 5.4%] 6
Improvements ✅
(primary)
-2.6% [-13.5%, -0.6%] 10
Improvements ✅
(secondary)
-4.9% [-11.3%, -1.4%] 7
All ❌✅ (primary) -2.2% [-13.5%, 2.0%] 11

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)
1.6% [1.2%, 1.9%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-2.9%, -1.0%] 35
Improvements ✅
(secondary)
-2.1% [-2.7%, -0.7%] 9
All ❌✅ (primary) -1.5% [-2.9%, 1.9%] 40

Binary size

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

Bootstrap: 667.719s -> 666.383s (-0.20%)
Artifact size: 308.26 MiB -> 308.17 MiB (-0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 16, 2024
@cjgillot cjgillot changed the title PERF: Get rid of the hir_owner query. Get rid of the hir_owner query. Jan 16, 2024
@rustbot rustbot added the A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) label Jan 16, 2024
@cjgillot cjgillot marked this pull request as ready for review January 16, 2024 23:53
@cjgillot
Copy link
Contributor Author

r? compiler

@wesleywiser
Copy link
Member

These are really nice wins, both for the perf improvements and also removing an additional layer of complexity from the code!

Great work @cjgillot 🎉

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2024

📌 Commit d59968b has been approved by wesleywiser

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 Jan 17, 2024
@bors
Copy link
Contributor

bors commented Jan 17, 2024

⌛ Testing commit d59968b with merge 685da38...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 17, 2024
Get rid of the hir_owner query.

This query was meant as a firewall between `hir_owner_nodes` which is supposed to change often, and the queries that only depend on the item signature. That firewall was inefficient, leaking the contents of the HIR body through `HirId`s.

`hir_owner` incurs a significant cost, as we need to hash HIR twice in multiple modes. This PR proposes to remove it, and simplify the hashing scheme.

For the future, `def_kind`, `def_span`... are much more efficient for incremental decoupling, and should be preferred.
@bors
Copy link
Contributor

bors commented Jan 17, 2024

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 17, 2024
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@cjgillot
Copy link
Contributor Author

@bors retry

@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 Jan 18, 2024
@bors
Copy link
Contributor

bors commented Jan 19, 2024

⌛ Testing commit d59968b with merge d3c9082...

@bors
Copy link
Contributor

bors commented Jan 19, 2024

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing d3c9082 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 19, 2024
@bors bors merged commit d3c9082 into rust-lang:master Jan 19, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d3c9082): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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)
0.3% [0.2%, 0.4%] 3
Improvements ✅
(primary)
-1.8% [-5.5%, -0.3%] 129
Improvements ✅
(secondary)
-2.1% [-4.4%, -0.4%] 46
All ❌✅ (primary) -1.8% [-5.5%, -0.3%] 129

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% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
1.2% [1.2%, 1.2%] 1
Improvements ✅
(primary)
-4.5% [-13.7%, -0.6%] 6
Improvements ✅
(secondary)
-5.5% [-10.8%, -1.9%] 6
All ❌✅ (primary) -3.7% [-13.7%, 1.3%] 7

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)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-3.5%, -1.1%] 34
Improvements ✅
(secondary)
-3.3% [-4.4%, -2.0%] 10
All ❌✅ (primary) -2.1% [-3.5%, 1.5%] 35

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

Bootstrap: 666.403s -> 665.653s (-0.11%)
Artifact size: 308.34 MiB -> 308.28 MiB (-0.02%)

@cjgillot cjgillot deleted the no-hir-owner branch January 19, 2024 10:03
@nnethercote
Copy link
Contributor

The icount and cycle results are fantastic, but the wall-time results are pretty mixed. Looking at the graphs a lot of the wall-time regressions look like they might be temporary blips, though.

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) merged-by-bors This PR was explicitly merged by bors. 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.

7 participants