Stream: rust-toolchain

Topic: Proposal for a new `wasm32-wasi-preivew2` target


view this post on Zulip Alex Crichton (Nov 27 2023 at 15:06):

I've opened a MCP on the Rust project for the addition of a new target which would correspond to components

Proposal This is a proposal to add a new Tier 3 target to the Rust compiler named wasm32-wasi-preview2. This new target will be unlike preexisting WebAssembly targets in two major ways: The default...

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:03):

@Alex Crichton we already had an MCP accepted for that

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:03):

let me pull it back up

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:04):

https://github.com/rust-lang/compiler-team/issues/594

Proposal In 2019 the first version of the WASI spec was released (what we now call "WASI Preview 1"), and support was added to rustc as the tier-2 wasm32-wasi target. The folks working on WASI have...

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:04):

Unless you're proposing it should actually be a tier-3 supported platform?

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:04):

oh I had forgotten about this and didn't search well enough

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:05):

lemme reread this

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:06):

oh wow right that's a long zulip thread

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:07):

the only thing it doesn't do is require outputting actual WASI packages - the proposal basically leaves that up to cargo-component

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:07):

yeah so coming back to this in my opinion we should walk back the ambitions of this target and probably go through an MCP again

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:07):

I should clarify all of this though and update with respect to that MCP

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:07):

Chiefly I think that we should get the compiler output of wasm32-wasi-preview2 to be a component, not a core wasm module

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:08):

That, and being tier 3 to start, is a pretty big difference from the prior and reflects some recent thinking about how it better enables an incremental implementation of the target

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:08):

thanks for pointing this out though and apologies for forgetting about it!

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:08):

Alex Crichton said:

Chiefly I think that we should get the compiler output of wasm32-wasi-preview2 to be a component, not a core wasm module

strong agree with this, if we think this is practical

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:08):

I do actually disagree that it should be a tier 3 target though

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:09):

We had that discussion as part of accepting the MCP

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:09):

let me rephrase the tier part, this should start as tier 3, get developed, and then move to tier 2 when we're ready

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:09):

I'm wary of over-promising at the beginning when we're still figuring all this out

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:09):

and e.g. want to open the path to incrementally implementing things

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:09):

e.g. to produce a component the thinking is to use a custom linker, not wasm-ld, which is a wrapper around wasm-ld plus more component stuff

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:10):

and we can't reasonably get that to a "perfect" state on day 1, so starting at tier 3 is hopefully going to give some runway to fix bugs and break things before getting to tier 2

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:10):

the whole time though it should all be usable via -Zbuild-std

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:10):

okay okay

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:10):

I see that argument

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:10):

I should go reread the dicsussion though to address some of those points

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:11):

In the accepted proposal we basically made the case that tier 2 was fine, since it was mostly about maybe changing things in the stdlib / targeting a new version of wasi-libc

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:11):

But crucially we weren't touching the backend or codegen

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:12):

In your proposal you're explicitly saying that you do want to target the codegen bits, swapping out the linker

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:12):

yeah if we envision an entirely new binary format output I think it may change the calculus there

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:12):

yeah

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:12):

Yeah, I think that's reasonable

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:12):

ok cool I'll summarize all this in the Zulip thread and edit the proposal as well

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:13):

one more thing

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:13):

I think it would be wise that as part of the re-MCP, we make sure we get sign-off on acceptance criteria for when we can bump it to stage 2

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:15):

To make sure that we can initiative the "bump to tier 2" process by pointing to something which was already accepted, rather than needing to re-engage with the process

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:15):

makes sense yeah, but I'm not actually sure what that would entail? I wrote up some stuff under "Next Steps" but that's more target-specific rather than project policies, so I'm not sure if we'd want to add anything more there over what is already required of tier 2

Proposal This is a proposal to add a new Tier 3 target to the Rust compiler named wasm32-wasi-preview2. This new target will be unlike preexisting WebAssembly targets in two major ways: The default...

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:16):

oh okay, fair enough

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:16):

I'll make sure to note this in the discussion though

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:17):

I guess I'm coming at this from having put in significant work to get the MCP to be tier 2 lol

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:17):

that "Next Steps" is intended to be a set of criteria for tier 2

view this post on Zulip Yoshua Wuyts (Nov 27 2023 at 17:17):

So maybe I'm a little scarred going into this, being a bit wary of re-doing the entire discussion

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:17):

no that's a good point and I want to learn from that heh

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:35):

ok I think I've noted in the places with updates, but lemme know if I missed anything

view this post on Zulip Alex Crichton (Nov 27 2023 at 17:35):

or if you'd recommend making wording stronger anywhere or similar

view this post on Zulip Notification Bot (Nov 27 2023 at 17:47):

Denys Zadorozhnyi has marked this topic as resolved.

view this post on Zulip Notification Bot (Nov 27 2023 at 17:47):

Denys Zadorozhnyi has marked this topic as unresolved.

view this post on Zulip Christof Petig (Nov 27 2023 at 19:28):

My understanding is that the binary version of components will change once the component model is accepted as stable, basically rendering all tooling incompatible over night - is this going to be part of 1.0?
I fear that until then, given enough popularity of preview2, everybody became used to the temporary version number - and it becomes the new de-facto binary standard.

view this post on Zulip Alex Crichton (Nov 27 2023 at 19:32):

You're right that the version number will change, and I'm told by Luke that this is the same transition that core wasm itself went through. The current vision is that the version number will change but no other changes will be made, so binary parsers can validate that either the spec-defined version is present or the version just-before stabilization. So in that sense everything won't break overnight, there will be a long period where existing parsers will accept both


Last updated: Nov 22 2024 at 16:03 UTC