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

Publish wasi-nn Rust bindings here? #60

Open
abrown opened this issue Mar 26, 2021 · 6 comments
Open

Publish wasi-nn Rust bindings here? #60

abrown opened this issue Mar 26, 2021 · 6 comments

Comments

@abrown
Copy link
Contributor

abrown commented Mar 26, 2021

I would like to publish Rust bindings for wasi-nn that were generated with the witx-bindgen tool in this repo (the Rust bindings currently live in a Wasmtime example). It would be helpful to me to have the bindings in one place--i.e., most likely this repository--so that changes to WITX, the tools, etc., can be tested against bindings from several modules. This would simplify creating and maintaining WASI proposals and there are other WASI proposals (e.g. wasi-crypto, wasi-sockets, etc.) that might benefit from this same idea.

The first question is "should this be done?" and I am interested in opinions here. Then, "how?": I think this repository (and accompanying CI tasks) could be slightly refactored to generate and publish multiple crates, one per proposal. Thoughts?

@abrown
Copy link
Contributor Author

abrown commented Mar 26, 2021

@jedisct1
Copy link

The AssemblyScript/Zig bindings and documentation for wasi-crypto and other APIs were all generated with as-witx. The Rust bindings were generated with witx-generate-raw.

But none of these code generators support the recent changes made to the witx format yet.

I don't know what tools other proposals have used to generate their bindings. Some of them (ex: experimental-http) are manually written.

Before centralizing these bindings, maybe we really need code generators (not only for Rust) that we could all use.

@alexcrichton
Copy link
Member

I'm not personally sure where best the bindings for all the proposals to wasi would live, but here seems as best a place as any while we figure that out?

@pchickey
Copy link
Collaborator

Agreed with Alex that the long term isnt clear, but for now we should start by getting the Rust code generator in this crate working for all proposals. I don't have an opinion on where code generators for other languages should live.

@abrown
Copy link
Contributor Author

abrown commented Apr 13, 2021

maybe we really need code generators (not only for Rust) that we could all use

@jedisct1, is witx-codegen an attempt to fix this problem? I haven't tried it out yet, but I like the idea of being able to generate bindings for a bunch of different languages! How do you see that tool relating to the current Rust code generator in this repo--should it replace it? Live alongside?

@jedisct1
Copy link

@abrown Yes. witx-codegen was made to solve this problem, which also affected other non-rust projects as changes to witx were made. It merges existing code and doc generators into a single tool, which is way easier to maintain than all these different forks of as-witx.

witx-codegen is currently being updated to use the BindGen trait in order to support the next ABI, and for the Rust backend, the code from this repository can easily be ported to it instead of exposing a different interface.

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

4 participants