Stream: git-wasmtime

Topic: wasmtime / PR #9837 Run the full test suite on 32-bit pla...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton opened PR #9837 from alexcrichton:pulley-full-test-suite to bytecodealliance:main:

This commit switches to running the full test suite in its entirety (./ci/run-tests.sh) on 32-bit platforms in CI in addition to 64-bit platforms. This notably adds i686 and armv7 as architectures that are tested in CI.

Lots of little fixes here and there were applied to a number of tests. Many tests just don't run on 32-bit platforms or a platform without Cranelift support, and they've been annotated as such where necessary. Other tests were adjusted to run on all platforms a few minor bug fixes are here as well.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton requested cfallin for a review on PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton requested fitzgen for a review on PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 21:30):

alexcrichton requested wasmtime-default-reviewers for a review on PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:11):

alexcrichton updated PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:19):

alexcrichton updated PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:41):

alexcrichton updated PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:46):

cfallin submitted PR review:

I'll defer to @fitzgen on the Pulley interpreter changes but a few thoughts on the conditional logic -- my main thought is that I'd prefer we didn't conflate "32-bit host" with "has no backend" and instead of a specific feature (or other method) meaning "we have a native codegen backend for the host platform"; seems less likely to cause unintentional issues later.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:46):

cfallin created PR review comment:

This is fairly counterintuitive -- could we take an Option or a custom enum here? Err turning into some other meaning below seems to go against what I'd expect Err to mean.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:46):

cfallin created PR review comment:

likewise here as above re: "has native backend" feature. Or alternatively, allowlist the natively supported ISAs; then at least when we add a new ISA we can grep for all the places ISAs are mentioned...

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 22:46):

cfallin created PR review comment:

The non-support here has less to do with "32-bit" than "no Cranelift backend for the host architecture", right? I wonder if we could add some build-script logic to add a cranelift-has-host-backend feature and then cfg on that here? My concern is otherwise that a bunch of "exclude 32-bit" conditions scattered through tests get missed if/when we do add a native backend for say arm32 or riscv32.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:01):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:01):

alexcrichton created PR review comment:

I'll try to think of something better yeah, but I also don't want to go too too overboard here because the tests handled in this PR are about 1% of our tests and are probably all largely redundant with all other tests we do from a "run this on all platforms" perspective. I definitely agree with what you're thinking though, I'm also not a fan of writing these #[cfg] and I like the idea of a build.rs-based thing (although it may be difficult to propagate that out beyond cranelift-codegen...)

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:19):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:19):

cfallin created PR review comment:

Alternate idea: could we add a method to Engine (or Config or ...) that lets the user query whether Wasmtime has a native compilation backend? Then the affected tests could early-out succeed. Such a query is probably useful for other cases too...

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:20):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:20):

cfallin created PR review comment:

(Likewise at the cranelift-native level, or whatever other level, for Cranelift.)

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:20):

cfallin edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:59):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 23:59):

alexcrichton created PR review comment:

It might help yeah, but the problem is that we have tests all over the place in all sorts of crates that need this logic. That leads to either duplication of the logic, moving tests, or something like that. Basically it's just really difficult wrangling a ubiquitous dependency on platform-specific logic when testing across platforms.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 02:15):

github-actions[bot] commented on PR #9837:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "pulley", "wasmtime:api"

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 (Dec 17 2024 at 13:23):

fitzgen submitted PR review:

Just looked at the runtime and pulley changes themselves since Chris looked at the other parts.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 13:23):

fitzgen created PR review comment:

Here I think it is worth explicitly checking against our ISAs supported by Cranelift.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 13:23):

fitzgen created PR review comment:

Shouldn't this happen automatically when the build script enables the feature?

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 13:26):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 13:26):

fitzgen created PR review comment:

I guess we could push and dedupe the check into some common dependency, which is a bit annoying, but would otherwise work. wasmtime-environ?

There is someone actively working on a riscv32 backend for cranelift, they've been commenting on zulip, so it would be a shame to build in new cranelift-doesn't-support-32-bit assumptions at this point...

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 18:42):

alexcrichton updated PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 20:12):

alexcrichton updated PR #9837.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 20:35):

alexcrichton commented on PR #9837:

Ok I've been thinking about how to clean this up. For the tests that @cfallin flagged I added logic to them all to check cranelift_native::builder() and see whether that's an error. That indicates whether the native platform is supported by Cranelift and tests will early-return if that's an error.

@fitzgen for your points though I'm not sure how to make it better. I'll note that the cargo:rustc-cfg in the build script is not enabling the pulley feature, it's just affecting the --cfg flags to the compiler. Accurately reflecting Cranelift's supported architecture would mean having:

[target.'cfg(not(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "s390x", target_arch = "riscv64")))'.dependencies]
pulley-interpreter = { workspace = true }

And then reflecting that same condition into build.rs

This feels "zoomed out" enough to me that leaving target_pointer_width = "32" as a proxy there for now is probably sufficient, but I want to confirm with you and/or see if you know of a way to simplify this.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 21:30):

fitzgen commented on PR #9837:

That cfg is certainly annoying but seems like it is probably better than baking in new assumptions that we know are unlikely to be true for too long?

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 22:23):

alexcrichton commented on PR #9837:

To clarify though the precise assumption here is that 32-bit platforms don't have a Cranelift backend so pulley is pulled in as a dependency. This doesn't actually change any logic internally within Cranelift or Wasmtime, it just compiles in Pulley by default without a way to turn that off. That's only a problem with respect to binary size.

If all of Cranelift's currently supported architectures are listed out here then that's duplicated in two places in Wasmtime (not counting the ones in Cranelift) and they're just going to get blindly added to in the future. Alternatively if Cranelift gets a 32-bit backend then that would be added as an exception to the cfg as-is when binary size becomes a problem.

To me this is six-to-one-half-dozen-or-the-other where I have a preference for what's as-is as it's a managable cfg that's by-default workable for most platforms (it doesn't work for 64-bit platforms without a Cranelift backend). Listing out architectures individually feels "just as bad" to me basically.

The main alternative to me is that we leave pulley disabled by default on all platforms, regardless of Cranelift support. That feels like a worse experience to me though because it means that Wasmtime only works by default on Cranelift-supported platforms, which if someone's new to Wasmtime they might not understand to enable the Pulley backend.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2024 at 16:52):

alexcrichton commented on PR #9837:

ping @fitzgen on ^


Last updated: Dec 23 2024 at 12:05 UTC