wasi-gfx / wasi-gfx-runtime

43 stars 7 forks source link

Question: How to run my own example component? #46

Closed yowl closed 2 days ago

yowl commented 1 week ago

Hi,

I have a componet written in c# and would like to try it. Is there some way I can do that with cargo run -p runtime? Maybe just add an option to accept a file instead of an "example" here https://github.com/wasi-gfx/wasi-gfx-runtime/blob/0271ff4d4d006d6206a8511c43277ce70899f6d9/examples/runtime/src/main.rs#L145 ?

yowl commented 1 week ago

I think something like that will work, if I can make it work I will create a PR.

MendyBerger commented 6 days ago

For the last few days, I've been looking into creating a standalone runtime, so that wasi-webgpu can be played with. I'm not at all done, but will post here if I manage to put something together.

yowl commented 6 days ago

Ok, thanks, I've been fixing some alignment issue with the c# generator which manifests with this WIT which is why I've not posted back.

MendyBerger commented 4 days ago

Checkout https://github.com/wasi-gfx/graphtime Let's you run wasi-webgpu components

yowl commented 4 days ago

Thanks!.

On linux I get

scott@surface5:~/github/graphtime$ cargo build
    Updating git repository `https://github.com/MendyBerger/wasi-webgpu.git`
    Updating crates.io index
error: failed to select a version for `wasmtime`.
    ... required by package `graphtime v0.1.0 (/home/scott/github/graphtime)`
versions that meet the requirements `^21.0` (locked to 21.0.1) are: 21.0.1

the package `graphtime` depends on `wasmtime`, with features: `rustix` but `wasmtime` does not have these features.
 It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

and on windows:

error[E0432]: unresolved import `winapi::um::errhandlingapi`
   --> C:\Users\scott\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-hal-0.20.0\src\auxil\dxgi\exception.rs:5:10
    |
5   |     um::{errhandlingapi, winnt},
    |          ^^^^^^^^^^^^^^ no `errhandlingapi` in `um`
yowl commented 4 days ago

Possiblty https://github.com/GuillaumeGomez/sysinfo/pull/762/files required somewhere.

MendyBerger commented 4 days ago

I'm not getting these issues. Wanna hop on a call?

yowl commented 4 days ago

That's very knid, let me do some checking first.

yowl commented 4 days ago

updating rust solved some of them. but I believe wgpu 0.20 is yanked. so that is a problem

https://github.com/wasi-gfx/wasi-gfx-runtime/blob/754ad0f329438b8dfd679c1721286cb50c47f9fc/Cargo.toml#L20C1-L20C10

https://docs.rs/wgpu/latest/wgpu/

scott@surface5:~/github/graphtime$ cargo build
    Updating crates.io index
    Updating git repository `https://github.com/MendyBerger/wasi-webgpu.git`
error: failed to select a version for the requirement `wgpu-core = "^0.20"`
candidate versions found which didn't match: 22.1.0, 22.0.0, 0.21.1, ...
location searched: crates.io index
required by package `wasi-webgpu-wasmtime v0.1.0 (https://github.com/MendyBerger/wasi-webgpu.git?rev=754ad0f329438b8dfd679c1721286cb50c47f9fc#754ad0f3)`
    ... which satisfies git dependency `wasi-webgpu-wasmtime` of package `graphtime v0.1.0 (/home/scott/github/graphtime)`
MendyBerger commented 3 days ago

Right. It's yanked. But that should not effect a project that already has a Cargo.lock with v0.20. Can you ensure that your Cargo.lock is the same as the repos?

I should probably update wgpu, but until I get to that.

yowl commented 3 days ago

You are right, I'd fiddled with Cargo.lock, restoring it allows it to compile. On WSL I get

wasi-logger: INFO -
choose example
1: simple graph
2: squeeze
3: mnist

3
wasi-logger: INFO - 3
thread '<unnamed>' panicked at /home/scott/.cargo/git/checkouts/wasi-webgpu-5092375e741b05a7/754ad0f/crates/wasi-webgpu-wasmtime/src/lib.rs:2105:14:
called `Result::unwrap()` on an `Err` value: NotFound
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Which is the same I get for the skybox example, so that might be a WSL issue with getting the adapter. The framebufffer example does work in WSL, and so does my example component, which is a Doom fire demo

image

yowl commented 3 days ago

Corrected the RGB order image

yowl commented 2 days ago

I'll close this. These are the changes I made https://github.com/yowl/wasi-gfx-runtime/tree/user-example but maybe not worth creating a PR for it as graphtime would be better. See https://github.com/wasi-gfx/graphtime/issues/1

MendyBerger commented 4 hours ago

Just FYI I've updated wgpu which should make wasi-gfx-runtime more stable on windows. gfx-rs/wgpu/issues/5837