-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implementing mapping in multithreaded WASM #248
Comments
kainino0x
added
threading
Thread safety and WASM-JS threading problems
wasm
Issues with WebAssembly targets
labels
Nov 22, 2023
Also possibly relevant: spontaneous-mode MapAsync (in the Futures version of the API, #199) will complete mappings on arbitrary threads in native. For example, it could happen inside an innocuous Submit from an application thread. Unless we check which thread we're running on and prevent this from happening. |
kainino0x
added
!discuss
Needs discussion (at meeting or online)
needs docs
Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd.
labels
Feb 28, 2024
Mar 28 meeting:
|
Closing (but with "needs docs") |
kainino0x
removed
the
needs docs
Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd.
label
Dec 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've given this problem a lot of thought but I can't find a filed issue about it, so here's a quick note.
In native, threads freely do things with whatever objects they want (gpuweb/gpuweb#476) and that includes mapping and unmapping buffers.
However in JS, a buffer can only be unmapped from the thread where it's mapped, and ArrayBuffers for the mapping only exist on that thread. However since there is currently no way to map that ArrayBuffer into the WASM heap, Emscripten just mallocs WASM heap memory for the map, and copies to/from it as needed.
Possible ways to resolve this:
The text was updated successfully, but these errors were encountered: