Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path to Phase 4 #198

Open
conrad-watt opened this issue May 16, 2023 · 9 comments
Open

Path to Phase 4 #198

conrad-watt opened this issue May 16, 2023 · 9 comments

Comments

@conrad-watt
Copy link
Collaborator

conrad-watt commented May 16, 2023

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. #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 wait and notify
  • 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
  • extend these constraints to describe wait/notify queue 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
    • syntax
    • single-thread semantics
    • fix cmpxchg wrapping behaviour (#195)
    • green threads and wait/notify implementations (#194)
  • collect together the tests from the other WIP branches
  • update .wast -> JS test generation tool to handle thread and wait

Misc TODOs:

  • re-unify with main(?)
  • update the spec render
  • check whether any other documents need updating
  • final inline TODO sweep
@codefromthecrypt
Copy link

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.

@conrad-watt
Copy link
Collaborator Author

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.

@abrown
Copy link

abrown commented Jun 15, 2023

(Wasmtime does support the threads proposal; status here).

@achille-roussel
Copy link

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 👏

@conrad-watt
Copy link
Collaborator Author

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.

@conrad-watt
Copy link
Collaborator Author

conrad-watt commented Oct 1, 2023

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).

@conrad-watt
Copy link
Collaborator Author

conrad-watt commented Oct 11, 2023

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.

@temeddix
Copy link

temeddix commented Oct 25, 2023

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':

@rossberg
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants