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.
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.
So I don't know if there will be any further development on wasmlink
as a result.
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.
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.
I have no objections to that
I'll review a PR to wasmlink if it helps your scenarios in the short term
Awesome, thanks! I'll be submitting PRs in the next few days.
Saúl Cabrera has marked this topic as resolved.
Last updated: Dec 23 2024 at 12:05 UTC