Path to Phase 4
The current main branch has become miserably out of date. We now have a rebased version of (most of) the threads specification living in a new branch (and I'm very grateful for @ioannad's invaluable help here). I've also passed over this branch to excise some long-standing bugs (e.g. https://github.com/WebAssembly/threads/issues/195) and other TODOs.
I'm using this issue to track my progress towards getting Threads phase 4-ready, since the only remaining bar facing the proposal's standardisation is full specification text. My intention is to start out doing this work in the upstream-rebuild branch, although I'm sure we'll have a conversation about how to update main at some point.
Core document TODOs:
- ~generalise binary encoding to allow LEBs~
- ~give text descriptions for
waitandnotify~ - ~describe behaviour of the
wait'(suspend) administrative instruction~ - ~fix tearing behaviour of float and SIMD non-atomics~
- ~describe the behaviour of the concurrent host~
- todo: finish writing prose / evaluate alternative formalisations
- ~todo: fully remove old host state particle~
- ~extend configurations to hold multiple threads~
- ~fix shared memory bounds checks in instantiation~
- ~rebase in the axiomatic constraints of the relaxed memory model~
- ~todo: predicates should be coinductive~
- todo: work out why sphinx is rendering negative space weirdly
- ~todo: auxiliary functions~
- todo: finish writing prose
- ~todo: predicates should be coinductive~
- extend these constraints to describe
wait/notifyqueue behaviour - ~link the above constraints to the actions emitted in the operational semantics~
- ~todo: syntax for coinductives~
- formatting - add line breaks where the PDF overflows
JS-API document TODOs:
- ~check with an expert whether I got the JS-API rebase correct~
- ~integrate with growable SharedArrayBuffer~
- final inline todos
Interpreter TODOs:
- ~rebase the interpreter into the new branch~
- ~collect together the tests from the other WIP branches~
- update
.wast->JStest generation tool to handlethreadandwait
Misc TODOs:
- re-unify with main(?)
- ~update the spec render~
- check whether any other documents need updating
- final inline TODO sweep
since phase 4 is "finished", do you have a sense of which runtimes have been able to implement this considering the disrepair of the spec text, leading to this issue? Wondering if wasm3 wasmer etc have managed despite it.
One of the requirements of phase 4 is that two Web engines implement the feature, often on the basis of the overview description before the full spec text is finalised. For threads, I believe all of V8, WekKit, and SpiderMonkey implement the feature. Of course, it's still a problem that the spec text is taking so long to be produced.
I'm not too familiar with the state of non-Web runtimes, but I believe that at least Wasmtime and WAMR have some threads implementation, on the basis of this blog post.
(Wasmtime does support the threads proposal; status here).
Hello @conrad-watt
I noticed that progress is being made on the upstream-rebuild branch!
I just wanted to share words of support, this proposal is awaited with a lot of excitement in the community; it's going to be a great leap forward for WebAssembly once it lands 👏
The spec render (https://webassembly.github.io/threads/) is now updated to be based on the upstream-rebuild branch. There are still a handful of todos but it should be in a far better state than what was previously available there.
Small bump: the interpreter with green threads, and associated tests, should now be fully rebased into the upstream-rebuild branch - the only caveat is that the harness for generating JS tests from .wast tests has not yet been updated to handle the thread construct in .wast (currently reports NYI if run).
Phase 4 has been achieved following the first day of our October hybrid meeting (notes to be uploaded shortly) 🎉
I'll make one last pass over the remaining issues in this repository shortly. The final step, after editorial tweaking, is to make preparations to join the "merge queue" of new phase 4 proposals, which will probably involve rebasing on top of the GC proposal.
Can't wait this for this proposal to go live! It just opens up a whole new possibilities.
I wonder if these links are related to that 'October hybrid meeting':
- https://webassembly.github.io/threads/core/syntax/instructions.html
- https://webassembly.github.io/spec/core/bikeshed/index.html#valid-thread
The proposal is "live" already, in the sense that most major engines have shipped it for quite a while.
The spec bit you link has no direct relation to this proposal, the notion of a thread has always existed as a spec device. You want to look here for the draft spec with threading.