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

Rollup of 9 pull requests #136811

Closed
wants to merge 33 commits into from

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

tmiasko and others added 30 commits January 27, 2025 19:54
Previously MSVC CI would ignore all tests annotated with needs-sanitizer-support header.
Exposes the error function so we can expose this in the standard
library [1].

[1]: rust-lang/compiler-builtins#753
We don't need to "short circuit trait resolution", because DynSend and DynSync are auto traits and thus coinductive
This should guarantee it tests what we want it to test and no more.
By moving this stability check into AST lowering, we effectively make
it impossible to accidentally miss, as it must happen to generate HIR.
Also, we put the ABI-stability code next to code that actually uses it!
This allows code that wants to reason about backend ABI implementations
to stop worrying about high-level concerns like syntax stability,
while still leaving it as the authority on what ABIs actually exist.

It also makes it easy to refactor things to have more consistent errors.
For now, we only apply this to generalize the existing messages a bit.
These are either residue of a long-term migration away from something,
or are simply trying too hard to be specifically useful:
nearest-match suggestions for ABI strings should handle this.
…, r=Mark-Simulacrum

Add Four Codegen Tests

Closes rust-lang#74615
Closes rust-lang#123216
Closes rust-lang#49572
Closes rust-lang#93514

This PR adds four codegen tests. The FileCheck assertions were generated with the help of `update_test_checks.py` and `update_llc_test_checks.py` from the LLVM project.
x86: make SSE2 required for i686 hardfloat targets and use it to pass SIMD types

The primary goal of this is to make SSE2 *required* for our i686 targets (at least for the ones that use Pentium 4 as their baseline), to ensure they cannot be affected by rust-lang#114479. This has been MCPd in rust-lang/compiler-team#808, and is tracked in rust-lang#133611.

