Loading video...

Video Failed to Load

Go Home

Starting to multithread with WebAssembly.

21,426 views • 1 year ago •via X (Twitter)

9 Comments

Grant Kot's profile picture
Grant Kot1 year ago

very early wip demo:

Brian Jordan's profile picture
Brian Jordan1 year ago

Siiiick I'm curious are there things they can be sped up with multi threaded WASM that might not be candidates for WebGPU parallelization?

Grant Kot's profile picture
Grant Kot1 year ago

my main ideas are adaptive particle resolution to give the surface more detail, and using multiple resolutions of grids like a coarser one to help improve incompressibility. CPU has more flexibility to do stuff like that though it is possible on GPU as well. also have some visual plans to work the GPU.

Ben Stephens's profile picture
Ben Stephens1 year ago

cool! any tips/learnings on multithreading for webassembly?

Grant Kot's profile picture
Grant Kot1 year ago

to prep, i cut down on communication between threads by going with coarser simulation sections. it does get a little unbalanced when the water is pushed along the edges. with single threaded wasm i like to call the simulation step from JS where i can do a lot of custom stuff. seems to be either a lot of overhead or latency though when multithreaded so will need to investigate that further. on iOS, using shared memory will make your stuff prone to out of memory errors.

Grant Kot's profile picture
Grant Kot1 year ago

I'm using Emscripten to compile my C++ to Wasm. I use the taskflow library to do Pthreads based multithreading. Also of interest is the Wasm Workers API, which might give both smaller build sizes and control for optimization.

Jimminy's profile picture
Jimminy1 year ago

@Pancracio9001 wasm

vincent's profile picture
vincent1 year ago

Amazing work. I was just reading about the math behind water sims in an old NVIDIA GPU gems book

Joe's profile picture
Joe1 year ago

crazy how PCs have had multithreading since 2002 yet its still nurfed in many browsers

Related Videos