-
Notifications
You must be signed in to change notification settings - Fork 693
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
🛤 Bulk memory operations #1114
Comments
cc @jfbastien |
I'm a little concerned about how the temp buffer interacts with shared memory and observability of reads and writes since, in practice, we'll want to avoid using such a buffer. Specifically, the agent that performs the copying creates an order s.t. all reads from the source and writes to the temp buffer are ordered before all reads from the temp buffer and writes to the destination. Another agent can be writing to the source and reading from the target to see what happens; almost certainly that agent can observe that the ordering implied by the temp buffer is violated. Now, that violation might be allowed by the memory model anyway, since Still, I have this nagging thought that we should perhaps spec |
I wrote up a quick gist w/ some spec text here: https://gist.github.com/binji/acc43b94c0a747e51dfafa1b5b099c9a This still uses a temp buffer, but I think it makes it clearer that it is just a spec implementation detail. Probably could add a note to that effect as well. |
Moved to WebAssembly/proposals#18. |
This is a tracking issue for a post-MVP feature
It will be updated as the issue progresses.
Topic Bulk memory operations
Champion Ben Smith @binji
Status in progress
Phase Feature proposal
Linked issues #236 #977 #1057
Linked repositories bulk-memory-operations
Details
Copying and clearing large memory regions is very common, and making these
operations fast is architecture dependent. Although this can be done in the MVP
via
i32.load
andi32.store
, this requires more bytes of code and forces VMsto recognize the loops as well. The following operators can be added to improve
performance:
move_memory
: Copy data from a source memory region to destination region;these regions may overlap: the copy is performed as if the source region was
first copied to a temporary buffer, then the temporary buffer is copied to
the destination region
set_memory
: Set all bytes in a memory region to a given byteWe expect that WebAssembly producers will use these operations when the region
size is known to be large, and will use loads/stores otherwise.
The text was updated successfully, but these errors were encountered: