Skip to content

EXPERIMENT: Use the force-inline pass for more stuff #144483

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

scottmcm
Copy link
Member

We're already paying for the extra look at stuff, what if we add a second attribute for things that we always want to inline, but are also fine with generic calls not getting inlined? Can we save a bunch of code and functions calls in derived Ords and such? Is it worth the extra overhead of normalizing more calls?

r? ghost

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 26, 2025
@scottmcm

This comment was marked as outdated.

@rust-timer

This comment was marked as outdated.

@rust-bors

This comment was marked as outdated.

rust-bors bot added a commit that referenced this pull request Jul 26, 2025
EXPERIMENT: Use the force-inline pass for more stuff
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 26, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment was marked as outdated.

@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 26, 2025
EXPERIMENT: Use the force-inline pass for more stuff
@rust-bors
Copy link

rust-bors bot commented Jul 26, 2025

⌛ Trying commit e9fcbb2 with merge 5a3178f

To cancel the try build, run the command @bors try cancel.

@rust-bors
Copy link

rust-bors bot commented Jul 26, 2025

☀️ Try build successful (CI)
Build commit: 5a3178f (5a3178fa03ad01debfab17b1253662bc45c95eb9, parent: f32b23204a0efe2fe8383ed4be1a30b56c1bbf94)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5a3178f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.9% [0.1%, 3.2%] 93
Regressions ❌
(secondary)
1.0% [0.1%, 5.2%] 73
Improvements ✅
(primary)
-0.8% [-2.6%, -0.1%] 5
Improvements ✅
(secondary)
-0.1% [-0.2%, -0.1%] 2
All ❌✅ (primary) 0.8% [-2.6%, 3.2%] 98

Max RSS (memory usage)

Results (primary 1.8%, secondary 0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [0.6%, 6.2%] 23
Regressions ❌
(secondary)
3.8% [1.1%, 6.5%] 2
Improvements ✅
(primary)
-3.6% [-6.3%, -0.9%] 2
Improvements ✅
(secondary)
-1.5% [-2.2%, -0.7%] 4
All ❌✅ (primary) 1.8% [-6.3%, 6.2%] 25

Cycles

Results (primary 2.3%, secondary 2.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.2%, 3.7%] 12
Regressions ❌
(secondary)
2.8% [1.5%, 4.4%] 12
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [-1.9%, 3.7%] 13

Binary size

Results (primary 1.3%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.4% [0.0%, 8.5%] 96
Regressions ❌
(secondary)
1.0% [0.1%, 2.4%] 21
Improvements ✅
(primary)
-0.2% [-0.2%, -0.0%] 4
Improvements ✅
(secondary)
-0.1% [-0.3%, -0.0%] 4
All ❌✅ (primary) 1.3% [-0.2%, 8.5%] 100

Bootstrap: 467.999s -> 468.02s (0.00%)
Artifact size: 376.62 MiB -> 376.79 MiB (0.05%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 26, 2025
@bors
Copy link
Collaborator

bors commented Jul 26, 2025

☔ The latest upstream changes (presumably #144502) made this pull request unmergeable. Please resolve the merge conflicts.

@scottmcm
Copy link
Member Author

Hmm, yeah, way too many new resolve calls to work. Ah well, interesting to know.

@scottmcm scottmcm closed this Jul 26, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 26, 2025
@scottmcm scottmcm reopened this Aug 4, 2025
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 4, 2025
@scottmcm
Copy link
Member Author

scottmcm commented Aug 4, 2025

I was inspired by https://discord.com/channels/273534239310479360/957720175619215380/1401622766536364124 to see if I can do a more limited version of this that would still work.

…ther than `always`)

Obviously there's way more that could do this, but I don't to do *all* of them at once.
@scottmcm
Copy link
Member Author

scottmcm commented Aug 4, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 4, 2025

⌛ Trying commit a6adf2d with merge f4b36c8

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 4, 2025
EXPERIMENT: Use the force-inline pass for more stuff
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2025
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain enhanced) (plain)

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

---- [ui] tests/ui-fulldeps/rustc_public/crate-info.rs stdout ----

error: test did not exit with success! code=Some(101) so test would pass with `run-fail`
status: exit status: 101
command: cd "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui-fulldeps/rustc_public/crate-info" && RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui-fulldeps/rustc_public/crate-info/a"
stdout: none
--- stderr -------------------------------

Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 4, 2025
Add some pre-codegen MIR tests for debug mode

No functional changes; just some tests.

I made these for rust-lang#144483, but that's going in a different direction, so I wanted to propose we just add them to help see the impact of other related changes in the future.

r? mir
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 4, 2025
Add some pre-codegen MIR tests for debug mode

No functional changes; just some tests.

I made these for rust-lang#144483, but that's going in a different direction, so I wanted to propose we just add them to help see the impact of other related changes in the future.

r? mir
@rust-bors
Copy link

rust-bors bot commented Aug 4, 2025

☀️ Try build successful (CI)
Build commit: f4b36c8 (f4b36c8b56f988af2e104136c467ff4a28a21216, parent: 383b9c447b61641e1f1a3850253944a897a60827)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f4b36c8): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.8% [0.1%, 1.0%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.7%, secondary -2.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.7% [0.9%, 2.4%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-5.4% [-7.4%, -3.4%] 2
Improvements ✅
(secondary)
-2.1% [-3.1%, -0.8%] 4
All ❌✅ (primary) -0.7% [-7.4%, 2.4%] 6

Cycles

Results (secondary -4.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

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

Binary size

Results (primary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.1%] 12
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.1%, 0.1%] 19

Bootstrap: 468.859s -> 468.747s (-0.02%)
Artifact size: 376.98 MiB -> 377.03 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2025
rust-timer added a commit that referenced this pull request Aug 4, 2025
Rollup merge of #144875 - scottmcm:more-mir-tests, r=cjgillot

Add some pre-codegen MIR tests for debug mode

No functional changes; just some tests.

I made these for #144483, but that's going in a different direction, so I wanted to propose we just add them to help see the impact of other related changes in the future.

r? mir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library 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