3 ms·
Still a draft, experimental and not widely used[0], but WebGPU[1] will bring support for actual compute shaders[2] to the web. It's much more low level than th
by kaoD 1y ago
Still a draft, experimental and not widely used[0], but WebGPU[1] will bring support for actual compute shaders[2] to the web.
It's much more low level than these "web monkeys" but I'd say if you really need GPU performance instead of toy examples like squaring a list of numbers, you really need to go low level and understand how GPU threads and work batching works.
[0] https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API
[1] https://en.m.wikipedia.org/wiki/WebGPU https://en.m.wikipedia.org/wiki/WebGPU
[2] https://webgpufundamentals.org/webgpu/lessons/webgpu-compute-shaders.html https://webgpufundamentals.org/webgpu/lessons/webgpu-compute...
- kreetx 1y agoWith "going low level" do you mean leaving the browser all together and shipping a native application? Although I currently don't need anything like this for work then still, the use case I see for GPU use in browser is that it's often times the easiest way to run a program on the user's machine - anything else requires an explicit install.
- kaoD 1y agoI meant to compare abstract-ish stuff (like these monkeys) vs actual low-level within the GPU realm, i.e. thinking in GPU architecture terms. E.g. appropriately choosing a workgroup[0] size, optimizing your buffer layouts for specific access patterns, knowing when and how to read/write from/to VRAM, when to (or if) split into multiple stages, etc. I see space for abstractions over this mess of complexity[1] but there's not a lot of room for simplification. It's almost like thinking in bare-metal terms but the GPU driver is your interface (and the browser's sandbox of course). Although WGSL is not low-level itself (in the sense that you're not writing SPIR-V) that's for a good reason because it needs to be portable and each vendor does their own things so it's often hardware dependent. Going native will still help with performance AFAIK (the aforementioned sandbox has a cost for example) but I agree with you. I love the web as a platform. [0] https://gpuweb.github.io/gpuweb/wgsl/#compute-shader-workgroups https://gpuweb.github.io/gpuweb/wgsl/#compute-shader-workgro... [1] https://developer.chrome.com/docs/capabilities/web-apis/gpu-compute#commands-submission https://developer.chrome.com/docs/capabilities/web-apis/gpu-...