-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Avoid memcpy
in codegen for more types, notably Vec
#112733
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
bf8e6d3
to
5863b72
Compare
This comment has been minimized.
This comment has been minimized.
d9149d1
to
80cbced
Compare
This comment has been minimized.
This comment has been minimized.
80cbced
to
2deac38
Compare
This comment has been minimized.
This comment has been minimized.
2deac38
to
d2062af
Compare
This comment has been minimized.
This comment has been minimized.
d2062af
to
58626f9
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 58626f974068c9ec1a1da4fb7394548161e4530e with merge f9b06385bce9d1c2230e818597f5acf291b9b478... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
☔ The latest upstream changes (presumably #113508) made this pull request unmergeable. Please resolve the merge conflicts. |
happens during Bolt profile gathering. This probably isn't a miscompilation (at least in vanilla rustc) because it rebuilds the std library several times and only fails the Nth time when doing the profiling. So I guess either the bolt instrumentation is buggy or it somehow really ends up generating a lot more data. Maybe @Kobzol encountered an issue like this before. |
We have indeed seen this while building rustc with 1 CGU, and it's a blocking issue for that work to land. This is llvm/llvm-project#59174, and that arbitrarily low limit has been increased upstream already, in https://reviews.llvm.org/D151891. I think this now needs to appear in an LLVM release, and that we update the linux host toolchain to that version. |
It might be a while until that happens though (weeks/months possibly), until LLVM 17 is released (+ we might have to resolve some big regressions that we have seen with it). I'll send a PR to temporarily use LLVM 16 + my patch so that this is hotfixed sooner. |
58626f9
to
55977b4
Compare
Yay, thanks to #114148 I got to go through and remove some of my codegen FIXMEs here. |
This comment has been minimized.
This comment has been minimized.
55977b4
to
3152d29
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 3152d29fcc86fbd5333e8e978186defd4c35d148 with merge f0bf755c1d27d7c79bbde07734abab3def1d4384... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (f0bf755c1d27d7c79bbde07734abab3def1d4384): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeResultsThis 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.
Bootstrap: 632.482s -> 635.485s (0.47%) |
PR 111999 set up the framework to be able to do this; this PR expands it to more types than just arrays. Most interestingly, this allows it to work with `Vec<T>` and `String`, so swapping those no longer ends up going through stack like it does today (<https://rust.godbolt.org/z/cKG7o8aaW>). And since this is done in codegen, it's not special for `swap`, and thus will hopefully allow types like this to better optimize in lots of places, with easier SRoA.
3152d29
to
2627981
Compare
☔ The latest upstream changes (presumably #115236) made this pull request unmergeable. Please resolve the merge conflicts. |
@scottmcm any updates on this? |
Given #123185, I no longer think this is a good idea. Things like https://github.com/rust-lang/rust/blob/master/tests/assembly/x86_64-typed-swap.rs have been added since I was working on this that better check for what's important here. |
PR #111999 set up the framework to be able to do this; this PR expands it to more types than just arrays.
Most interestingly, this allows it to work with
Vec<T>
andString
, so swapping those no longer ends up going through stack like it does today (https://rust.godbolt.org/z/cKG7o8aaW).And since this is done in codegen, it's not special for
swap
, and thus will hopefully allow types like this to better optimize in lots of places, with easier SRoA.Draft initially, since it needs perf and I'm sure I got some of the non-opaque pointer tests wrong.