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

Don't compute inlining status of mono items in advance. #112128

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

nnethercote
Copy link
Contributor

We record inlining status for mono items in MonoItems, and then transfer it to InliningMap, for later use in
InliningMap::with_inlining_candidates.

But we can just compute inlining status directly in InliningMap::with_inlining_candidates, because the mono item is right there. There's no need to compute it in advance.

This commit changes the code to do that, removing the need for MonoItems and InliningMap::inlines. This does result in more calls to instantiation_mode (one per static occurrence) but the performance effect is negligible.

r? @wesleywiser

@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 May 31, 2023
@nnethercote
Copy link
Contributor Author

nnethercote commented May 31, 2023

I expect this to have no perf impact, but let's check.

@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 May 31, 2023
@bors
Copy link
Contributor

bors commented May 31, 2023

⌛ Trying commit 9571d670c36e1e17f3b2351c11fa8cc539260e35 with merge cc638c2ed8ff2a74362f50eb1e9467496484182d...

@nnethercote nnethercote mentioned this pull request May 31, 2023
@rust-timer

This comment has been minimized.

@SparrowLii
Copy link
Member

This is very nice if it has little perf impact

@bors
Copy link
Contributor

bors commented May 31, 2023

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

1 similar comment
@bors
Copy link
Contributor

bors commented May 31, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cc638c2ed8ff2a74362f50eb1e9467496484182d): 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)

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

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

Binary size

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

Bootstrap: 643.402s -> 642.265s (-0.18%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 31, 2023
We record inlining status for mono items in `MonoItems`, and then
transfer it to `InliningMap`, for later use in
`InliningMap::with_inlining_candidates`.

But we can just compute inlining status directly in
`InliningMap::with_inlining_candidates`, because the mono item is right
there. There's no need to compute it in advance.

This commit changes the code to do that, removing the need for
`MonoItems` and `InliningMap::inlines`. This does result in more calls
to `instantiation_mode` (one per static occurrence) but the performance
effect is negligible.
@nnethercote
Copy link
Contributor Author

No perf impact. @wesleywiser, ready for review, thanks!

@bors rollup

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

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

Very nice!

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 1, 2023

📌 Commit cc21d9a 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 Jun 1, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 1, 2023
…=wesleywiser

Don't compute inlining status of mono items in advance.

We record inlining status for mono items in `MonoItems`, and then transfer it to `InliningMap`, for later use in
`InliningMap::with_inlining_candidates`.

But we can just compute inlining status directly in `InliningMap::with_inlining_candidates`, because the mono item is right there. There's no need to compute it in advance.

This commit changes the code to do that, removing the need for `MonoItems` and `InliningMap::inlines`. This does result in more calls to `instantiation_mode` (one per static occurrence) but the performance effect is negligible.

r? `@wesleywiser`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 1, 2023
Rollup of 7 pull requests

Successful merges:

 - rust-lang#108459 (rustdoc: Fix LinkReplacer link matching)
 - rust-lang#111318 (Add a distinct `OperandValue::ZeroSized` variant for ZSTs)
 - rust-lang#111892 (rustdoc: add interaction delays for tooltip popovers)
 - rust-lang#111980 (Preserve substs in opaques recorded in typeck results)
 - rust-lang#112024 (Don't suggest break through nested items)
 - rust-lang#112128 (Don't compute inlining status of mono items in advance.)
 - rust-lang#112141 (remove reference to Into in ? operator core/std docs, fix rust-lang#111655)

Failed merges:

 - rust-lang#112071 (Group rfcs tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fe12323 into rust-lang:master Jun 1, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 1, 2023
@nnethercote nnethercote deleted the no-inlining-advance branch June 1, 2023 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants