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

shrink OpTy back down to 80 bytes #99097

Closed
wants to merge 2 commits into from

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jul 9, 2022

This shares the first commit with #99013, but seeing the perf trouble in that PR, maybe this one is worth considering first. It gets the size of OpTy down to how it was before #98846.

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 9, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 9, 2022

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 9, 2022
@RalfJung
Copy link
Member Author

RalfJung commented Jul 9, 2022

Let's see if this undoes the Max RSS regressions from #98846.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 9, 2022
@bors
Copy link
Contributor

bors commented Jul 9, 2022

⌛ Trying commit da4adcf29a2d797d416fb3aa978a23d973c37641 with merge f2f6207794ada785a91f6dbd3a9c4a29924b54ab...

@bors
Copy link
Contributor

bors commented Jul 9, 2022

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

@rust-timer
Copy link
Collaborator

Queued f2f6207794ada785a91f6dbd3a9c4a29924b54ab with parent f893495, future comparison URL.

)?)?,
op.layout,
));
// Sanity-check the type we ended up with.
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate comment?

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 9, 2022
@RalfJung

This comment was marked as outdated.

@RalfJung
Copy link
Member Author

RalfJung commented Jul 9, 2022

Blocked on #99101.

@RalfJung RalfJung added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2022
@Kobzol
Copy link
Contributor

Kobzol commented Jul 10, 2022

I wouldn't worry about the max RSS regression, it has a low significance factor and it's just on a single hello-world benchmark, we can safely ignore that.

@RalfJung RalfJung removed the perf-regression Performance regression. label Jul 12, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 13, 2022
…-obk

interpret: refactor projection handling code

Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.

mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.

This is the common part of rust-lang#99013 and rust-lang#99097. I am seeing some strange perf results so this probably should be its own change so we know which diff caused which perf changes...

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Jul 13, 2022

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

RalfJung added 2 commits July 13, 2022 10:21
these are not things you *should* usually be comparing for equality...
@RalfJung RalfJung added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jul 13, 2022
@RalfJung
Copy link
Member Author

All right, finally ready for review. :)

Also just to be sure...
@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 13, 2022
@bors
Copy link
Contributor

bors commented Jul 13, 2022

⌛ Trying commit b077049 with merge a0d6fe90aadd2f3d45db9497150c9f211b4adf24...

@bors
Copy link
Contributor

bors commented Jul 13, 2022

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

@rust-timer
Copy link
Collaborator

Queued a0d6fe90aadd2f3d45db9497150c9f211b4adf24 with parent ca4e394, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a0d6fe90aadd2f3d45db9497150c9f211b4adf24): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.3% 3.7% 6
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.0% 3.0% 1
Improvements 🎉
(primary)
-2.9% -2.9% 1
Improvements 🎉
(secondary)
-5.0% -9.2% 2
All 😿🎉 (primary) -2.9% -2.9% 1

Cycles

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
5.6% 7.2% 6
Improvements 🎉
(primary)
-3.0% -3.0% 1
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) -3.0% -3.0% 1

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 may lead to changes in compiler perf.

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

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 13, 2022
@RalfJung
Copy link
Member Author

I guess that is not too surprising, all these layout() calls will not help with perf.

@rust-lang/wg-compiler-performance what do you think? This PR fixes a memory consumption regression (introduced by #98846) at the cost of some performance.

@nnethercote
Copy link
Contributor

max-rss isn't affected much by this PR. Instructions only regress for ctfe-stress-5, which is a stress test and not so important.

But then, I think max-rss also wasn't affected much by #98846, so I'm not sure if this PR is really necessary?

@RalfJung
Copy link
Member Author

RalfJung commented Jul 15, 2022

But then, I think max-rss also wasn't affected much by #98846, so I'm not sure if this PR is really necessary?

Well, I saw the 6% max regression in a primary benchmark and thought that had to be fixed.

Later I learned max-RSS is very noisy, so... if you tell me the RSS numbers in #98846 are fine, I am okay with closing this PR.

@nnethercote
Copy link
Contributor

I think the RSS numbers in #98846 are fine. For the affected benchmarks, it's only 1 or 2 of the runs, which is a clue that it's just noise. Also, the significance factors are very low, just a little over 1, which is the threshold for displaying. In clearer cases the significant factor will be over 10, sometimes over 50.

All this is unclear with deep understanding of rustc-perf, so apologies for that. We are trying to improve this, but presenting this data in a way that is both precise and comprehensible to non-experts is a genuine challenge.

@RalfJung
Copy link
Member Author

All this is unclear with deep understanding of rustc-perf, so apologies for that. We are trying to improve this, but presenting this data in a way that is both precise and comprehensible to non-experts is a genuine challenge.

I know, and no need to apologize. :) After all, we then have you around to ask questions when things are unclear. :D

I'll close this PR then. I will investigate making OpTy not-Copy so that we avoid copying such a large type unnecessarily.

@RalfJung RalfJung closed this Jul 16, 2022
@RalfJung RalfJung deleted the opty-shrink branch July 16, 2022 00:48
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. 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.

9 participants