Stream: wasi-nn

Topic: Extending wasm-wasi-nn host impl with additional Backends


view this post on Zulip Richard Backhouse (Mar 29 2025 at 18:36):

I have an application that embeds wasmtime for host wasm component support. I have recently added the wasmtime-wasi-nn crate for wasi-nn support and so far it has worked out well when using the provided Engines within the crate.

I now would like to provide my own Engine(s) that are not part of the of the wasm-wasi-nn crate but I have run into a roadblock. When trying to provide the BackendExecutionContext trait impl I cannot access any of the wasmtime_wasi_nn::Tensor properties as they are set private and there is no impl for Tensor to enable accesses.

Would it be reasonable to add a impl for Tensor allowing access to the Tensor properties ? I see comments that the Tensor struct might be moved to each backend but its not clear how far off this might be.

Thanks

view this post on Zulip Andrew Brown (Mar 31 2025 at 16:49):

Yes, sounds reasonable to me. I suspect the tensor properties were simply not used publicly so they were default-private, but I don't see why they shouldn't be accessible. Are you interested in contributing a PR?

view this post on Zulip Richard Backhouse (Mar 31 2025 at 16:59):

Andrew Brown said:

Yes, sounds reasonable to me. I suspect the tensor properties were simply not used publicly so they were default-private, but I don't see why they shouldn't be accessible. Are you interested in contributing a PR?

Yes I should be able to do that.

view this post on Zulip Richard Backhouse (Mar 31 2025 at 18:42):

Here is the PR I created
https://github.com/bytecodealliance/wasmtime/pull/10493

…xtend without being part of wasmtime-wasi-nn Discussed here #wasi-nn > Extending wasm-wasi-nn host impl with additional Backends This change will allow wasmtime-wasi-nn Backend Engines to be lo...

view this post on Zulip Andrew Brown (Mar 31 2025 at 21:09):

Thanks!


Last updated: Dec 13 2025 at 17:03 UTC