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

[perf] Disable inline_in_all_cgus when LTO is enabled #65052

Closed
wants to merge 2 commits into from

Conversation

ishitatsuyuki
Copy link
Contributor

I tried to run lolbench with this flag altered; however lolbench either errored or got stuck, so I end up running only 3 of the benchmarks manually. One showed no changes, another one showed 20% perf improvement somehow, and another showed slight (1%) regression.

So I'm thinking of benchmarking it with perf instead; if we still have ThinLTO on CI then we can measure stage2 compiler performance as a metric of how much it affects generated code.

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 3, 2019
@ishitatsuyuki
Copy link
Contributor Author

cc @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

A perf run can't hurt, I guess.

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 3, 2019

⌛ Trying commit 5da9200 with merge 8b81ee4...

bors added a commit that referenced this pull request Oct 3, 2019
[perf] Disable inline_in_all_cgus when LTO is enabled

I tried to run lolbench with this flag altered; however lolbench either errored or got stuck, so I end up running only 3 of the benchmarks manually. One showed no changes, another one showed 20% perf improvement somehow, and another showed slight (1%) regression.

So I'm thinking of benchmarking it with perf instead; if we still have ThinLTO on CI then we can measure stage2 compiler performance as a metric of how much it affects generated code.
@bors
Copy link
Contributor

bors commented Oct 3, 2019

☀️ Try build successful - checks-azure
Build commit: 8b81ee4 (8b81ee4b7012d18cf19ef2744bc8457290dd4136)

@rust-timer
Copy link
Collaborator

Queued 8b81ee4 with parent 0221e26, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 8b81ee4, comparison URL.

@ishitatsuyuki
Copy link
Contributor Author

Everything within the margin of noise, is ThinLTO used for benchmarks?

@Mark-Simulacrum
Copy link
Member

It should be, yes, for release builds by default I believe.

@bjorn3
Copy link
Member

bjorn3 commented Oct 4, 2019

@ishitatsuyuki @rust-timer only benchmarks compilation time, so this means that rustc perf didn't change. lolbench is a different program, which does benchmark execution time.

@ishitatsuyuki
Copy link
Contributor Author

@bjorn3 I am aware of that, and what I expected is that this change will indirectly affect stage2 compiler, which in turn can be benchmarked for performance difference.

So far what I have heard is that ThinLTO is enabled for both compiler builds and perf, so everything being identical sounds really strange. Something more likely is that the code/flag being changed has no effect at all, so maybe I should ask who had implemented this originally -

r? @alexcrichton

@@ -65,7 +65,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug {
fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode {
let inline_in_all_cgus =
tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
tcx.sess.opts.optimize != OptLevel::No
tcx.sess.opts.optimize != OptLevel::No && if tcx.sess.lto() == Lto::No
Copy link
Contributor

Choose a reason for hiding this comment

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

There is an if after the &&. Why does this code compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good catch, and yeah I have no idea why this happened to compile. I'll push a fix later.

Copy link
Member

Choose a reason for hiding this comment

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

Strange. I can't reproduce on play.rust-lang.org.

@ishitatsuyuki
Copy link
Contributor Author

Oh shit this file is dead code. The code is inside src/librustc/mir/mono.rs instead.

@ishitatsuyuki
Copy link
Contributor Author

@Mark-Simulacrum Sorry, can I get another perf run?

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@Mark-Simulacrum
Copy link
Member

@bors try

1 similar comment
@Mark-Simulacrum
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Oct 4, 2019

⌛ Trying commit 3e0a02a with merge c5643b3...

bors added a commit that referenced this pull request Oct 4, 2019
[perf] Disable inline_in_all_cgus when LTO is enabled

I tried to run lolbench with this flag altered; however lolbench either errored or got stuck, so I end up running only 3 of the benchmarks manually. One showed no changes, another one showed 20% perf improvement somehow, and another showed slight (1%) regression.

So I'm thinking of benchmarking it with perf instead; if we still have ThinLTO on CI then we can measure stage2 compiler performance as a metric of how much it affects generated code.
@bors
Copy link
Contributor

bors commented Oct 4, 2019

☀️ Try build successful - checks-azure
Build commit: c5643b3 (c5643b3524a2437116951cffe217391943c6fd51)

@rust-timer
Copy link
Collaborator

Queued c5643b3 with parent 9e35a28, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit c5643b3, comparison URL.

@ishitatsuyuki
Copy link
Contributor Author

Checked this and it seems it’s mostly a big lose. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants