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

Subtree sync for rustc_codegen_cranelift #130716

Merged
merged 80 commits into from
Sep 23, 2024

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Sep 22, 2024

The main highlight this time is a fix for a miscompilation of RwLock on macOS. Also a Cranelift update and a couple of extra vendor intrinsics on arm64.

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler

RalfJung and others added 30 commits August 5, 2024 10:57
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and
`FnHeader`, which can be packed more efficiently. This reduces the size
of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms.
This reduces peak memory usage by a few percent on some benchmarks. It
also reduces cache misses and page faults similarly, though this doesn't
translate to clear cycles or wall-time improvements on CI.
I rarely need a debug build of cg_clif, and even if I actually need one,
using package overrides in Cargo.toml to only do a debug build for the
rustc_codegen_cranelift crate works much better.
To avoid overriding the source for coretests every time.
…ouxu,Amanieu,Jubilee

nontemporal_store: make sure that the intrinsic is truly just a hint

The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](llvm/llvm-project#64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores.

~~Blocked on rust-lang/stdarch#1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~

Fixes rust-lang#114582
Cc `@Amanieu` `@workingjubilee`
…ompiler-errors

Shrink `TyKind::FnPtr`.

By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.

r? `@compiler-errors`
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 22, 2024
@workingjubilee
Copy link
Member

workingjubilee commented Sep 22, 2024

Yes, we've been getting frequent spurious failures on that test.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 23, 2024
…bjorn3

Subtree sync for rustc_codegen_cranelift

The main highlight this time is a fix for a miscompilation of RwLock on macOS. Also a Cranelift update and a couple of extra vendor intrinsics on arm64.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
@bors
Copy link
Contributor

bors commented Sep 23, 2024

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout sync_cg_clif-2024-09-22 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self sync_cg_clif-2024-09-22 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
Auto-merging compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Auto-merging compiler/rustc_codegen_cranelift/src/constant.rs
Auto-merging compiler/rustc_codegen_cranelift/src/abi/mod.rs
Auto-merging compiler/rustc_codegen_cranelift/example/std_example.rs
Auto-merging compiler/rustc_codegen_cranelift/build_system/tests.rs
Auto-merging compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
CONFLICT (content): Merge conflict in compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
Auto-merging compiler/rustc_codegen_cranelift/build_system/bench.rs
CONFLICT (content): Merge conflict in compiler/rustc_codegen_cranelift/build_system/bench.rs
Auto-merging compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 23, 2024
@bors
Copy link
Contributor

bors commented Sep 23, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits (since this message was last posted):

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 23, 2024

@bors r+ p=1 subtree sync

@bors
Copy link
Contributor

bors commented Sep 23, 2024

📌 Commit 9456ff1 has been approved by bjorn3

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 23, 2024
@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 23, 2024

@bors r+ p=1 subtree sync

@bors
Copy link
Contributor

bors commented Sep 23, 2024

📌 Commit 6b042f5 has been approved by bjorn3

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 23, 2024

⌛ Testing commit 6b042f5 with merge 648d024...

@bors
Copy link
Contributor

bors commented Sep 23, 2024

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing 648d024 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 23, 2024
@bors bors merged commit 648d024 into rust-lang:master Sep 23, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 23, 2024
@bjorn3 bjorn3 deleted the sync_cg_clif-2024-09-22 branch September 23, 2024 16:47
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (648d024): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

Cycles

Results (primary 0.5%, secondary 8.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.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
8.0% [7.0%, 9.0%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Binary size

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

Bootstrap: 767.469s -> 767.841s (0.05%)
Artifact size: 341.52 MiB -> 341.50 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend has-merge-commits PR has merge commits, merge with caution. 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.