-
Notifications
You must be signed in to change notification settings - Fork 319
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
List of issues to discuss with TC39, WASM, JS engine teams #747
Comments
|
|
|
WebCodecs is also interested in read-only ArrayBuffers, for providing access to YUV planes in CPU memory that remain owned by decoders. Is there any previous work on this request? |
A discussion on the internal-gpu mailing list can be found here: Other discussions I just found: |
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It turns out that this (or synchronous receive-message) would also be extremely useful to WebAssembly for sending modules around for dynamic linking. |
Another important thing to discuss with TC39 is adding a concept of non-transferrable Contrary to the other TC39 topics in this issue, this one is important to figure out before WebGPU v1 as it is an important part of the WebGPU semantics (and not a future improvement). |
This might also require a change to the HTML spec for structuredSerializeWithTransfer (an internal postMessage algorithm) |
As mentioned above:
We might be able to make this work entirely within our spec instead of having to go change the behavior of ArrayBuffer. In more detail: If you tried to transfer a getMappedRange-created ArrayBuffer, it would appear to work entirely normally - old ArrayBuffer would get detached - except the underlying data would get copied into a new, run-of-the-mill ArrayBuffer, which means that any writes to the new ArrayBuffer would not appear in the GPUBuffer upon unmap(). |
Filed new issue #2072. |
AFAIK, what you're describing is the behavior for non-transferable objects, though? Minus the fake detach, that is. I guess the point is that this wouldn't be an observable behavior change compared to the usual behavior (except in the context of WebGPU memory mapping, which isn't specified by TC39)? |
Replied in #2072 (comment) |
I think this would still be considered a change to JS. You've got this thing called an |
It does behave like an ArrayBuffer in every way relevant to JS. When you transfer an ArrayBuffer in JS, you can't tell whether it's copied or moved because there is no way to observe that. WebGPU provides a way to observe it for these specific ArrayBuffers, because they're views into some memory owned by WebGPU. The difference is really that WebGPU observes writes before the transfer, and it doesn't observe them afterward. Thinking about it this way, perhaps the way I specced it sounds more intrusive to the ArrayBuffer spec than it should. I'll look at whether I can make that better. |
This proposal might be a step toward a SharedObjectTable like thing: |
triage: This is just a tracking issue and nothing here is required for V1 since we don't have multithreading, and have resolved our buffer-mapping-detach problem. |
Any updates? |
@MikhailGorobets Not at this time. This issue tracks a bunch of things, what in particular are you interested in? |
@kainino0x Line 935 in fb97a57
|
Thanks, good to know. There was some progress in investigating this direction but we have not had resources to work on it in a while. It will also of course require WebGPU to have multithreading in the first place, which is #354. In the meantime, there's also been a little bit of investigation into Emscripten having a way to proxy all WebGPU calls to a single thread so that neither of those will be necessary. This won't perform as well, but unfortunately we haven't prototyped it yet. See emscripten-core/emscripten#19645 |
mmap
'ing ArrayBuffers into WASM heapmmap
)Ability to make ArrayBuffers non-transferrableEDIT: It turns out this already exists as[[ArrayBufferDetachKey]]
SharedObjectTable
a bit likeSharedArrayBuffer
but instead of containing bytes, they contain references to shallow-cloneable objects ([Serializable]
IDL interface objects). This should allow for example forGPUTexture
s created on one worker to be instantly visible to other workers.receiveMessage()
onMessagePort
. (WASM multi-threading ability #476)Please add more issues on this thread.
The text was updated successfully, but these errors were encountered: