-
Notifications
You must be signed in to change notification settings - Fork 53
Web Neural Network API as-is in WASI? #32
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
Comments
There is a proposal for WASI-nn, a machine learning API for WASI: WebAssembly/WASI#272. |
FYI, added to the WebML CG Teleconference – 14 May 2020 agenda for discussion: https://github.com/webmachinelearning/meetings/blob/master/telcons/2020-05-14-agenda.md |
I had a good chat with @abrown working on https://github.com/WebAssembly/wasi-nn and he had questions regarding the WebNN API and its coupling with browser-specific primitives (e.g. Navigator object) and some IDL types. @abrown this issue is a good one for fielding those questions. (There's also another issue discussing WebNN API in a non-browser runtimes for JavaScript: #142) |
Ideally, Wasm users would not have to worry about where their modules are going to be run (e.g. in a browser, in a standalone VM with WASI)--you can see these types of concerns in issues like WebAssembly/WASI#401. The issue is that web APIs and WASI are on separate tracks and run by separate groups of people so there is a possibility that the specifications diverge or are hard/impossible to run on the other side (e.g. the navigator object, browser-specific WebIDL types could be tricky to shim for WASI). My understanding from our talk is that WebNN should have few of these small shim problems, but I think we should make a concerted effort to try to reduce any big differences in the specifications. I think the big difference right now is that WebNN allows users to "build" up the inference graph whereas wasi-nn allows users to "load" the inference graph from an encoding. Any thoughts about that? I guess, in summary, I think we should do whatever is possible to minimize thrash for ML-specific users. |
@abrown I think one of the reason WebNN did not go with loader API is that, the ML model format is not mature. IMO ML model format is quite different from image and video format, the content of the format is keep evolving (i.e. continuously adding new kernels). To ensure models running successfully in different platforms, you would need a high level framework to polyfill the missing ops. Can you explain the difference between WASI and browser WASM? If WebNN is implemented in C++ can WASI and WASM take advantage of the same platform implementation with a JS binding? |
I agree and would add that the set of ML operators is also evolving (or so I hear). This is why we went down the "loader" path: the wasi-nn spec does not have to change when the formats change (avoiding thrash), whereas the WebNN spec must evolve alongside (i.e. try to keep up) with newly-added ML operators. Is this intuition correct?
A simple example: imagine a program that wants to "print stuff." A WASI-enabled Wasm module would have an import for This works because the WASI API and Web API for "printing" is roughly the same, if you squint. But if the APIs are significantly different (e.g. the "builder" vs "loader" dilemma), then the browser would have a tough time polyfilling wasi-nn's |
There's an interesting proposal over at WebAssembly System Interface repo WebAssembly/WASI#59 we should discuss.
Quoting OP:
Follow-ups over at the WASI repo or here. Consider this an early exploration. Currently this CG is not chartered to consider WASI but that could change in the future given adequate support for such a direction.
Cc @huningxin and @zolkis
The text was updated successfully, but these errors were encountered: