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

Delete architecture-specific memchr code in std::sys #114016

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

krtab
Copy link
Contributor

@krtab krtab commented Jul 24, 2023

Currently all architecture-specific memchr code is only used in std::io. Most of the actual memchr capacity exposed to the user through the slice API is instead implemented in core::slice::memchr.

Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.

The interest of putting architecture specific code back in core is linked to the discussion to be had in #113654

@rustbot
Copy link
Collaborator

rustbot commented Jul 24, 2023

r? @m-ou-se

(rustbot has picked a reviewer for you, use r? to override)

@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 Jul 24, 2023
@workingjubilee
Copy link
Member

Hmm, I'm assuming this isn't going to affect anything but I would like to see the perf queue say "yes" first.

@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 Dec 5, 2023
@bors
Copy link
Contributor

bors commented Dec 5, 2023

⌛ Trying commit 8655cbf with merge 3df3b2c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
Delete architecture-specific memchr code in std::sys

Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in `core::slice::memchr`.

Hence this commit deletes `memchr` from `std::sys[_common]` and replace calls to it by calls to `core::slice::memchr` functions. This deletes `(r)memchr` from the list of symbols linked to libc.

The interest of putting architecture specific code back in core is linked to the discussion to be had in rust-lang#113654
@bors
Copy link
Contributor

bors commented Dec 5, 2023

☀️ Try build successful - checks-actions
Build commit: 3df3b2c (3df3b2ce4774fef0dbbc6f02e92cdad8275ee162)

1 similar comment
@bors
Copy link
Contributor

bors commented Dec 5, 2023

☀️ Try build successful - checks-actions
Build commit: 3df3b2c (3df3b2ce4774fef0dbbc6f02e92cdad8275ee162)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3df3b2c): comparison URL.

Overall result: ❌ regressions - 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 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.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Max RSS (memory usage)

