WebAssembly / component-model

Repository for design and specification of the Component Model
Other
899 stars 75 forks source link

[Question] Is there a plan to support `wasm-threads`, specifically `shared memory`? #280

Closed bokuweb closed 7 months ago

bokuweb commented 7 months ago

ref: https://github.com/bytecodealliance/wasm-tools/issues/1306

Currently, when building with wasm32-wasi-preview1-threads using rayon, the generated wasm requires spawn_thread and shared memory. I believe shared memory is not yet considered. Are there any plans, discussions, or workarounds to address this?

lukewagner commented 7 months ago

The current plan is to extend threading support in core wasm through the shared-everything-threads proposal. The meat of this proposal is adding shared attributes to everything (not just memory), allowing whole instances to be shared (avoiding the O(n^2) function table usage with previous approaches) as well as a new solution for thread-local storage. There's also possibly a thread.spawn instruction for actually creating a new thread, but it's contentious (since it's a lot more work for browsers) so it's possible instead that we'll need to add thread.spawn as a canonical built-in to the Component Model (which would be importable by core wasm with the shared func type added by the shared-everything-threads proposal).

bokuweb commented 7 months ago

@lukewagner Thanks!!!!