We do this by defining a new ABI that these targets select, and making SSE2 required by the ABI (that's the first commit). That's kind of a hack, but (a) it is the easiest way to make a target feature required via the target spec, and (b) we actually *can* use SSE2 for the Rust ABI now that it is required, so the second commit goes ahead and does that. Specifically, we use it in two ways: to return `f64` values in a register rather than by-ptr, and to pass vectors of size up to 128bit in a register (or, well, whatever LLVM does when passing `<4 x float>` by-val, I don't actually know if this ends up in a register).

Cc `@workingjubilee`
Fixes rust-lang#133611
…Mark-Simulacrum

Enable sanitizers on MSVC CI jobs

Previously MSVC CI would ignore all tests annotated with needs-sanitizer-support header.
…kan,jieyouxu

adding autodiff tests

I'd like to get started with upstreaming some tests, even though I'm still waiting for an answer on how to best integrate the enzyme pass. Can we therefore temporarily support the -Z llvm-plugins here without too much effort? And in that case, how would that work? I saw you can do remapping, e.g. `rust-src-base`, but I don't think that will give me the path to libEnzyme.so. Do you have another suggestion?

Other than that this test simply checks that the derivative of `x*x` is `2.0 * x`, which in this case is computed as
`%0 = fadd fast double %x.0.val, %x.0.val`
(I'll add a few more tests and move it to an autodiff folder if we can use the -Z flag)

r? `@jieyouxu`

Locally at least `-Zllvm-plugins=${PWD}/build/x86_64-unknown-linux-gnu/enzyme/build/Enzyme/libEnzyme-19.so` seems to work if I copy the command I get from x.py test and run it manually. However, running x.py test itself fails.

Tracking:

- rust-lang#124509

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Enzyme.20build.20changes
…-into-ast, r=compiler-errors

compiler: gate `extern "{abi}"` in ast_lowering

I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together.

It also abstracts away certain error messages instead of constantly repeating them.

A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used.

r? `@ghost`
…imulacrum

ci: upgrade to crosstool-ng 1.27.0

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
try-job: dist-powerpc64le-linux
Update `compiler-builtins` to 0.1.146

Exposes the error function so we can expose this in the standard library [1].

[1]: rust-lang/compiler-builtins#753
…22, r=SparrowLii

rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/DynSync"

rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/DynSync"

We don't need to "short circuit trait resolution", because DynSend and DynSync are auto traits and thus coinductive

cc "Parallel Rustc Front-end" rust-lang#113349

r? SparrowLii

`@rustbot` label: +WG-compiler-parallel

(rustbot sometimes ignores me and doesn't attach labels on my behalf. rustbot banned me?)
…or-codegen-tests, r=saethlin

tests: `-Copt-level=3` instead of `-O` in codegen tests

An effective blocker for redefining the meaning of `-O` is to stop reusing this somewhat ambiguous alias in our own codegen test suite. The choice between `-Copt-level=2` and `-Copt-level=3` is arbitrary for most of our tests. In most cases it makes no difference, so I set most of them to `-Copt-level=3`, as it will lead to slightly more "normalized" codegen.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-testsuite Area: The testsuite used to check the correctness of rustc O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Feb 10, 2025
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Feb 10, 2025

📌 Commit 563390f 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 Feb 10, 2025
@bors
Copy link
Contributor

bors commented Feb 10, 2025

⌛ Testing commit 563390f with merge c511e30...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
…kingjubilee

Rollup of 9 pull requests

Successful merges:

 - rust-lang#134626 (Add Four Codegen Tests)
 - rust-lang#135408 (x86: make SSE2 required for i686 hardfloat targets and use it to pass SIMD types)
 - rust-lang#136155 (Enable sanitizers on MSVC CI jobs)
 - rust-lang#136419 (adding autodiff tests)
 - rust-lang#136603 (compiler: gate `extern "{abi}"` in ast_lowering)
 - rust-lang#136628 (ci: upgrade to crosstool-ng 1.27.0)
 - rust-lang#136714 (Update `compiler-builtins` to 0.1.146)
 - rust-lang#136731 (rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/DynSync")
 - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/target-feature/missing-plusminus.rs ... ok
test [ui] tests/ui/target-feature/rust-specific-name-no-warnings.rs ... ignored, only executed when the architecture is x86
test [ui] tests/ui/target-feature/no-llvm-leaks.rs#aarch64 ... ok
test [ui] tests/ui/target-feature/no-llvm-leaks.rs#x86-64 ... ok
test [ui] tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs ... ok
test [ui] tests/ui/target-feature/tied-features-cli.rs#four ... ok
test [ui] tests/ui/target-feature/tied-features-cli.rs#one ... ok
test [ui] tests/ui/target-feature/tied-features-cli.rs#three ... ok
test [ui] tests/ui/target-feature/tied-features-cli.rs#two ... ok
---
test [codegen] tests/codegen/abi-sysv64.rs ... ok
test [codegen] tests/codegen/abi-win64-zst.rs#windows-gnu ... ok
test [codegen] tests/codegen/abi-win64-zst.rs#windows-msvc ... ok
test [codegen] tests/codegen/abi-win64-zst.rs#linux ... ok
test [codegen] tests/codegen/abi-x86-sse.rs#x86-32-nosse ... ok
test [codegen] tests/codegen/abi-x86-sse.rs#x86-32 ... ok
test [codegen] tests/codegen/abi-x86-interrupt.rs ... ok
test [codegen] tests/codegen/abi-x86-sse.rs#x86-64 ... ok
test [codegen] tests/codegen/adjustments.rs ... ok
test [codegen] tests/codegen/addr-of-mutate.rs ... ok
---
test [codegen] tests/codegen/cffi/ffi-pure.rs ... ok
test [codegen] tests/codegen/char-ascii-branchless.rs ... ok
test [codegen] tests/codegen/checked_ilog.rs ... ok
test [codegen] tests/codegen/checked_math.rs ... ok
test [codegen] tests/codegen/classify-fp-category-of-usize-without-branch.rs ... ok
test [codegen] tests/codegen/codemodels.rs#MODEL-KERNEL ... ignored, only executed when the architecture is x86_64
test [codegen] tests/codegen/codemodels.rs#MODEL-LARGE ... ignored, only executed when the architecture is x86_64
test [codegen] tests/codegen/codemodels.rs#MODEL-MEDIUM ... ignored, only executed when the architecture is x86_64
test [codegen] tests/codegen/codemodels.rs#MODEL-SMALL ... ignored, only executed when the architecture is x86_64
---
failures:

---- [codegen] tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/ci-llvm/bin/FileCheck" "--input-file" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll" "/Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
/Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs:41:12: error: CHECK: expected string not found in input
/Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs:41:12: error: CHECK: expected string not found in input
 // CHECK: ret <4 x float> %[[VAL:.+]]
           ^
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:28:40: note: scanning from here
 %0 = load <4 x float>, ptr %x, align 4
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:29:4: note: possible intended match here
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:29:4: note: possible intended match here
 store <4 x float> %0, ptr %_0, align 16
/Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs:56:12: error: CHECK: expected string not found in input
/Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs:56:12: error: CHECK: expected string not found in input
 // CHECK: ret <4 x float> %[[VAL:.+]]
           ^
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:43:40: note: scanning from here
 %0 = load <4 x float>, ptr %x, align 4
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:44:4: note: possible intended match here
/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll:44:4: note: possible intended match here
 store <4 x float> %0, ptr %_0, align 16

Input file: /Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array/simd-intrinsic-transmute-array.ll
Check file: /Users/runner/work/rust/rust/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
            1: ; ModuleID = 'simd_intrinsic_transmute_array.3f564baaaff31982-cgu.0' 
            2: source_filename = "simd_intrinsic_transmute_array.3f564baaaff31982-cgu.0" 
            3: target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32" 
            4: target triple = "arm64-apple-macosx11.0.0" 
            6: ; Function Attrs: uwtable 
            6: ; Function Attrs: uwtable 
            7: define noundef i64 @array_align() unnamed_addr #0 { 
            9:  ret i64 4 
           10: } 
           11:  
           12: ; Function Attrs: uwtable 
           12: ; Function Attrs: uwtable 
           13: define noundef i64 @vector_align() unnamed_addr #0 { 
           15:  ret i64 16 
           16: } 
           17:  
           18: ; Function Attrs: uwtable 
           18: ; Function Attrs: uwtable 
           19: define void @build_array_s(ptr dead_on_unwind noalias nocapture noundef writable sret([16 x i8]) align 16 dereferenceable(16) %_0, ptr noalias nocapture noundef readonly align 4 dereferenceable(16) %x) unnamed_addr #0 { 
           20: start: 
           21:  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %_0, ptr align 4 %x, i64 16, i1 false) 
           22:  ret void 
           23: } 
           25: ; Function Attrs: uwtable 
           25: ; Function Attrs: uwtable 
           26: define void @build_array_transmute_s(ptr dead_on_unwind noalias nocapture noundef writable sret([16 x i8]) align 16 dereferenceable(16) %_0, ptr noalias nocapture noundef readonly align 4 dereferenceable(16) %x) unnamed_addr #0 { 
           27: start: 
           28:  %0 = load <4 x float>, ptr %x, align 4 
