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

Avoid accessing the HIR in the happy path of coherent_trait #120835

Merged
merged 5 commits into from
Feb 12, 2024

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Feb 9, 2024

Unfortunately the hir is still used in unsafety checks, and we do not have a way to avoid that. An impl's unsafety is not part of any query other than hir.

So this PR does not affect perf, but could still be considered a cleanup

@rustbot
Copy link
Collaborator

rustbot commented Feb 9, 2024

r? @pnkfelix

rustbot has assigned @pnkfelix.
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 Feb 9, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 9, 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 Feb 9, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 9, 2024
Avoid accessing the HIR in the happy path of `coherent_trait`

based on rust-lang#120834

This may resolve part of the performance issue of rust-lang#120558
@bors
Copy link
Contributor

bors commented Feb 9, 2024

⌛ Trying commit d8fa0d5 with merge 83055d7...

@bors
Copy link
Contributor

bors commented Feb 9, 2024

☀️ Try build successful - checks-actions
Build commit: 83055d7 (83055d7e543de346aba28b5fe67df824fa543e97)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (83055d7): 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
Improvements ✅
(primary)
-0.5% [-1.1%, -0.2%] 11
Improvements ✅
(secondary)
-1.4% [-3.8%, -0.3%] 46
All ❌✅ (primary) -0.5% [-1.1%, -0.2%] 11

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.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-7.6% [-12.8%, -2.3%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.7% [-12.8%, 1.0%] 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-4.9%, -2.1%] 9
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 661.327s -> 661.647s (0.05%)
Artifact size: 308.28 MiB -> 308.24 MiB (-0.01%)

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

oli-obk commented Feb 9, 2024

The real diff (relative to the base PR) is https://perf.rust-lang.org/compare.html?start=7c638996380cc1b1285e6d37b124cce4e771e721&end=83055d7e543de346aba28b5fe67df824fa543e97&stat=instructions%3Au

So still a visible improvement in secondary benchmarks.

@nnethercote
Copy link
Contributor

Great work!

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 9, 2024

Bases it off master. Let's give it another spin.

Though there are still some direct hir accesses in unsafety checking that i'm not sure how to fully eliminate

@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 Feb 9, 2024
@bors
Copy link
Contributor

bors commented Feb 9, 2024

⌛ Trying commit 614ff0f with merge af14861...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 9, 2024
Avoid accessing the HIR in the happy path of `coherent_trait`

This may resolve part of the performance issue of rust-lang#120558
@bors
Copy link
Contributor

bors commented Feb 9, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (af14861): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

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)
1.5% [1.5%, 1.5%] 2
Regressions ❌
(secondary)
3.1% [2.0%, 4.4%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.5% [1.5%, 1.5%] 2

Binary size

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

Bootstrap: 666.771s -> 666.754s (-0.00%)
Artifact size: 308.00 MiB -> 308.00 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 10, 2024
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 10, 2024

📌 Commit 614ff0f has been approved by cjgillot

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 Feb 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2024
Merge `impl_polarity` and `impl_trait_ref` queries

Hopefully this is perf neutral. I wan to finish rust-lang#120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
@bors
Copy link
Contributor

bors commented Feb 12, 2024

⌛ Testing commit 614ff0f with merge aebf451...

@bors
Copy link
Contributor

bors commented Feb 12, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing aebf451 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 12, 2024
@bors bors merged commit aebf451 into rust-lang:master Feb 12, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 12, 2024
@oli-obk oli-obk deleted the no_hir_coherence branch February 12, 2024 09:45
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (aebf451): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.5% [-5.6%, -5.4%] 3
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 663.665s -> 664.937s (0.19%)
Artifact size: 308.44 MiB -> 308.38 MiB (-0.02%)

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2024
…rors

Merge `impl_polarity` and `impl_trait_ref` queries

Hopefully this is perf neutral. I want to finish rust-lang#120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 13, 2024
Merge `impl_polarity` and `impl_trait_ref` queries

Hopefully this is perf neutral. I want to finish rust-lang/rust#120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Merge `impl_polarity` and `impl_trait_ref` queries

Hopefully this is perf neutral. I want to finish rust-lang/rust#120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Merge `impl_polarity` and `impl_trait_ref` queries

Hopefully this is perf neutral. I want to finish rust-lang/rust#120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
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. 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