Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM components #128

Open
sandstrom opened this issue Feb 1, 2023 · 11 comments
Open

WASM components #128

sandstrom opened this issue Feb 1, 2023 · 11 comments
Assignees

Comments

@sandstrom
Copy link
Contributor

sandstrom commented Feb 1, 2023

I noticed the recent update to the readme for wit-bindgen.

It mentions that the wasmtime crate now has support for components:
https://github.com/bytecodealliance/wit-bindgen/blob/main/README.md#host-runtimes-for-components

There are also these docs (with examples for other languages):
https://component-model.bytecodealliance.org/language-support.html

Just wanted to check in and see if this is already supported in wasmtime-rb, or if there are plans to support it in the future.

@jbourassa
Copy link
Collaborator

Hey @sandstrom, unfortunately Wasm components are not currently supported in the Ruby bindings.

My understanding (could be outdated things are moving fast!) is that we're still at least a couple months away from the spec being stable. Thus I have no immediate plans to look into it, but happy to provide support if someone wants to work on it.

@linclark
Copy link

linclark commented Feb 1, 2023

I was just about to come in to say something similar :) (For context, I work closely with the Wasmtime time)

We're almost to a place with the component model where it makes sense to start thinking through how to componentize all of the various projects, but we're not quite there yet. If folks want to play around with the tooling, happy to see that, but there's still one chunk of work that needs to be done before we start encouraging people to really dig in.

@sandstrom
Copy link
Contributor Author

Thanks for the update @jbourassa and @linclark 🙏🏻

@superchris
Copy link

It seems like this might be worth looking at again now that WASI P2 has shipped. Love to see component support for ruby!

@jeffparsons
Copy link

Is this on anyone's radar right now?

Very much not saying I have funds available (I probably don't), but if I could find some, is there anywhere I could direct them to bump this up someone's priority queue? 😅

(I'd love to help out with implementation but I have negative free time right now.)

@saulecabrera
Copy link
Member

Is this on anyone's radar right now?

To my knowledge this isn't in anyone's radar right now unfortunately. However, if there's anyone interested or has the time to start contributing in this direction, I'm happy to provide support to get this work started.

@superchris
Copy link

Hey, I'm working on trying to add some component support to the elixir wasmtime wrapper, wasmex. If I make any progress, my guess is a lot of the rust code will be similar hopefully? I'll at least try to investigate and share whatever I can.

@jbourassa
Copy link
Collaborator

If none one has picked it up in 2 weeks, I could take a stab at it, or at least get the ball rolling. I do not have an immediate use case for it but I've been meaning to play around with Wasm components.

@jbourassa jbourassa self-assigned this Sep 26, 2024
@jeffparsons
Copy link

This Zulip thread may be relevant: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/wasmtime-py.20missing.20peices

Specifically the talk of extending the Wasmtime C API to handle Val etc.

Maybe worth syncing up with yohe if anyone starts working on this?

@jbourassa
Copy link
Collaborator

jbourassa commented Oct 3, 2024

Maybe worth syncing up with yohe if anyone starts working on this?

We don't use the C API. I think it'll be worth collaborating eventually, but for now I'm focusing on producing a working integration. I've made some progress; I'm about to tackle the Val conversion.

I plan to use the untyped API, using the Val enum to convert between Wasm types and Rust types, and convert those Rust types back to Ruby objects (numbers, Hash for records, Array for lists, exceptions for errors, etc.). In other words: Wasm (canonical ABI) <-> Rust (Val) <-> Ruby (VALUE).

There should be a way to bypass the Rust Val and go directly to Ruby by implementing the lift/lower for Ruby's VALUE. We can try that once we have the simpler approach working.

I haven't looked into resources yet, but IIUC they bring extra considerations. I'll look at that next, once I have a basic end-to-end component working.

@jbourassa
Copy link
Collaborator

See #388 for a first draft. Any feedback is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants