Description
Several of us (@loganek, @sunfishcode, @sunfishcode, @haraldh) have been working towards implementing all of the pieces to demonstrate an end-to-end wasi-threads
example. The current direction is to implement this in Wasmtime, though @loganek has also opened a PR to do so in WAMR (#1638). To that end, this issue is meant to track all of the various parts needed not only to show a proof-of-concept, but to upstream enough code for (fearless) users to try out this new functionality. I do not expect this to be a comprehensive plan, but only to implement what is necessary for the "stage 1" functionality described by @alexcrichton here (i.e., no component model integration).
We can split this into areas and I've made an effort to try to order the tasks within these.
Specification
- spec: consider adding
wasi_thread_exit
for early return from a thread (#7); will require some implementation inwasi-libc
andwasmtime
- spec: fix CI issues (#26)
Toolchains
- toolchain: allow importing and exporting the same memory in
wasm-ld
; done inD135898 - toolchain: allow compiling programs with
wasm32-wasi-threads
(#326); in progress at#331and #274 - toolchain: teach the toolchains to
import
shared memories by default; it seems most natural to have both the parent and child threads import a memory versus exporting it 1; under discussion at #502
Libraries
- wasi-libc: only run C constructors once (#339); ready to merge
- wasi-libc: initial thread-local values must be
memcpy
-ed to the TLS area; this seems to be handled by some combination of #342 and#343 - wasi-libc: resolve spinlock questions to merge pthread spinlock support (#324)
- wasi-libc: create a way to run
libc-test
tests; in progress at #369 - wasi-libc: audit for any missing pthreads APIs — the fundamentals are there but we need to determine what functions remain to be enabled
Engines
- wasmtime: implement
wait
andnotify
; on Linux, this could usefutex
as done here by @haraldh but we need a solution for all OSes (also, is the 32-bit limitation a problem?) - wasmtime: avoid mutation of buffers/strings passed in to host functions by Wiggle; #5054, #5225, #5229 #5264, #5268
- wasmtime: fix
validate_atomic_addr
;#5063#5239 - wasmtime: wasi: provide thread-safe implementations of WASI contexts bytecodealliance/wasmtime#5235
- wasmtime: implement
wasi-threads
; in progress at #5484
I'm completely open adding/removing/editing the items above as well as moving this issue somewhere else but I felt it would be helpful to keep track of the state of things.