[HN Gopher] GPU compute in the browser at the speed of native: W...
       ___________________________________________________________________
        
       GPU compute in the browser at the speed of native: WebGPU marching
       cubes
        
       Author : Twinklebear
       Score  : 75 points
       Date   : 2024-04-23 19:22 UTC (3 hours ago)
        
 (HTM) web link (www.willusher.io)
 (TXT) w3m dump (www.willusher.io)
        
       | cshenton wrote:
       | 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.
        
         | spintin wrote:
         | This is the eternal browserbros. attempt to make us think
         | native has zero value now that we have a completely captured
         | and bloated browser.
         | 
         | The browser is dead, the only thing you can use it for is
         | filling out HTML forms and maybe some light inventory
         | management.
         | 
         | The final app is C+Java where you put the right stuff where it
         | is needed. Just like the browser used to be before Oracle did
         | it's magic on the applet.
        
           | teaearlgraycold wrote:
           | So you're telling me you write Java professionally?
        
             | pdpi wrote:
             | Funnily enough, in a world with WASM, we might actually
             | have Java in the backend and C in the frontend rather than
             | vice versa as it would've been likelier in the 90s.
        
               | spintin wrote:
               | WASM is adding GC... recreating the wheel of the applet
               | but without escaping the problem of javascript glue.
               | 
               | Go is just Java without the WM.
               | 
               | Rust is just a native compiler that creates slow programs
               | and complains a lot.
        
               | worik wrote:
               | > Rust is just a native compiler that creates slow
               | programs and complains a lot.
               | 
               | Good morning Troll
               | 
               | I'll give you "complains a lot."
        
             | spintin wrote:
             | It's pretty much the only professional language you can
             | write.
             | 
             | If you consider respect and responsibility.
        
           | worik wrote:
           | > The browser is dead,
           | 
           | Yea. Nah!
           | 
           | That obit is a bit premature
        
         | dekhn wrote:
         | shhh... you might cause their reality distortion field to fail!
        
           | Archit3ch wrote:
           | The demo doesn't work on mobile Chrome. Worse, the blog post
           | crashes the embedded browser in the HN app. May I suggest
           | just linking to the demo instead?
        
         | masspro wrote:
         | 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.
        
           | jsheard wrote:
           | The answer to that for any given feature is "can untrusted
           | code be trusted with that?". Wave intrinsics are probably
           | doable. Bindless maybe, but expect a bunch of bounds checking
           | overhead. Pointers/BDA, absolutely not.
           | 
           | Native libraries like wgpu can do whatever they want in
           | extensions, safety be damned, but you're stepping outside of
           | the WebGPU spec in that case.
        
             | littlestymaar wrote:
             | What's BDA in that context, please? I can only confidently
             | assume it's not "battle damage assessment".
        
               | jsheard wrote:
               | Buffer Device Address, the Vulkan name for raw pointers
               | in shaders.
        
               | littlestymaar wrote:
               | Thx
        
         | FL33TW00D wrote:
         | Oh look it's subgroup support landing last week:
         | https://github.com/gfx-rs/wgpu/pull/5301
        
           | jsheard wrote:
           | 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.
        
             | FL33TW00D wrote:
             | 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.
        
           | pjmlp wrote:
           | Native extensions unusable on Web browsers don't count.
        
             | littlestymaar wrote:
             | 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".
        
       | lukko wrote:
       | Hmm, why does the hydrogen atom look like a d orbital?
       | 
       | Isn't it 1s1 in the ground state so the probability distribution
       | would look like a sphere.
        
         | plus wrote:
         | I assume it's just mislabeled, it's a high-angular-momentum
         | hydrogenic orbital, chosen because it looks cool and because
         | it's trivial to evaluate (a spherical harmonic times a simple
         | radial term).
        
       | pjmlp wrote:
       | Only if we are talking about the state of native in ca 2015.
        
       | worik wrote:
       | Exciting!
       | 
       | But: "Error: Your browser does not support WebGPU"
       | 
       | Sigh
        
         | jsheard wrote:
         | Chrome and Chromelikes are still the only browsers shipping
         | stable WebGPU, on Firefox it's behind a flag, and on Safari
         | it's only on the TP branch. Then on Chrome it's not available
         | on Linux yet, only Windows and Android, and only on a subset of
         | Android GPUs.
         | 
         | We have a way to go yet.
        
           | capitainenemo wrote:
           | I was trying it out in nightly firefox, and regardless of the
           | webgpu flags I tried, it still errored:
           | Shader '' parsing error: the type of `SCAN_BLOCK_SIZE` is
           | expected to be `u32`, but got `i32`         10 | @id(0)
           | override SCAN_BLOCK_SIZE: u32 = 512;            |
           | ^^^^^^^^^^^^^^^ definition of `SCAN_BLOCK_SIZE`
        
       | spxneo wrote:
       | but somebody told me a while back on here that WebGPU was
       | outdated? whats the consensus ?
        
         | ramon156 wrote:
         | Why would wGPU be outdated if it was in the middle of being
         | supported for browsers?
        
           | spxneo wrote:
           | 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
        
         | chrysoprace wrote:
         | You may be thinking of WebGL. My understanding is that WebGPU
         | is effectively supposed to supersede WebGL.
        
         | adfm wrote:
         | 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.
        
       ___________________________________________________________________
       (page generated 2024-04-23 23:00 UTC)