Results

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)
6.7% [6.7%, 6.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
-2.8% [-3.2%, -2.5%] 4
All ❌✅ (primary) 2.0% [-2.8%, 6.7%] 2

Cycles

Results

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.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
2.5% [2.2%, 2.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.0% [1.0%, 1.0%] 1

Binary size

Results

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.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.3%, 0.3%] 6

Bootstrap: 675.106s -> 674.558s (-0.08%)
Artifact size: 314.16 MiB -> 314.13 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 6, 2023
@workingjubilee
Copy link
Member

Hm. Sure. Don't know whether the other changes should be done, but the shocking lack of runtime perf changes feels motivating.

@bors r+

@bors
Copy link
Contributor

bors commented Dec 7, 2023

📌 Commit 8655cbf has been approved by workingjubilee

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 Dec 7, 2023
@bors
Copy link
Contributor

bors commented Dec 7, 2023

⌛ Testing commit 8655cbf with merge 86b7b71...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2023
…bilee

Delete architecture-specific memchr code in std::sys

Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in `core::slice::memchr`.

Hence this commit deletes `memchr` from `std::sys[_common]` and replace calls to it by calls to `core::slice::memchr` functions. This deletes `(r)memchr` from the list of symbols linked to libc.

The interest of putting architecture specific code back in core is linked to the discussion to be had in rust-lang#113654
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 7, 2023

💔 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 Dec 7, 2023
@workingjubilee
Copy link
Member

uh?
@bors retry

@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 Dec 7, 2023
@bors
Copy link
Contributor

bors commented Dec 7, 2023

⌛ Testing commit 8655cbf with merge 7c76c7b...

@krtab krtab force-pushed the delete_sys_memchr branch 2 times, most recently from 8ddbdb2 to 8473ea8 Compare December 16, 2023 11:25
@workingjubilee
Copy link
Member

I'm going to just hand-audit this for every supported platform before I approve this again. Might be a few days before I get around to it.

@krtab
Copy link
Contributor Author

krtab commented Dec 16, 2023

Ok. I'm on break for the next two weeks anyway so no rush.

@bors
Copy link
Contributor

bors commented Jan 13, 2024

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

@krtab krtab force-pushed the delete_sys_memchr branch from 8473ea8 to c51854e Compare January 16, 2024 13:37
Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

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

There are still some unresolved imports and missing modules on some targets:

  • Hermit (x86_64-unknown-hermit)
  • SOLID (aarch64-kmc-solid_asp3)
  • TeeOS (aarch64-unknown-teeos)
  • UEFI still has a memchr module (x86_64-unknown-uefi)
  • ZKVM does too (it doesn't currently build anyway)

I'd recommend searching all of std for memchr, checking each use, and then running x check library/std --target [TARGET] for each of the targets above, they should be representative.

library/std/src/sys/pal/hermit/memchr.rs Outdated Show resolved Hide resolved
library/std/src/sys/pal/hermit/os.rs Show resolved Hide resolved
library/std/src/sys/pal/solid/mod.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Feb 19, 2024

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

@krtab krtab force-pushed the delete_sys_memchr branch from c51854e to ca6b355 Compare February 20, 2024 21:24
@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2024

This PR modifies src/bootstrap/defaults.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 20, 2024
Currently all architecture-specific memchr code is only used in
`std::io`. Most of the actual `memchr` capacity exposed to the user
through the slice API is instead implemented in core::slice::memchr.

Hence this commit deletes memchr from std::sys[_common] and replace
calls to it by calls to core::slice::memchr functions. This deletes
(r)memchr from the list of symbols linked to libc.
@krtab krtab force-pushed the delete_sys_memchr branch from ca6b355 to 88ac7ac Compare February 20, 2024 21:27
@krtab
Copy link
Contributor Author

krtab commented Feb 20, 2024

@rustbot label -T-bootstrap

@rustbot rustbot removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 20, 2024
@krtab
Copy link
Contributor Author

krtab commented Feb 20, 2024

Thanks @joboet, it should hopefully be good know.
And thanks to @WaffleLapkin on zulip as well.

@workingjubilee
Copy link
Member

Thank you everyone! Sorry for not getting back to you on answering your question on Zulip, the answer was a somewhat inane "manually comb through everything and run this code on the machines I have available".

@bors r+

@bors
Copy link
Contributor

bors commented Mar 1, 2024

📌 Commit 88ac7ac has been approved by workingjubilee

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 Mar 1, 2024
@workingjubilee
Copy link
Member

@bors rollup=never

@bors
Copy link
Contributor

bors commented Mar 1, 2024

⌛ Testing commit 88ac7ac with merge 6f435eb...

@bors
Copy link
Contributor

bors commented Mar 1, 2024

☀️ Test successful - checks-actions
Approved by: workingjubilee
Pushing 6f435eb to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 1, 2024
@bors bors merged commit 6f435eb into rust-lang:master Mar 1, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 1, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6f435eb): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.8% [-2.7%, 1.1%] 2

Max RSS (memory usage)

Results

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)
15.9% [15.9%, 15.9%] 1
Regressions ❌
(secondary)
2.8% [0.9%, 6.1%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 15.9% [15.9%, 15.9%] 1

Cycles

Results

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.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-3.0% [-3.0%, -3.0%] 1
All ❌✅ (primary) -0.9% [-2.9%, 1.0%] 2

Binary size

Results

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.3% [0.0%, 0.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-0.1%, 0.5%] 3

Bootstrap: 651.937s -> 650.561s (-0.21%)
Artifact size: 311.55 MiB -> 311.48 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Mar 1, 2024
@lqd
Copy link
Member

lqd commented Mar 1, 2024

The regression doesn’t look real, syn-opt was somehow less noisy than usual recently, and seems to be back to its usual behavior.

@Mark-Simulacrum Mark-Simulacrum removed the perf-regression Performance regression. label Mar 5, 2024
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. O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.