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

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

Closed
yowl opened this issue Sep 8, 2024 · 14 comments
Closed

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

yowl opened this issue Sep 8, 2024 · 14 comments

Comments

@yowl
Copy link

yowl commented Sep 8, 2024

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

let wasm_path = format!("./target/example-{}.wasm", args.example);
?

@yowl
Copy link
Author

yowl commented Sep 9, 2024

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

@MendyBerger
Copy link
Member

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
Copy link
Author

yowl commented Sep 13, 2024

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
Copy link
Member

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

@yowl
Copy link
Author

yowl commented Sep 15, 2024

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
Copy link
Author

yowl commented Sep 15, 2024

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

@MendyBerger
Copy link
Member

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

@yowl
Copy link
Author

yowl commented Sep 15, 2024

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

@yowl
Copy link
Author

yowl commented Sep 16, 2024

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
Copy link
Member

MendyBerger commented Sep 16, 2024

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
Copy link
Author

yowl commented Sep 16, 2024

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
Copy link
Author

yowl commented Sep 16, 2024

Corrected the RGB order
image

@yowl
Copy link
Author

yowl commented Sep 17, 2024

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 wasi-gfx/graphtime#1

@yowl yowl closed this as completed Sep 17, 2024
@MendyBerger
Copy link
Member

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

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

2 participants