Skip to content

force share-generics on drop-glue locally #108838

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

Closed
wants to merge 1 commit into from

Conversation

csmoe
Copy link
Member

@csmoe csmoe commented Mar 7, 2023

r? @bjorn3
a perf-run is requested, thanks.

@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 Mar 7, 2023
@workingjubilee
Copy link
Member

@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 Mar 7, 2023
@bors
Copy link
Collaborator

bors commented Mar 7, 2023

⌛ Trying commit b4a689e with merge 7361760bf34b8f3cf6d72c054452b70106cbf531...

@bors
Copy link
Collaborator

bors commented Mar 7, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7361760bf34b8f3cf6d72c054452b70106cbf531): comparison URL.

Overall result: ❌ regressions - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@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.4% [0.2%, 0.6%] 9
Regressions ❌
(secondary)
2.4% [0.5%, 3.6%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 9

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.7% [0.6%, 3.8%] 3
Regressions ❌
(secondary)
4.7% [2.8%, 7.6%] 4
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
-1.0% [-1.0%, -1.0%] 1
All ❌✅ (primary) 1.3% [-0.1%, 3.8%] 4

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)
5.0% [3.1%, 6.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 7, 2023
@bjorn3
Copy link
Member

bjorn3 commented Mar 7, 2023

This seems to be a regression on both compile time and executable size.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7361760bf34b8f3cf6d72c054452b70106cbf531): comparison URL.

Overall result: ❌ regressions - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@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.4% [0.2%, 0.6%] 9
Regressions ❌
(secondary)
2.4% [0.5%, 3.6%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 9

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.7% [0.6%, 3.8%] 3
Regressions ❌
(secondary)
4.7% [2.8%, 7.6%] 4
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
-1.0% [-1.0%, -1.0%] 1
All ❌✅ (primary) 1.3% [-0.1%, 3.8%] 4

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)
5.0% [3.1%, 6.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-14 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:ac593985615ec2ede58e132d2e21d2b1cbd6127c)
Download action repository 'rust-lang/simpleinfra@master' (SHA:46007752205b5430f5cabe1357251ea7621a9e98)
Complete job name: PR (x86_64-gnu-llvm-14, false, ubuntu-20.04-xl)
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  CI_JOB_NAME: x86_64-gnu-llvm-14
---
........................................................................................ 10824/14571
........................................................................................ 10912/14571
........................................................................................ 11000/14571
........................................................................................ 11088/14571
.............F..F....................................................................... 11176/14571
........................................................................................ 11352/14571
........................................................................................ 11440/14571
..........................iiiii...i....i.i.............................................. 11528/14571
........................................................................................ 11616/14571
---
failures:

---- [ui] tests/ui/repr/16-bit-repr-c-enum.rs#avr stdout ----

error in revision `avr`: test compilation failed although it shouldn't!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/repr/16-bit-repr-c-enum.rs" "-Zthreads=1" "--cfg" "avr" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.avr" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.avr/auxiliary" "--target=avr-unknown-gnu-atmega328" "--crate-type=rlib"
stdout: none
--- stderr -------------------------------
error: requires `drop_in_place` lang_item
error: aborting due to previous error
------------------------------------------



---- [ui] tests/ui/repr/16-bit-repr-c-enum.rs#msp430 stdout ----

error in revision `msp430`: test compilation failed although it shouldn't!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/repr/16-bit-repr-c-enum.rs" "-Zthreads=1" "--cfg" "msp430" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.msp430" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.msp430/auxiliary" "--target=msp430-none-elf" "--crate-type=rlib"
stdout: none
--- stderr -------------------------------
error: requires `drop_in_place` lang_item
error: aborting due to previous error
------------------------------------------


@workingjubilee
Copy link
Member

I'm guessing fewer things get monomorphized into nothing as a result.

@csmoe
Copy link
Member Author

csmoe commented Mar 8, 2023

@bjorn3 As the previous share-generics on drop-glue stated that drop-glue should be instantiated if used https://github.com/rust-lang/rust/pull/68414/files#diff-28d299e2742f2ca199c4d3dcd9df0d8bae3dd0998db034803da401057501fa56R15
I'm doing the nearly same thing as manually let _ = Foo; inside rustc, but this hurts the perf a lot. I cannot think of another way to achieve the goal, do you have any insight on this?
(btw, I tried to build a local huge rust repo with this patch, the binary size was 440k smaller)

@bjorn3
Copy link
Member

bjorn3 commented Mar 8, 2023

I see. Going to re-assign as this is tricky code and I can't convince myself of the correctness due to lack of experience with this code.

r? compiler

@rustbot rustbot assigned davidtwco and unassigned bjorn3 Mar 8, 2023
@davidtwco
Copy link
Member

Is there a rationale to this change written anywhere?

@csmoe
Copy link
Member Author

csmoe commented Mar 9, 2023

@davidtwco This patch was trying to address #84175 , but it regressed a lot, and I can not find a better solution, asking for the team for advice.

as for this patch itself, it should not be accepted obviously.

@davidtwco
Copy link
Member

I can't think of another way to do this - I think there will just be a performance penalty to always generate drop-glue. It might be beneficial when that drop-glue goes on to be used, but there will be many cases where we now generate drop-glue that will never be used.

@csmoe
Copy link
Member Author

csmoe commented Mar 16, 2023

After reading the code of share-generics and PGO, I'm wandering if it is possible to generate some profdata for rustc itself like PGO profdata for llvm, which teaches rustc to do share-generics on functions for a local project. We are doing this manually by create a top level crate which instantiates functions inside it, then make the business modules depends on it.

thanks for your reviewing :)

@csmoe csmoe closed this Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants