Stream: git-wasmtime

Topic: wasmtime / PR #15131 fix `no_std` on s390x


view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

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_std with cargo b -p cranelift-codegen --no-default-features --features all-arch still fails to compile due to s390x using f32::powi(), which is a #[rustc_allow_incoherent_impl] so even though it's declared in core, it only "exists" in std. [...]

Note that libm doesn't have a dedicated f32::powi() implementation, so crates like num-traits implements it by wrapping powf.

There's a couple options to implement this:

  1. What this PR does: Fallback to libm::pow if std feature is disabled. I decided against adding the num-traits crate and just add my own cfg switch.
  2. Always use libm to 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?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 requested wasmtime-compiler-s390x-reviewers for a review on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 removed the review request for wasmtime-compiler-reviewers from PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 requested cfallin for a review on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 requested wasmtime-compiler-reviewers for a review on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 requested alexcrichton for a review on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 removed the review request for wasmtime-default-reviewers from PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 12:53):

Firestar99 requested wasmtime-default-reviewers for a review on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 13:11):

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/powf would 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 13:25):

Firestar99 updated PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 13:26):

Firestar99 commented on PR #15131:

Switched it to Option 2: only using libm

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 14:20):

:memo: uweigand submitted PR review:

s390x changes now LGTM. For the remaining changes I'd defer to another maintainer.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 14:24):

Firestar99 updated PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 14:26):

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_std support in CI until the other PR is merged.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 14:26):

Firestar99 edited PR #15131:

Independent Followup from https://github.com/bytecodealliance/wasmtime/pull/15115:

Going full no_std with cargo b -p cranelift-codegen --no-default-features --features all-arch still fails to compile due to s390x using f32::powi(), which is a #[rustc_allow_incoherent_impl] so even though it's declared in core, it only "exists" in std. [...]

Note that libm doesn't have a dedicated f32::powi() implementation, so crates like num-traits implements it by wrapping powf.

There's a couple options to implement this:

  1. What this PR does: Fallback to libm::pow if std feature is disabled. I decided against adding the num-traits crate and just add my own cfg switch.
  2. Always use libm to 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?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 14:27):

Firestar99 edited PR #15131:

Independent Followup from https://github.com/bytecodealliance/wasmtime/pull/15115:

Going full no_std with cargo b -p cranelift-codegen --no-default-features --features all-arch still fails to compile due to s390x using f32::powi(), which is a #[rustc_allow_incoherent_impl] so even though it's declared in core, it only "exists" in std. [...]

Note that libm doesn't have a dedicated f32::powi() implementation, so crates like num-traits implements it by wrapping powf.

There's a couple options to implement this:
1. What this PR does: Fallback to libm::pow if std feature is disabled. I decided against adding the num-traits crate and just add my own cfg switch.

We decided on:

  1. Always use libm to 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:15):

Firestar99 converted PR #15131 fix no_std on s390x to a draft.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:19):

:thumbs_up: uweigand submitted PR review:

LGTM, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:21):

uweigand commented on PR #15131:

@Firestar99 you just marked this as draft - do you no longer want me to merge it?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:21):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:40):

Firestar99 updated PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:40):

Firestar99 has marked PR #15131 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:41):

Firestar99 commented on PR #15131:

CI now tests cranelift-codegen without std feature and it should hopefully pass

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 15:49):

theotherjimmy has enabled auto merge for PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 16:02):

theotherjimmy added PR #15131 fix no_std on s390x to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 16:24):

github-merge-queue[bot] removed PR #15131 fix no_std on s390x from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 16:37):

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

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 17:56):

alexcrichton added PR #15131 fix no_std on s390x to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 18:44):

github-actions[bot] added the label cranelift on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 18:44):

github-actions[bot] added the label isle on PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 19:45):

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:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 20:28):

:check: alexcrichton merged PR #15131.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 03 2026 at 20:28):

alexcrichton removed PR #15131 fix no_std on s390x from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 11:30):

Firestar99 commented on PR #15131:

@alexcrichton So for adding no_std tests in CI: Here you're pointing me at the micro_checks job, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at the platform_checks job, where I've added no_std checks. Should we still add the checks to the micro_checks job or do you think it's fine as is?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 11:30):

Firestar99 edited a comment on PR #15131:

@alexcrichton So for adding no_std tests in CI: Here you're pointing me at the micro_checks job, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at the platform_checks job, where I've added no_std checks. Should we still add the checks to the micro_checks job or do you think it's fine as is?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 11:31):

Firestar99 edited a comment on PR #15131:

@alexcrichton So for adding no_std tests in CI: Here you're pointing me at the micro_checks job, which haven't been added since this got merged immediately. Whereas in https://github.com/bytecodealliance/wasmtime/pull/15115 you've pointed me at the platform_checks job, where I've added no_std checks and made them no_std in this PR. Should we still add the checks to the micro_checks job or do you think it's fine as is?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 15:24):

alexcrichton commented on PR #15131:

Ah yes sorry, to clarify:

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 use extern crate std)


Last updated: Nov 19 2026 at 20:05 UTC