WebAssembly / WebAssembly/WASI
Request: Support sharing mutable memory between host and guest
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
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
- #49
- #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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the WASI component model and interface types specifications, then review linked issues #49 and #304 and the Microsoft AICI use case. Done would require an agreed design for sharing mutable memory between host and guest, including the supported type or mechanism and its specification impact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100