Live data from Hacker News

GPU compute in the browser at the speed of native: WebGPU marching cubes

willusher.io

31–40 of 55 posts

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#31
post #27

but somebody told me a while back on here that WebGPU was outdated? whats the consensus ?

Why would wGPU be outdated if it was in the middle of being supported for browsers?

this is what I want to know but someone said it was not suitable for running GPU powered games on here i will see if i can dig up the thread

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#32
post #27

but somebody told me a while back on here that WebGPU was outdated? whats the consensus ?

WebGPU is most definitely not outdated. It's a unified interface for all things floating point. From the datacenter to the watch on your wrist. However, most folks not deep into the inner workings will ever touch it. What it does do is close the door on the App Store model. Apple already knows this, which is why we have the AVP.

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#33
post #5
post #2

You absolutely cannot implement stream compaction “at the speed of native” as WebGPU is missing the wave/subgroup intrinsics and globally coherent memory necessary to do that efficiently as possible.

You seem knowledgeable, and I’m possibly going back into a GPGPU project after many years out of the game, so: overall do you see a good future for filling these compute-related gaps in the WebGPU API? Really I’m wondering whether wgpu is an okay choice versus raw Vulkan for native GPGPU outside the browser.

Don't know about GPGPU, but can give you a probably correct answer: Compared to "native" APIs you trade features for compatibility. It's always going to lag behind Vulkan/DX/Metal. Are you ok with excluding platforms? Vulkan/Metal/DX. If not, then I'd give wgpu a chance. Wgpu is also higher-level than Vulkan, which is borh a pro and a con.

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#34
post #13

Earlier quoted context omitted.

That's a wgpu-specific extension, not part of the actual WebGPU spec, so you can't use it on the web. https://github.com/gpuweb/gpuweb/blob/main/proposals/subgrou... There is a proposal for supporting subgroups in WebGPU proper but it's still in the draft stage.

I'm aware. It is an implementation of the linked proposal. The `wgpu` implementation linked will make its way into Firefox eventually. Dawn will follow up with a similar one for Chrome. I was linking it to demonstrate there are no technical hurdles and it's only really approval remaining.

Ok, but that's not what "landing" means.

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#36
Ah, so that's how you do it. Having a template for WebGPU projects is a good idea. I'll have to do the same so I don't waste time setting up web graphics projects.

Cool project btw! Adding this to my long list of graphics blogs to read.

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#37
post #18

Earlier quoted context omitted.

Native extensions unusable on Web browsers don't count.

Then nothing involving WebGPU counts since it's not implemented on other browsers than Chromium and not on Linux even in Chromium… WebGPU is brand new, and the paint is still wet. It doesn't make sense to dismiss things that haven't landed in browsers yet as “unusable on the web”.

There’s an advanced setting in Safari to enable it, but I can’t say how well it works. In this instance it doesn’t.

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#38
post #2

You absolutely cannot implement stream compaction “at the speed of native” as WebGPU is missing the wave/subgroup intrinsics and globally coherent memory necessary to do that efficiently as possible.

It's possible you might not need direct access to wave/subgroup ops to implement efficient stream compaction. There's a great old Nvidia blog post on "warp-aggregated atomics"

https://developer.nvidia.com/blog/cuda-pro-tip-optimized-fil...

where they show that their compiler is sometimes able to automatically convert global atomic operations into the warp local versions, and achieve the same performance as manually written intrinsics. I was recently curious if 10 years later these same optimizations had made it into other GPUs and platforms besides cuda, so I put together a simple atomics benchmark in WebGPU.

https://github.com/PWhiddy/webgpu-atomics-benchmark

The results seem to indicate that these optimizations are accessible through webgpu on chrome on both MacOS and Linux (with nvidia gpu). Note that I'm not directly testing stream compaction, just incrementing a single global atomic counter. So that would need to be tested to know for sure if the optimization still holds there. If you see any issues with the benchmark or this reasoning please let me know! I am hoping to solidify my knowledge in this area :)

Re: GPU compute in the browser at the speed of native: WebGPU marching cubes

#40
post #37

Earlier quoted context omitted.

Then nothing involving WebGPU counts since it's not implemented on other browsers than Chromium and not on Linux even in Chromium… WebGPU is brand new, and the paint is still wet. It doesn't make sense to dismiss things that haven't landed in browsers yet as “unusable on the web”.

There’s an advanced setting in Safari to enable it, but I can’t say how well it works. In this instance it doesn’t.

It doesn't work at all. Doesn't even exist in Safari anymore because they ditched the old implementation and are rewriting everything.
Post reply on HN