-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Wasm threading #2517
Wasm threading #2517
Conversation
cd11041
to
dab8d3e
Compare
Use the `wasm_thread` library to enable real `spawn_blocking` on the Web in `linera_base::task`.
@@ -159,7 +162,7 @@ jobs: | |||
| xargs -0 scripts/target/release/check_copyright_header | |||
- name: Put lint toolchain file in place | |||
run: | | |||
ln -sf toolchains/lint/rust-toolchain.toml | |||
ln -sf toolchains/nightly/rust-toolchain.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line still needed at all then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we're still using the stable
toolchain by default.
spawn(async { task() }) | ||
let (send, recv) = oneshot::channel(); | ||
wasm_thread::spawn(move || { | ||
let _ = send.send(task()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the let _ =
for? Are you suppressing a warning intentionally? (If yes, consider adding a comment. Otherwise, I'd suggest not to use let _ =
in the first place.)
Atop #2516.
Motivation
Since we rely on parallelism to execute contracts without deadlocking, we need to add parallelism on the Web client to mimic the behaviour of the native client.
Proposal
Add the
wasm_thread
library and use it to provide parallelism on the Web.Note: this won't actually work in this repository as configured, because
wasm_thread
needs to be built with nightly Rust, and also have the following unstable target features enabled:Enabling these in this repository, though, will break the examples, since our native Wasm runtime can't handle the atomics instructions that rustc will output. Instead, we have enabled nightly here without the features, and will provide the flags when building from
linera-web
.Test Plan
Tested by
linera-web
.Release Plan
None.
Links