-
Notifications
You must be signed in to change notification settings - Fork 8
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
Tracking issue for end-to-end wasi-threads support #10
Comments
So, there is the atomic-wait crate written by Mara Bos. Here is what she wrote about the other OSes:
So I don't know what OS the person used, whoever specified |
|
Do you mean |
Yeah, something to implement |
So there are two types of pthread cancellation: DEFERRED and ASYNCHRONOUS : https://man7.org/linux/man-pages/man3/pthread_setcanceltype.3.html. IIUC deferred cancellation is much simpler and doesn't need any OS support, its all implementable in user space. Async cancellation is much harder and normal relies on some kind of async signal primitive under the hood. I have previously proposed that we simply ignore asynchronous cancellation since async signal very different to anything that exists in wasi/wasm today. I would also argue that very few real world program depend on it, but my information here is obviously not complete. |
@haraldh, it looks like V8 bottoms out in their own |
I've created bytecodealliance/wasmtime#5274 to make a way to measure how much (or little) locking will affect WASI performance. |
Once spec or some form of docs/description, and some example/test binaries are available, I'd love to implement support in https://github.com/turbolent/w2c2. |
@turbolent This might be helpful: #11 |
in this weekend, i implemented wasi-threads for toywasm. |
FYI WAMR implementation is being tracked here: bytecodealliance/wasm-micro-runtime#1790 |
For those interested, I updated the description for this issue with the state of the latest PRs. With a highly-customized environment (e.g., bytecodealliance/wasmtime#5484), I have a benchmark that runs parallel compression using wasi-threads in Wasmtime. I think @yamt has also shown how to run ffmpeg in parallel somewhere (with Wasmtime or his toy engine, I'm not sure). In my view, the current state of this issue is that the main check boxes above are all covered by applicable PRs. We simply need to clean up and merge those PRs for wasi-threads to be generally available for testing. It might take a while for things to start showing up in various releases and I would expect some bugs to be found in various projects, but my impression is that this effort is almost complete. |
Should we target including the API in preview2? I don't mean to rush, but feels like we already are quite confident about the API, have a few work-in-progress/completed implementations and most of the important ambiguities have been clarified. |
@loganek, that's a good idea. @sunfishcode, any thoughts on that? |
Because of wasi-thread's decision to go forward with instance-per-thread, I myself don't know how this could be be possible within any predictable timeframe. |
I am going to close this issue since the main idea of it — tracking the implementation of wasi-threads end-to-end — is now upstreamed in both Wasmtime and WAMR and all of the toolchain work to get here is contained in the |
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
wasi_thread_exit
for early return from a thread (#7); will require some implementation inwasi-libc
andwasmtime
Toolchains
wasm-ld
; done inD135898wasm32-wasi-threads
(#326); in progress at#331and #274import
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 #502Libraries
memcpy
-ed to the TLS area; this seems to be handled by some combination of #342 and#343libc-test
tests; in progress at #369Engines
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?)validate_atomic_addr
;#5063#5239wasi-threads
; in progress at #5484I'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.
Footnotes
this also likely involves figuring out a better place to create the shared memory initially in Wasmtime (instead of here) ↩
The text was updated successfully, but these errors were encountered: