hi everyone, sorry, this is my first message here so I am not sure if I am on the right channel. But I would like to understand if WASM + wasmtime offers GPU support? I would like to develop a simple object detection service that leverages my gpu (5060 ti), and it needs to be compiled to wasm
A message was moved here from #wasmtime > CLI Argument Options by Alex Crichton.
Wasmtime out-of-the-box has support for wasi-nn, but whether that's what you're looking for would require someone more knowledgable than I to investigate. There's also wasi-gfx historically which has had Wasmtime support too, but that's not in bytecodealliance/wasmtime the-repo.
Ok, thanks, I'll look into it!
To give a few links: wasi-gfx defines some interfaces for this, and there is the wasi-gfx-runtime reference implementation
You haven't said anything about your environment and the "needs to be compiled to Wasm" requirement, so whether the above is viable depends on whether you are choosing your runtime (hence can choose the above) or have to deliver a portable Wasm module that works "anywhere"
Got it. Yeah, that's the only thing that's strict, to be compiled to WASM, simply that. The runtime is up to me
Aditionally, I'll be running ML inference models for the object detection. The best shot I've seen so far documented on the internet + AI search was wasmtime + wasi-nn + libtorch (pytorch). I am trying that but didn't have success so far.
You can consider writing your own wasmtime wasi-nn Backend for your accelerator. I've done this a couple of times for different AI Accelerators and its worked out really well.
You can look at the Backend implementations included in wasmtime to see the traits you need to implement (wasmtime_wasi_nn::{backend::BackendExecutionContext, wasmtime_wasi_nn::{backend::BackendGraph etc)
I ended up having to write the Rust->C/C++ code calling the Accelerators APIs but you might be able to find that there is Rust code out there that already handles it.
I ended up being able to perform the AI inference using the wasi-nn defined API from my WASM components
A colleague suggested using host functions for my use case, and it turns out that it is suitable, so I am gonna go with that approach
Thanks everyone for the replies!
Last updated: Jan 10 2026 at 02:36 UTC