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

Regression: native builds broken on s390x #133177

Closed
uweigand opened this issue Nov 18, 2024 · 10 comments · Fixed by #133182
Closed

Regression: native builds broken on s390x #133177

uweigand opened this issue Nov 18, 2024 · 10 comments · Fixed by #133182
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc O-SystemZ Target: SystemZ processors (s390x) 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.

Comments

@uweigand
Copy link
Contributor

After #133050 was merged, all native builds on s390x fail very early during stage0 library build:

Building stage0 library artifacts (s390x-unknown-linux-gnu)
   Compiling core v0.0.0 (/home/uweigand/rust/library/core)
   Compiling rustc-std-workspace-core v1.99.0 (/home/uweigand/rust/library/rustc-std-workspace-core)
   Compiling compiler_builtins v0.1.138
   Compiling libc v0.2.161
   Compiling alloc v0.0.0 (/home/uweigand/rust/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
rustc-LLVM ERROR: Cannot select: 0x3ff58190770: ch = store<(store (s16) into %ir.6), trunc to f16> 0x3ff580a4768, 0x3ff58190850, FrameIndex:i64<2>, undef:i64
  0x3ff58190850: f32,ch = CopyFromReg 0x3ff580a4768, Register:f32 %1
    0x3ff580bdff0: f32 = Register %1
  0x3ff581905b0: i64 = FrameIndex<2>
  0x3ff58190fc0: i64 = undef
In function: _ZN4core3f1621_$LT$impl$u20$f16$GT$5clamp8do_panic7runtime17ha09a9a0f7fcbf036E

Specifically, it looks like the problem was introduced by commit b77dbbd, which adds passing of an argument of type f16 by value.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 18, 2024
@uweigand uweigand changed the title Regression: native builds broken on s309x Regression: native builds broken on s390x Nov 18, 2024
@RalfJung
Copy link
Member

RalfJung commented Nov 18, 2024

Does adding an #[inline] in this line help?

} else #[track_caller] { // Do not inline this, it makes perf worse

@saethlin saethlin added T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-SystemZ Target: SystemZ processors (s390x) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc labels Nov 18, 2024
@uweigand
Copy link
Contributor Author

Does adding an #[inline] in this line help?

Yes, it does! With that change the native build completes successfully again.

@saethlin
Copy link
Member

s390x-unknown-linux-gnu is a Tier 2 With Host Tools target, so it should not have been possible for this breakage to merge.

@uweigand You are reporting this as a native build failure. I can of course compile a sysroot with -Zbuild-std from x86_64, and I bet that's what we are doing in CI. Do you have any advice on how an interested contributor could get an s390x host to build on? I found some suggestions on how to do this via some casual searching, so I'm just curious if you have a recommended workflow that's publicly available.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 18, 2024
@uweigand
Copy link
Contributor Author

Yes, I also assume this may be a difference between native builds and cross-builds. Do you generally perform native builds for the whole set of supported architectures (even just the Tier 2 With Host Tools ones)?

As to access to a s390x host for test purposes, there are various options; I'd recommend one of the following:

  • For temporary access (limited to 120 days), you can register with the "LinuxONE Community Cloud" hosted by Marist College, Poughkeepsie, and then have access to a self-service portal where you can create a s390x machine instance: https://linuxone.cloud.marist.edu/
  • For permanent access, you can request a s390x machine here: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/ (you'll need to describe the open-source project work this machine will be used for, and it'll have to be approved by IBM - but for the purpose of regular testing of the Rust compiler that approval would certainly happen, feel free to mention my name in the request)

In addition, we're currently investigating options of making native s390x builds more directly available via GitHub actions (without you having to set up and manage the host yourself), but that is not yet available today.

@RalfJung
Copy link
Member

Yes, it does! With that change the native build completes successfully again.

That is very strange, since #133050 should do exactly that automatically...

... ah! But since you are doing a native build, and #133050 is not applied in the bootstrap compiler, things still break in the stage 0 build.

@RalfJung
Copy link
Member

We could add a #[cfg_attr(bootstrap, inline)] to fix this; that shouldn't affect the actually distributed sysroots since those are built at a later stage.

@RalfJung
Copy link
Member

RalfJung commented Nov 18, 2024

Btw @uweigand if IBM could help maintain the s390x LLVM backend, e.g. by fixing selection issues like this, that'd be great. :D

@uweigand
Copy link
Contributor Author

Btw @uweigand if IBM could help maintain the s390x LLVM backend, e.g. by fixing selection issues like this, that'd be great. :D

Yes, of course. We're already working on adding fp16 support to LLVM (and GCC as well): llvm/llvm-project#109164

This should hopefully be available in LLVM 20.

For any other LLVM issues on s390x always feel free to contact me.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 18, 2024
…oss35

const_panic: inline in bootstrap builds to avoid f16/f128 crashes

This should fix rust-lang#133177. `@uweigand` could you test that?
@bors bors closed this as completed in 17ffefc Nov 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 19, 2024
Rollup merge of rust-lang#133182 - RalfJung:const-panic-inline, r=tgross35

const_panic: inline in bootstrap builds to avoid f16/f128 crashes

This should fix rust-lang#133177. ``@uweigand`` could you test that?
@tgross35
Copy link
Contributor

As to access to a s390x host for test purposes, there are various options; I'd recommend one of the following:

* For temporary access (limited to 120 days), you can register with the "LinuxONE Community Cloud" hosted by Marist College, Poughkeepsie, and then have access to a self-service portal where you can create a s390x machine instance: https://linuxone.cloud.marist.edu/

* For permanent access, you can request a s390x machine here: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/  (you'll need to describe the open-source project work this machine will be used for, and it'll have to be approved by IBM - but for the purpose of regular testing of the Rust compiler that approval would certainly happen, feel free to mention my name in the request)

Bit of an aside but this sort of thing would be awesome to have in the dev guide, I had no idea these were available but this is great for figuring out test failures.

@tgross35
Copy link
Contributor

I submitted the resource request. I'm not sure whether it is per-user or for the entire organization, but if it is for the org then maybe we can wire it up to our dev desktops somehow (https://forge.rust-lang.org/infra/docs/dev-desktop.html, https://github.com/rust-lang/simpleinfra/tree/master/ansible/roles/dev-desktop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc O-SystemZ Target: SystemZ processors (s390x) 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants