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

Questions about WIT transition #24

Open
yamt opened this issue Jul 14, 2022 · 9 comments
Open

Questions about WIT transition #24

yamt opened this issue Jul 14, 2022 · 9 comments

Comments

@yamt
Copy link

yamt commented Jul 14, 2022

my understanding is

am i right?

@abrown
Copy link
Collaborator

abrown commented Jul 14, 2022

No, I don't think so. When I switched this repository over to WIT in #17, I kept the API the same, so unless I unwittingly made a mistake, there should be no change for users.

With #17 now complete, it seems like a good time to migrate existing implementations to the WIT-based tooling (e.g., in Wasmtime, in the wasi-nn bindings repository). Are you interested in helping out with that?

(@radu-matei, we had talked previously about migrating the tract implementation into Wasmtime--what do you think about that now?)

@radu-matei
Copy link
Contributor

Moving the Tract implementation into Wasmtime is still a really good idea!
(particularly because Tract has no additional hardware or software prerequisites)

@yamt
Copy link
Author

yamt commented Jul 15, 2022

No, I don't think so. When I switched this repository over to WIT in #17, I kept the API the same, so unless I unwittingly made a mistake, there should be no change for users.

wit version of get-output returns the tensor record while witx version of it only returns tensor-data.

With #17 now complete, it seems like a good time to migrate existing implementations to the WIT-based tooling (e.g., in Wasmtime, in the wasi-nn bindings repository). Are you interested in helping out with that?

yes.
i'm more interested in C implementation than rust though.

(@radu-matei, we had talked previously about migrating the tract implementation into Wasmtime--what do you think about that now?)

@abrown
Copy link
Collaborator

abrown commented Jul 18, 2022

wit version of get-output returns the tensor record while witx version of it only returns tensor-data

Oh, sorry, I will fix that.

i'm more interested in C implementation than rust though.

You mean using wasi-nn from C code that you compile to wasm32-wasi? If so, does wit-bindgen do enough here or is more needed?

abrown added a commit to abrown/wasi-nn-spec that referenced this issue Jul 18, 2022
In porting the WITX definition to WIT, I inadvertently changed the
return type of `get-output`. @yamt identified this issue in WebAssembly#24--thank
you! This change fixes the return type to the original type,
`tensor-data`. (In the future, it may be interesting to return more
information about the tensor, but that can be a separate issue).
abrown added a commit that referenced this issue Jul 18, 2022
In porting the WITX definition to WIT, I inadvertently changed the
return type of `get-output`. @yamt identified this issue in #24--thank
you! This change fixes the return type to the original type,
`tensor-data`. (In the future, it may be interesting to return more
information about the tensor, but that can be a separate issue).
@yamt
Copy link
Author

yamt commented Jul 19, 2022

i'm more interested in C implementation than rust though.

You mean using wasi-nn from C code that you compile to wasm32-wasi? If so, does wit-bindgen do enough here or is more needed?

i meant to implement wasi-nn api for C-based engines. (eg WAMR)
my understanding is that wit-bindgen's C support today is only for wasm modules. is it right?

@yamt
Copy link
Author

yamt commented Jul 22, 2022

@yamt
Copy link
Author

yamt commented Sep 26, 2022

No, I don't think so. When I switched this repository over to WIT in #17, I kept the API the same, so unless I unwittingly made a mistake, there should be no change for users.

when you say the API is kept, which level are you referring?
the generated rust definitions like mod wasi_nn? or wasm import/export? or something else?

@tonibofarull
Copy link

any update regarding this?

@abrown
Copy link
Collaborator

abrown commented Jan 3, 2023

Looking up at the previous comments, I don't think I knew how to respond to this (and still am not clear). Let me take a stab at explaining how I see the wasi-nn world right now:

  • The component model is moving to WIT; I added a WIT definition for wasi-nn but retained the WITX one until it is absolutely no longer needed. In my view, wit-bindgen is moving along but until I get the thumbs up that WITX can be replaced, I am planning to keep the WITX definitions around (e.g., see this auto-generation script).
  • There are two sides to this: guest-side bindings and host-side bindings. Guest-side bindings are what is generated from WIT (by wit-bindgen, e.g.) to provide high-level access to WASI interfaces from a variety of languages (e.g., Rust, C, AS, etc.)--without guest-side bindings, the user has to write raw, low-level, i32-manipulating code in order to use WASI. On the other side, host-side bindings help engine developers plumb raw Wasm values over to the actual WASI implementation in the engine--without host-side bindings, the engine developer has to write raw, low-level code. wit-bindgen can also help with host-side bindings and you can (hopefully) understand my confusion and what I'm getting at with my questions up above.
  • I do not believe the wasi-nn specification will be substantially affected by the switch from WITX to WIT. The wasi-nn API is quite high-level and the same concepts can be expressed in both IDLs. If there are any minor ABI changes, they should be due to changes upstream, such as in the component model, etc., not due to wasi-nn itself (unless by typo!). In other words, I'm aiming to keep any changes from the WITX-to-WIT transition separate from any changes to wasi-nn itself (see feature: add "named models" #36, e.g.).

Hope that helps!

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