check:41'0                                            X error: no match found
           29:  store <4 x float> %0, ptr %_0, align 16 
check:41'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:41'1        ?                                      possible intended match
           30:  ret void 
check:41'0     ~~~~~~~~~~
           31: } 
check:41'0     ~~
check:41'0     ~
           33: ; Function Attrs: uwtable 
check:41'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
check:41'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           34: define void @build_array_t(ptr dead_on_unwind noalias nocapture noundef writable sret([16 x i8]) align 16 dereferenceable(16) %_0, ptr noalias nocapture noundef readonly align 4 dereferenceable(16) %x) unnamed_addr #0 { 
check:41'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           35: start: 
           36:  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %_0, ptr align 4 %x, i64 16, i1 false) 
           37:  ret void 
           38: } 
           40: ; Function Attrs: uwtable 
           40: ; Function Attrs: uwtable 
           41: define void @build_array_transmute_t(ptr dead_on_unwind noalias nocapture noundef writable sret([16 x i8]) align 16 dereferenceable(16) %_0, ptr noalias nocapture noundef readonly align 4 dereferenceable(16) %x) unnamed_addr #0 { 
           42: start: 
           43:  %0 = load <4 x float>, ptr %x, align 4 
check:56'0                                            X error: no match found
           44:  store <4 x float> %0, ptr %_0, align 16 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:56'1        ?                                      possible intended match
           45:  ret void 
check:56'0     ~~~~~~~~~~
           46: } 
check:56'0     ~~
check:56'0     ~
check:56'0     ~
           48: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           49: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:56'0     ~
check:56'0     ~
           51: attributes #0 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="apple-m1" } 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           52: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:56'0     ~
check:56'0     ~
           54: !llvm.module.flags = !{!0} 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           55: !llvm.ident = !{!1} 
check:56'0     ~~~~~~~~~~~~~~~~~~~~
check:56'0     ~
check:56'0     ~
           57: !0 = !{i32 8, !"PIC Level", i32 2} 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           58: !1 = !{!"rustc version 1.86.0-nightly (c511e3083 2025-02-10)"} 
check:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------



@bors
Copy link
Contributor

bors commented Feb 10, 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 Feb 10, 2025
@workingjubilee workingjubilee deleted the rollup-u3p1rno branch February 10, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-testsuite Area: The testsuite used to check the correctness of rustc O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. 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.