Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
René Dudfield
@renedudfield@fosstodon.org  ·  activity timestamp 2 months ago

Finally looking into #webgpu. #WebGL is everywhere and “working”… but I guess webgpu is actually happening? Should be enabled on pretty much every current platform by the end of the year.

Was playing around with a visualization of a “large” graph layout algorithm running on the GPU on my phone. Quite impressive and readable code too. It was written two years ago it seems and at the time of writing they say it only worked on chrome with some experimental flags. So, good progress.

  • Copy link
  • Flag this post
  • Block
René Dudfield
@renedudfield@fosstodon.org replied  ·  activity timestamp 2 months ago

Seems there is still no way to have zero copy shared memory in #WebGPU. I feel this is showing its age a bit. Most modern GPU systems are shared memory. There’s no separate video memory. Additionally, direct access from the network or ssd is a thing for a long time now(even before DirectStorage).

So if I’m getting data over a websocket, I need to copy it into the webgpu memory with the CPU. At which point… might as well process it with the CPU. Except you need to copy into wasm too.

  • Copy link
  • Flag this comment
  • Block
René Dudfield
@renedudfield@fosstodon.org replied  ·  activity timestamp 2 months ago

So, WebTransport (still experimental) does support a bring-your-own-buffer API. But that requires server support and is still experimental in browsers.

WebRTC can seemingly send to GPU video or use video codec hardware… but there’s no zero copy API to get a buffer or texture of a video frame in browsers either.

  • Copy link
  • Flag this comment
  • Block
René Dudfield
@renedudfield@fosstodon.org replied  ·  activity timestamp 2 months ago

I wonder how to do protobuf in webgpu/WGSL?I guess it’s one of the things to roll your own. There’s not a massive ecosystem of WGSL things.

I can’t find a good rated book. Maybe I need to dig deeper and find them. Or maybe it really is that simple they are not needed.

There is an experimental way to compile rust functions to be used in webgpu. It would be nice to share code, but I expect it wouldn’t work so well. Portable SIMD? Threading? Uses SPIR-V so doesn’t work in browsers either.

  • Copy link
  • Flag this comment
  • Block
René Dudfield
@renedudfield@fosstodon.org replied  ·  activity timestamp 2 months ago

Oh it seems the naga shader translation library in the wgpu crate supports WGSL out with a status of “ok” which apparently is not as good as a green checkmark. Relying on two different experimental translation layers isn’t for me. Maybe.

I don’t see any culture of testing with WGSL or webgpu stuff yet, and I HATE hack-until-it-works development for complex large pieces of code. So I gotta figure that out. I guess unit/integration testing can be figured out.

  • Copy link
  • Flag this comment
  • Block
René Dudfield
@renedudfield@fosstodon.org replied  ·  activity timestamp 2 months ago

Utterly disappointed that there are two unnecessary allocations and data copies with websockets to webgpu. Maybe if they are small enough the garbage collector and cache can make it not terrible. But my guess is this absolutely destroys performance for data above a few megabytes.

What’s the worst part is that it is just poor API design messing this up. Nothing special.

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1-alpha.8 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login