Skip to main content

Crate tensor_wasm_wasi_gpu

Crate tensor_wasm_wasi_gpu 

Source
Expand description

wasi-cuda host bridge — the explicit GPU kernel-launch API exposed to Wasm modules.

Wasm code imports the functions defined in abi::MODULE and uses them to upload PTX modules (abi::FN_LOAD_PTX) and launch kernels (abi::FN_LAUNCH). On hosts without CUDA the host functions return abi::AbiError::NotAvailable; on CUDA hosts they call into the cust crate via the cuda feature.

See wit/wasi-cuda.wit at the workspace root for the Component-Model interface definition (wasi:cuda/host@0.2.0) — the WIT and the constants in abi are kept in lockstep.

The scheduler module exposes a separate wasi:scheduler/host@0.1.0 interface for cooperative deadlines (roadmap feature #4) — guests offer suspend points via yield() and the host returns a non-zero code when the per-instance deadline is approaching. See docs/COOPERATIVE-YIELD.md.

Re-exports§

pub use host::InstanceMetricsSnapshot;
pub use streaming::add_input_to_linker;
pub use streaming::add_streaming_to_linker;
pub use streaming::HasInput;
pub use streaming::HasStreaming;
pub use streaming::InputContext;
pub use streaming::StreamingContext;
pub use streaming::FN_EMIT_CHUNK;
pub use streaming::FN_FLUSH;
pub use streaming::FN_INPUT_LEN;
pub use streaming::FN_READ_INPUT;
pub use streaming::MAX_CHUNK_BYTES;
pub use streaming::MAX_TOTAL_STREAM_BYTES;
pub use streaming::STREAMING_MODULE;

Modules§

abi
ABI for the wasi-cuda extension exposed to Wasm modules.
async_dispatch
Async GPU dispatch & back-pressure.
device_mem
DeviceMemRegistry — instance-scoped store of explicit device-memory allocations.
host
Host-side implementations of the wasi:cuda functions registered with wasmtime::Linker.
kernel_args
Typed argv lowering for the wasi:cuda launch host function.
registry
KernelRegistry — instance-scoped store of compiled PTX kernels.
scheduler
wasi:scheduler/host cooperative-deadline interface (roadmap feature #4).
streaming
wasi:tensor/host streaming surface (roadmap feature #2).