Firestar99 opened PR #15131 from Firestar99:fix_no_std_s390x to bytecodealliance:main:
Requires https://github.com/bytecodealliance/wasmtime/pull/15115
(sadly stacked PRs don't work when merging across forks)
Followup from https://github.com/bytecodealliance/wasmtime/pull/15115:
Going full
no_stdwithcargo b -p cranelift-codegen --no-default-features --features all-archstill fails to compile due to s390x usingf32::powi(), which is a#[rustc_allow_incoherent_impl]so even though it's declared incore, it only "exists" instd. [...]Note that
libmdoesn't have a dedicatedf32::powi()implementation, so crates likenum-traitsimplements it by wrappingpowf.There's a couple options to implement this:
- What this PR does: Fallback to
libm::powifstdfeature is disabled. I decided against adding thenum-traitscrate and just add my own cfg switch.- Always use
libmto guarantee bit exact results across different platforms. This may change s390x artifacts as the new function may be off by some other amount of ulps than the compiling machine's fp unit.Which one do you prefer?
Firestar99 requested wasmtime-compiler-s390x-reviewers for a review on PR #15131.
Firestar99 removed the review request for wasmtime-compiler-reviewers from PR #15131.
Firestar99 requested cfallin for a review on PR #15131.
Firestar99 requested wasmtime-compiler-reviewers for a review on PR #15131.
Firestar99 requested alexcrichton for a review on PR #15131.
Firestar99 removed the review request for wasmtime-default-reviewers from PR #15131.
Firestar99 requested wasmtime-default-reviewers for a review on PR #15131.
uweigand commented on PR #15131:
This is only used to compute (relatively) small powers of two, specifically 2^31, 2^32, 2^63, and 2^64. Those should always provide exact results. I would hope that just using
pow/powfwould also be fine here, since those results should also be exact.In the alternative, I guess we could also compute the power-of-two as an integer and only convert the result to float. That might be an issue with 2^64, but there we can compute 2^63, convert to float, and double the float.
I don't think providing two different code paths is helpful here.
Firestar99 updated PR #15131.
Firestar99 commented on PR #15131:
Switched it to Option 2: only using libm
:memo: uweigand submitted PR review:
s390x changes now LGTM. For the remaining changes I'd defer to another maintainer.
Firestar99 updated PR #15131.
Firestar99 commented on PR #15131:
@uweigand I made this PR only contain the s390x changes, so you can merge it independently of the other PR. This also defers checking
no_stdsupport in CI until the other PR is merged.
Firestar99 edited PR #15131:
Independent Followup from https://github.com/bytecodealliance/wasmtime/pull/15115:
Going full
no_stdwithcargo b -p cranelift-codegen --no-default-features --features all-archstill fails to compile due to s390x usingf32::powi(), which is a#[rustc_allow_incoherent_impl]so even though it's declared incore, it only "exists" instd. [...]Note that
libmdoesn't have a dedicatedf32::powi()implementation, so crates likenum-traitsimplements it by wrappingpowf.There's a couple options to implement this:
- What this PR does: Fallback to
libm::powifstdfeature is disabled. I decided against adding thenum-traitscrate and just add my own cfg switch.- Always use
libmto guarantee bit exact results across different platforms. This may change s390x artifacts as the new function may be off by some other amount of ulps than the compiling machine's fp unit.Which one do you prefer?
Firestar99 edited PR #15131:
Independent Followup from https://github.com/bytecodealliance/wasmtime/pull/15115:
Going full
no_stdwithcargo b -p cranelift-codegen --no-default-features --features all-archstill fails to compile due to s390x usingf32::powi(), which is a#[rustc_allow_incoherent_impl]so even though it's declared incore, it only "exists" instd. [...]Note that
libmdoesn't have a dedicatedf32::powi()implementation, so crates likenum-traitsimplements it by wrappingpowf.
There's a couple options to implement this:
1. What this PR does: Fallback tolibm::powifstdfeature is disabled. I decided against adding thenum-traitscrate and just add my own cfg switch.We decided on:
- Always use
libmto guarantee bit exact results across different platforms. This may change s390x artifacts as the new function may be off by some other amount of ulps than the compiling machine's fp unit.
Firestar99 converted PR #15131 fix no_std on s390x to a draft.
:thumbs_up: uweigand submitted PR review:
LGTM, thanks!
uweigand commented on PR #15131:
@Firestar99 you just marked this as draft - do you no longer want me to merge it?
Firestar99 commented on PR #15131:
I'm waiting for the other PR that just got merge queued to push a change to CI so it tests no_std.
Firestar99 updated PR #15131.
Firestar99 has marked PR #15131 as ready for review.
Firestar99 commented on PR #15131:
CI now tests
cranelift-codegenwithoutstdfeature and it should hopefully pass
theotherjimmy has enabled auto merge for PR #15131.
theotherjimmy added PR #15131 fix no_std on s390x to the merge queue.
github-merge-queue[bot] removed PR #15131 fix no_std on s390x from the merge queue.
alexcrichton commented on PR #15131:
I'll take a look at that CI failure as it looks spurious, but otherwise for no_std verification I'd recommend editing this line to ensure it actually builds on a no_std target
alexcrichton added PR #15131 fix no_std on s390x to the merge queue.
github-actions[bot] added the label cranelift on PR #15131.
github-actions[bot] added the label isle on PR #15131.
github-actions[bot] commented on PR #15131:
Subscribe to Label Action
cc @avanhatt, @cfallin, @fitzgen, @mmcloughlin
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- avanhatt: isle
- cfallin: isle
- fitzgen: isle
- mmcloughlin: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:check: alexcrichton merged PR #15131.
alexcrichton removed PR #15131 fix no_std on s390x from the merge queue.
Firestar99 commented on PR #15131:
@alexcrichton So for adding
no_stdtests in CI: Here you're pointing me at themicro_checksjob, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at theplatform_checksjob, where I've addedno_stdchecks. Should we still add the checks to themicro_checksjob or do you think it's fine as is?
Firestar99 edited a comment on PR #15131:
@alexcrichton So for adding
no_stdtests in CI: Here you're pointing me at themicro_checksjob, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at theplatform_checksjob, where I've addedno_stdchecks. Should we still add the checks to themicro_checksjob or do you think it's fine as is?
Firestar99 edited a comment on PR #15131:
@alexcrichton So for adding
no_stdtests in CI: Here you're pointing me at themicro_checksjob, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at theplatform_checksjob, where I've addedno_stdchecks and made themno_stdin this PR. Should we still add the checks to themicro_checksjob or do you think it's fine as is?
alexcrichton commented on PR #15131:
Ah yes sorry, to clarify:
- For tests along the lines of "this feature combination should build", that's what
micro_checksis for.- For tests along the lines of "this is no_std compatible" that's what
platform_checksis for, specifically thex86_64-unknown-nonetarget.It's fine for now, but if you'd like to send a follow-up as well that'd be appreciatd. It's basically easy right now for the no_std support to regress since there's nothing actually testing it (you have to build on a target without
std, otherwise you can always just useextern crate std)
Last updated: Nov 19 2026 at 20:05 UTC