Skip to main content

Module executor

Module executor 

Source
Expand description

TensorWasmExecutor — async executor for TensorWasm Wasm instances.

Owns a shared TensorWasmEngine and a registry of live TensorWasmInstances keyed by InstanceId. Exposes the trio of operations TensorWasmExecutor::spawn_instance, TensorWasmExecutor::call_export, and TensorWasmExecutor::terminate — all async, all driven from the calling Tokio runtime.

Structs§

SpawnConfig
Configuration passed to TensorWasmExecutor::spawn_instance.
TensorWasmExecutor
The async executor.
TensorWasmResourceLimiter
Per-store ResourceLimiter that caps linear-memory growth at the engine-configured max_memory_bytes.
TimeoutContext
Payload for ExecError::Timeout. Carries the real elapsed and deadline figures captured when the epoch interrupt fired so the error mapping layer can surface them through tensor_wasm_core::error::TensorWasmError::KernelTimeout.

Enums§

ExecError
Errors raised by the executor.
WasmArg
A typed Wasm value supplied to TensorWasmExecutor::call_export_with_args.

Constants§

MAX_MODULE_BYTES
Hard upper bound on the byte length of a Wasm module the executor will accept for compilation. Modules above this size are rejected with ExecError::ModuleTooLarge before Module::from_binary runs — pathological code-section blow-ups can otherwise force Cranelift to burn arbitrary CPU on adversarial input. 64 MiB is comfortably above any legitimate ML kernel module we’ve seen (single-digit MiB is typical), while keeping the Cranelift worst case bounded.
MAX_START_FN_DURATION
Hard upper bound on how long a Wasm module’s start function (and any other code that runs inside wasmtime::Instance::new_async) is allowed to execute before the epoch interrupt trips.