Skip to content
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

[browser][MT] faster memory view refresh + cleanup #101249

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

pavelsavara
Copy link
Member

  • the only real change is adding if (wasmMemory.buffer !== Module.HEAPU8.buffer) to forceThreadMemoryViewRefresh
  • removed duplicate if (WasmEnableThreads)

There is sibling PR for testing what would happen if we remove it all #101248

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm labels Apr 18, 2024
@pavelsavara pavelsavara added this to the 9.0.0 milestone Apr 18, 2024
@pavelsavara pavelsavara requested review from kg and maraf April 18, 2024 16:40
@pavelsavara pavelsavara self-assigned this Apr 18, 2024
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

const memory = runtimeHelpers.getMemory();
if (memory.buffer !== Module.HEAPU8.buffer) {
const wasmMemory = runtimeHelpers.getMemory();
if (wasmMemory.buffer !== Module.HEAPU8.buffer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason of using updateMemoryViewes here, not forceThreadMemoryViewRefresh that differ with calling wasmMemory.grow(0);? We don't need to propagate the knowledge about the update between threads?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that grow(0) is relatively expensive.
But the receiveWorkerHeapViews is called from too many places.

@pavelsavara pavelsavara merged commit 9c237f0 into dotnet:main Apr 19, 2024
33 of 37 checks passed
@pavelsavara pavelsavara deleted the browser_mt_memory_views branch April 19, 2024 10:01
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants