-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Don't over-optimize the abi layout #93405
Conversation
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #93457) made this pull request unmergeable. Please resolve the merge conflicts. |
I'll trigger a perf run so that we can see the performance impact of this. Implementation looks reasonable to me, but I'm not sure I'm the right person to decide to land this. @bors try @rust-timer queue r? rust-lang/compiler |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 803e19c6ebc647d4e600967c255fccea838bce9f with merge 237000707ffe286d58aa8f08d523cf9c4e9928f3... |
☀️ Try build successful - checks-actions |
Queued 237000707ffe286d58aa8f08d523cf9c4e9928f3 with parent e58e7b1, future comparison URL. |
Finished benchmarking commit (237000707ffe286d58aa8f08d523cf9c4e9928f3): comparison url. Summary: This benchmark run shows 26 relevant improvements 🎉 but 390 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led 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 |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 646350f with merge c3b1e20af9859a1275613895f5bfe5485b0d51f9... |
☀️ Try build successful - checks-actions |
Queued c3b1e20af9859a1275613895f5bfe5485b0d51f9 with parent 93e8201, future comparison URL. |
Finished benchmarking commit (c3b1e20af9859a1275613895f5bfe5485b0d51f9): comparison url. Summary: This benchmark run shows 9 relevant improvements 🎉 but 504 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led 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 |
These perf regressions are way more than I anticipated. I don't think my changes are worth these massive regressions. |
This PR removes the aggregate "optimization" done to small (<= ptr-size * 2) return arguments because this cause many problems:
Specifically the behavior before the this PR was to aggregate every-type (struct, array) that was pass or return and was small enough (<= ptr-size * 2) into a single and unique integer, no matter the underline type. This would means for example that
[f32; 3]
(which is a very common representation for a vector in 3 dimensions) would be represented as a uniquei96
in the LLVM-IR that would need to be pack to be returned and than unpack at the caller to be used. #91447 (comment)I expect this change to have some compile time improvement and regressions, the improvement will probably be due to the removal of the packing and unpacking machinery and the regressions will most certanly be caused by the extra optimizations like auto-vectorization that LLVM will be able to perform. Overall I thing is change is worth while as it fix some regressions and improve the generated assembly.
Examples (Rust)
Examples (ASM - Current nightly)
Examples (ASM - This PR)
Revert #85828 (not needed anymore and block auto-vectorization if left)
Fixes #85265
Fixes #91447
cc @scottmcm