Stream: wasm

Topic: ✔ Dynamic Linking with Wasmlink


view this post on Zulip Saúl Cabrera (Mar 18 2022 at 20:10):

I've been experimenting with Wasmlink and I've created a (rough) PoC that extends its functionality in such a way that given a core Wasm module and a set of WIT interfaces, a new adapted module is produced which is expected to be dynamically linked against instances corresponding to the WIT interfaces; I've gone this route rather than using the default statically linked behaviour primarily because code-size is key to our use case at Shopify (and to take advantage of module linking and code reusability): e.g. a single module can import functionality from a potentially large list of other modules. Having proved that this approach works, I'm wondering if (i) there's any other tool (that I might have missed) that provides a similar functionality as the one described (ii) if not, if there's any interest in adding this functionality to the upstream implementation of Wasmlink.

A language binding generator for WebAssembly interface types - Dynamically link modules (PoC) · saulecabrera/wit-bindgen@1c91d84

view this post on Zulip Peter Huene (Mar 21 2022 at 15:33):

Hi Saul. That looks like a very useful change. With the upcoming component model proposal, I've been expecting wasmlink to no longer be necessary or be completely re-implemented as part of other tooling. When runtimes like wasmtime implement support for the component model, they should be able to JIT/AOT compile adapter code when linking together components. wasmlink was designed to generate core modules from other core modules that implement the canonical interface types ABI and that was done to get a semblance of "components" without any support from the runtimes for interface types.

Repository for design and specification of the Component Model - GitHub - WebAssembly/component-model: Repository for design and specification of the Component Model

view this post on Zulip Peter Huene (Mar 21 2022 at 15:34):

So I don't know if there will be any further development on wasmlink as a result.

view this post on Zulip Peter Huene (Mar 21 2022 at 15:35):

The current implementation status of the component model is that we have some low-level tools (encoding/parsing/etc) supporting the component model and almost done with some tooling that will transform a core module that implements the canonical ABI in its exports into a component. The next (daunting) task is then to get wasmtime to be able to link components together and execute them.

view this post on Zulip Saúl Cabrera (Mar 21 2022 at 22:05):

Thanks for your input @Peter Huene , your explanation aligns with my understanding of the status of the implementation of the Component Model in Wasm runtimes (concretely Wasmtime in our case).

With the Component Model being the north star I agree that wasmlink should probably be deprecated/rewritten; until then (and given the complexity of implementing the Component Model + the time that it might take) do you think it would make sense/would there be any concerns for us (Shopify) to upstream and maintain these changes and perhaps proceed to fully deprecate the tool once the Component Model implementation is functional? The advantage of this approach is that it benefits use-cases that rely on module linking and that want to have a semblance of components through core modules while the proposal is fully implemented in Wasmtime.

view this post on Zulip Peter Huene (Mar 21 2022 at 22:08):

I have no objections to that

view this post on Zulip Peter Huene (Mar 21 2022 at 22:09):

I'll review a PR to wasmlink if it helps your scenarios in the short term

view this post on Zulip Saúl Cabrera (Mar 22 2022 at 13:20):

Awesome, thanks! I'll be submitting PRs in the next few days.

view this post on Zulip Notification Bot (Mar 22 2022 at 13:20):

Saúl Cabrera has marked this topic as resolved.


Last updated: Nov 22 2024 at 17:03 UTC