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

Try to shrink Alignment-related MIR in Layout #128918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scottmcm
Copy link
Member

Noticed all this in https://rust.godbolt.org/z/55Tx65v4e:

        _22 = (_11.0: std::ptr::alignment::AlignmentEnum);
        _23 = discriminant(_22);
        _24 = Ge(_23, const 1_u64);
        _25 = Le(_23, const 9223372036854775808_u64);
        _26 = BitAnd(move _24, move _25);
        assume(move _26);
        _20 = _23 as usize (IntToInt);

So let's see if a non-as here works better.

@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2024

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 10, 2024
@scottmcm
Copy link
Member Author

@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 Aug 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 10, 2024
Try to shrink `Alignment`-related MIR in `Layout`

Noticed all this in <https://rust.godbolt.org/z/55Tx65v4e>:
```rust
        _22 = (_11.0: std::ptr::alignment::AlignmentEnum);
        _23 = discriminant(_22);
        _24 = Ge(_23, const 1_u64);
        _25 = Le(_23, const 9223372036854775808_u64);
        _26 = BitAnd(move _24, move _25);
        assume(move _26);
        _20 = _23 as usize (IntToInt);
```

So let's see if a non-`as` here works better.
@bors
Copy link
Contributor

bors commented Aug 10, 2024

⌛ Trying commit ddcdc0e with merge 688a0c0...

@bors
Copy link
Contributor

bors commented Aug 10, 2024

☀️ Try build successful - checks-actions
Build commit: 688a0c0 (688a0c061d888ae4c35fa5be1840a076d22f6644)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (688a0c0): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.4%, 0.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.7%, -0.3%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.7%, 0.4%] 6

Max RSS (memory usage)

Results (primary 0.4%, secondary 2.6%)

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)
3.2% [1.6%, 5.1%] 5
Regressions ❌
(secondary)
2.6% [2.0%, 3.1%] 2
Improvements ✅
(primary)
-4.3% [-5.3%, -2.7%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-5.3%, 5.1%] 8

Cycles

Results (primary -1.0%)

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)
- - 0
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.0% [-1.0%, -1.0%] 1

Binary size

Results (primary 0.0%, secondary 0.3%)

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.2% [0.1%, 0.6%] 13
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
-0.1% [-0.6%, -0.0%] 23
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.6%, 0.6%] 36

Bootstrap: 762.097s -> 760.688s (-0.18%)
Artifact size: 339.28 MiB -> 339.26 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 10, 2024
@scottmcm scottmcm marked this pull request as ready for review August 10, 2024 22:11
@erikdesjardins
Copy link
Contributor

Note that after #128371, we should be able to remove the assume entirely.

@joboet
Copy link
Contributor

joboet commented Aug 12, 2024

If #128371 does indeed fix this, I'd prefer that, so let's wait for that PR to be merged first.

@erikdesjardins
Copy link
Contributor

#128371 enables the assumes to be removed, but doesn't do so.

I just opened #129027 which removes the assumes and should obviate the need for this change.

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-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants