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

codegen: store ScalarPair via memset when one side is undef and the other side can be memset #135335

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 10, 2025

Basically since undef can be any byte, it can also be the byte(s) that are in the non-undef parts of a value. So we can just treat the undef at not being there and only look at the initialized bytes and memset over them

fixes #104290

based on #135258

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2025

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 10, 2025

@bors try @rust-timer queue

cc @saethlin in case you were interested in where #135258 was going

@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 Jan 10, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2025
Treat undef bytes as equal to any other byte

Basically since `undef` can be any byte, it can also be the byte(s) that are in the non-undef parts of a value. So we can just treat the `undef` at not being there and only look at the initialized bytes and memset over them

fixes rust-lang#104290

based on rust-lang#135258
@bors
Copy link
Contributor

bors commented Jan 10, 2025

⌛ Trying commit e64a5a0 with merge ca1798b...

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@lqd
Copy link
Member

lqd commented Jan 11, 2025

@bors try

@bors
Copy link
Contributor

bors commented Jan 11, 2025

⌛ Trying commit b7e20ee with merge cabcef2...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2025
Treat undef bytes as equal to any other byte

Basically since `undef` can be any byte, it can also be the byte(s) that are in the non-undef parts of a value. So we can just treat the `undef` at not being there and only look at the initialized bytes and memset over them

fixes rust-lang#104290

based on rust-lang#135258
@bors
Copy link
Contributor

bors commented Jan 11, 2025

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cabcef2): comparison URL.

Overall result: no relevant changes - no 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.

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

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

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

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results (primary -0.1%, secondary -0.1%)

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)
-0.1% [-0.2%, -0.0%] 53
Improvements ✅
(secondary)
-0.1% [-0.3%, -0.0%] 14
All ❌✅ (primary) -0.1% [-0.2%, -0.0%] 53

Bootstrap: 763.776s -> 764.773s (0.13%)
Artifact size: 326.00 MiB -> 325.98 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 11, 2025
@saethlin
Copy link
Member

saethlin commented Jan 11, 2025

Widespread (even though small) binary size improvements in debug builds indicate this is firing and decently relevant.

@RalfJung RalfJung changed the title Treat undef bytes as equal to any other byte store ScalarPair via memset when one side is undef and the other side can be memset Jan 11, 2025
@RalfJung
Copy link
Member

I have updated the PR title since I found the old one really confusing.^^

@RalfJung RalfJung changed the title store ScalarPair via memset when one side is undef and the other side can be memset codegen: store ScalarPair via memset when one side is undef and the other side can be memset Jan 11, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 11, 2025

Well my original plan was to do this for general Ref constants, too, and I have that commit locally

@RalfJung
Copy link
Member

Feel free to further adjust the title. The old title was extremely unspecific though.^^

@saethlin
Copy link
Member

r? saethlin
@bors r+
🚀

@bors
Copy link
Contributor

bors commented Jan 20, 2025

📌 Commit 83476be has been approved by saethlin

It is now in the queue for this repository.

@rustbot rustbot assigned saethlin and unassigned wesleywiser Jan 20, 2025
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 20, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2025
codegen: store ScalarPair via memset when one side is undef and the other side can be memset

Basically since `undef` can be any byte, it can also be the byte(s) that are in the non-undef parts of a value. So we can just treat the `undef` at not being there and only look at the initialized bytes and memset over them

fixes rust-lang#104290

based on rust-lang#135258
@bors
Copy link
Contributor

bors commented Jan 21, 2025

⌛ Testing commit 83476be with merge 663dd5e...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 21, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 21, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 21, 2025

@bors r=saethlin

@bors
Copy link
Contributor

bors commented Jan 21, 2025

📌 Commit 8f5f5e5 has been approved by saethlin

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 21, 2025
@bors
Copy link
Contributor

bors commented Jan 21, 2025

⌛ Testing commit 8f5f5e5 with merge a7a6c64...

@bors
Copy link
Contributor

bors commented Jan 21, 2025

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing a7a6c64 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 21, 2025
@bors bors merged commit a7a6c64 into rust-lang:master Jan 21, 2025
7 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 21, 2025
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a7a6c64): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -2.2%, secondary 1.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)
1.2% [1.2%, 1.2%] 1
Regressions ❌
(secondary)
1.6% [1.5%, 1.6%] 3
Improvements ✅
(primary)
-4.0% [-5.2%, -2.8%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.2% [-5.2%, 1.2%] 3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results (primary -0.1%, secondary -0.1%)

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)
-0.1% [-0.2%, -0.0%] 53
Improvements ✅
(secondary)
-0.1% [-0.3%, -0.0%] 14
All ❌✅ (primary) -0.1% [-0.2%, -0.0%] 53

Bootstrap: 763.258s -> 763.46s (0.03%)
Artifact size: 326.07 MiB -> 326.05 MiB (-0.01%)

@oli-obk oli-obk deleted the push-zxwssomxxtnq branch January 21, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Initializing structs with Option fields set to None produces non-optimal assembly
10 participants