-
Notifications
You must be signed in to change notification settings - Fork 302
Description
It looks like the WASI specification with the component model / interface types specification as written today does not support a shared memory type. Mutable shared memory is an important capability for many kinds of software that have tight bounds on latency and/or would benefit from zero-copy IO, ranging from:
- Virtual machines and emulators
- High performance computing, especially networking and message passing interfaces
- Databases software, especially with
mmapbacked buffers from the host - Video and audio streaming, as zero copy IO reduces latency and jitter, memory subsystem overhead
In fact, the current design of the WASI specification makes it more difficult to share memory between host and guest as compared to pre-component model specification, by constraining input & output codegen to specific named types.
There are many ways to address this gap, e.g.:
- If certain types, like
list<T>supported being declared as aborrow<list<T>>. In Rust, this would be received as a&mut [T], in JavaScript aTypedArray, and so on. - A dedicated shared buffer type created instead
- WASI IPC module #49
- Support for an MVP of mmap #304
For a concrete use case, the Microsoft AI Controller Interface project uses shared memory to reduce latency on mutating moderately large arrays of floating point numbers representing the logits of a large language model.