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

Clean up MonoItem::instantiation_mode #136394

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Feb 1, 2025

More progress on cleaning up and documenting instantiation mode selection.

This should have no behavior changes at all, it just rearranges the code inside MonoItem::instantiation_mode to a more logical flow and I've tried to explain every choice the implementation is making.

@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 1, 2025
@saethlin saethlin force-pushed the clean-up-instantiation-mode branch from 7ae2e33 to eea88f5 Compare February 1, 2025 17:57
@saethlin
Copy link
Member Author

saethlin commented Feb 1, 2025

@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 1, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 1, 2025
…, r=<try>

Clean up MonoItem::instantiation_mode

More progress on cleaning up and documenting instantiation mode selection.

Tests pass locally, but I want this to pass perf first.

r? ghost
@bors
Copy link
Contributor

bors commented Feb 1, 2025

⌛ Trying commit eea88f5 with merge ab75159...

@bors
Copy link
Contributor

bors commented Feb 1, 2025

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ab75159): 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 (primary -3.9%, secondary 1.4%)

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

Cycles

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

Binary size

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

Bootstrap: 777.851s -> 777.154s (-0.09%)
Artifact size: 328.84 MiB -> 328.86 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 1, 2025
@saethlin
Copy link
Member Author

saethlin commented Feb 1, 2025

r? compiler

@saethlin saethlin marked this pull request as ready for review February 1, 2025 21:35
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 1, 2025

📌 Commit eea88f5 has been approved by compiler-errors

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 1, 2025
@saethlin
Copy link
Member Author

saethlin commented Feb 1, 2025

There's a lot of nevers in the queue and this is supposed to no semantic changes and has passed a perf run with no changes.

@bors rollup=maybe

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 1, 2025
… r=<try>

Remove InstanceKind::generates_cgu_internal_copy

This is on top of rust-lang#136394 for now.

`InstanceKind::generates_cgu_internal_copy` was called in two places:

1. By `reachable_non_generics`, but in that case the caller was guaranteed to not be generic and therefore we always fall through to just calling `cross_crate_inlinable`.
2. By `MonoItem::instantiation_mode`, but in that case the *only* thing that it does is some very complicated logic for selecting the instantiation mode for drop glue, and only very recently do we have a single codegen test for this. So I've touched up the logic in `cross_crate_inlinable` so that we don't try to claim that `drop_in_place` isn't cross-crate-inlinable, because it clearly is.

Now off to perf, and if we get regressions I'll start reintroducing the logic about drop glue but, but this time into `MonoItem::instantiation_mode` where it always should have been.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 2, 2025
…de, r=compiler-errors

Clean up MonoItem::instantiation_mode

More progress on cleaning up and documenting instantiation mode selection.

This should have no behavior changes at all, it just rearranges the code inside `MonoItem::instantiation_mode` to a more logical flow and I've tried to explain every choice the implementation is making.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#134272 (Remove rustc_encodable_decodable feature)
 - rust-lang#136283 (Update encode_utf16 to mention it is native endian)
 - rust-lang#136394 (Clean up MonoItem::instantiation_mode)
 - rust-lang#136402 (diagnostics: fix borrowck suggestions for if/while let conditionals)
 - rust-lang#136415 (Highlight clarifying information in "expected/found" error)
 - rust-lang#136422 (Convert two `rustc_middle::lint` functions to `Span` methods.)
 - rust-lang#136434 (rustc_allowed_through_unstable_modules: require deprecation message)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 453c32d into rust-lang:master Feb 2, 2025
7 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 2, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2025
Rollup merge of rust-lang#136394 - saethlin:clean-up-instantiation-mode, r=compiler-errors

Clean up MonoItem::instantiation_mode

More progress on cleaning up and documenting instantiation mode selection.

This should have no behavior changes at all, it just rearranges the code inside `MonoItem::instantiation_mode` to a more logical flow and I've tried to explain every choice the implementation is making.
@saethlin saethlin deleted the clean-up-instantiation-mode branch February 2, 2025 22:09
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2025
… r=<try>

Remove InstanceKind::generates_cgu_internal_copy

This is on top of rust-lang#136394 for now.

`InstanceKind::generates_cgu_internal_copy` was called in two places:

1. By `reachable_non_generics`, but in that case the caller was guaranteed to not be generic and therefore we always fall through to just calling `cross_crate_inlinable`.
2. By `MonoItem::instantiation_mode`, but in that case the *only* thing that it does is some very complicated logic for selecting the instantiation mode for drop glue, and only very recently do we have a single codegen test for this. So I've touched up the logic in `cross_crate_inlinable` so that we don't try to claim that `drop_in_place` isn't cross-crate-inlinable, because it clearly is.

Now off to perf, and if we get regressions I'll start reintroducing the logic about drop glue but, but this time into `MonoItem::instantiation_mode` where it always should have been.
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.

5 participants