feat: added webgpu tensorflow example#624
Conversation
|
Hey @MendyBerger just double checking, but this is still in draft on purpose right? |
|
Yes, still need a few small changes. Will try to resolve soon |
0fbeb6f to
6d4ecfa
Compare
6d4ecfa to
f335008
Compare
| - Starts a local wasmCloud host that can run your WebAssembly component | ||
| - Builds this project (including necessary `npm` script targets) | ||
| - Deploys the component locally | ||
| - Watches your code for changes and re-deploys when necessary |
There was a problem hiding this comment.
Consider adding a short Overview / How it works section between the Quickstart and the request instructions that tells the wasmCloud-specific story this example is built to demonstrate, including implementation details like what wasi_webgpu: true in .wash/config.yaml does.
|
|
||
| ## Adding Capabilities | ||
|
|
||
| To learn how to extend this example with additional capabilities, see the [Adding Capabilities](https://wasmcloud.com/docs/tour/adding-capabilities?lang=typescript) section of the wasmCloud documentation. |
There was a problem hiding this comment.
Consider adding a Known limitations section before the "Adding Capabilities" link covering the rough edges a copy-paster will hit. Suggested content:
Math.randomis currently constant.polyfil.jsoverridesglobalThis.Math.randomto return0.5as a temporary shim untilwizerinitializeswasi:random. We should probably flag this.- WIT fetching uses
wit-depsinstead ofwash wit fetch. Mentioned above, but we should probably flag this explicitly. - Resulting
component.wasmis large. Might be worth noting and explaining why.
|
@ericgregory really sorry to do such a large refactor after review. I did try to incorporate the changes you requested though. This won't work without wasmCloud/wasmCloud#5122 |
|
@MendyBerger No worries, and this looks great! I only see a few small things after the refactor:
|
Signed-off-by: Mendy Berger <12537668+MendyBerger@users.noreply.github.com>
Adds a TensorFlow.js example running on top of
wasi:webgpuNeeded before merging:
Other external PRs that would allow removing some hacks here:
Other comments
location.searchis polyfiled to an empty string because tf assumes that's it's available.navigator.gpuis first set to empty an object at initialization so that the check if webgpu is available succeeds, and is later at runtime overridden with the real gpu object from wasi-gfx-js