IssueRaiser

Tracking issue for WebAssembly atomics

This is an issue intended to track the state of WebAssembly atomics support in Rust. For the WebAssembly target there is the [threads proposal in WebAssembly](https://github.com/webassembly/threads) which adds a number of instructions and a new kind of memory to the WebAssembly specification. The new instructions largely deal with atomic memory operations (e.g. `i32.atomic.add`), but also deal with synchronization between threads (`memory.atomic.notify`). The threads proposal does *not* add an ability to spawn threads nor does it really define what threads are, but it's largely set up to have a wasm-instance-per-thread (not that this is super relevant for the standard library). As of the time of this writing the WebAssembly threads proposal is at [stage 2 of the phases process](https://github.com/webassembly/proposals). It is [shipping in Chrome and in Firefox](https://webassembly.org/roadmap/), however. Rust's support for this proposal boils down to a few things: * Primarily Rust/LLVM support the `-Ctarget-feature=+atomics` CLI flag to rustc. This causes codegen for atomic types like `std::sync::atomic` [to use the atomic instructions](https://godbolt.org/z/GGz3fq). * Rust has support for the three synchronization intrinsics: * [`memory.atomic.notify`](https://doc.rust-lang.org/stable/core/arch/wasm32/fn.memory_atomic_notify.html) * [`memory.atomic.wait32`](https://doc.rust-lang.org/stable/core/arch/wasm32/fn.memory_atomic_wait32.html) * [`memory.atomic.wait64`](htt

Posted by alexcrichton on Oct 12, 2020, 12:50 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

reliability (Logistics)

Tracking issue for WebAssembly atomics

alexcrichtonOct 12, 2020, 12:50 AM

This is an issue intended to track the state of WebAssembly atomics support in Rust. For the WebAssembly target there is the [threads proposal in WebAssembly](https://github.com/webassembly/threads) which adds a number of instructions and a new kind of memory to the WebAssembly specification. The new instructions largely deal with atomic memory operations (e.g. `i32.atomic.add`), but also deal with synchronization between threads (`memory.atomic.notify`). The threads proposal does *not* add an ability to spawn threads nor does it really define what threads are, but it's largely set up to have a wasm-instance-per-thread (not that this is super relevant for the standard library). As of the time of this writing the WebAssembly threads proposal is at [stage 2 of the phases process](https://github.com/webassembly/proposals). It is [shipping in Chrome and in Firefox](https://webassembly.org/roadmap/), however. Rust's support for this proposal boils down to a few things: * Primarily Rust/LLVM support the `-Ctarget-feature=+atomics` CLI flag to rustc. This causes codegen for atomic types like `std::sync::atomic` [to use the atomic instructions](https://godbolt.org/z/GGz3fq). * Rust has support for the three synchronization intrinsics: * [`memory.atomic.notify`](https://doc.rust-lang.org/stable/core/arch/wasm32/fn.memory_atomic_notify.html) * [`memory.atomic.wait32`](https://doc.rust-lang.org/stable/core/arch/wasm32/fn.memory_atomic_wait32.html) * [`memory.atomic.wait64`](htt

Comments (0)

No comments yet. Start the discussion.

Comment on this issue