4 ms·
Hi, I'm a graphics programmer. Sorry for our confusing and pretty awful terminology, it's mostly an accident of history. I don't think we're the only field to h
by Jasper_ 3y ago
Hi, I'm a graphics programmer. Sorry for our confusing and pretty awful terminology, it's mostly an accident of history. I don't think we're the only field to have that problem, though.
> why must it be so complicated to execute some simple instructions on a GPU
Because they're not simple instructions. Here's what your 2 + 2 compiles to on an AMD GPU: https://hlsl.godbolt.org/z/qfz1TjPGa https://hlsl.godbolt.org/z/qfz1TjPGa
In order to fill a super wide machine, we need to give it enough work to fill. That means we need to schedule a large number of jobs, and we those jobs to have a hierarchy. The hierarchy for compute work is:
Dispatch -> Workgroup (aka Thread Group) -> Subgroup (aka Wave, Wavefront, Warp, SIMD Group) -> Thread (aka Wave Lane, Lane, SIMD Lane)
Much like any weird device like a DSP, there's a lot of power here, but you need to program the hardware a certain way, or you'll get screwed. If you want to be immersed in what this looks like at a high level, go read this post for some of the flavor of the problems we deal with: https://tangentvector.wordpress.com/2013/04/12/a-digression-on-divergence/ https://tangentvector.wordpress.com/2013/04/12/a-digression-...
GPU parallelism isn't magic, and a magic compiler can get us close, but not all the way.
- softfalcon 3y agoAs a fellow graphics programmer, this is a perfect answer.
- jackling 3y agoAre you the guy that made the link cell shading video? If so, I really like your stuff! Any advice on how to get into graphics programming?
- Jasper_ 3y agoI am, yes! Thank you! I'm actually been a spec contributor to WebGPU, and can vouch for quite a bit of it, I think it's a pretty great API overall, and I think it strikes a nice balance between the apparent-simplicity-hidden-complexity of OpenGL and something like daunting like Direct3D or Vulkan. A lot of the things I mentioned above don't really come into play for quite some time. You can get quite far with just triangles, vertex shaders, and pixel shaders. So go give it a try, draw some stuff, and then work your way up and down the stack.
- yarg 3y agoAny thoughts on mesh shaders? From what I've seen (as a non-graphics programmer), the paradigm seems closer to what I'm used to. Though I'm guessing that limited hardware support will hamper adoption.
- squeaky-clean 3y agoOh wow lol. I know we've gotten into discussions (probably some debates) on HN before. Never connected your name to that channel. I'm apparently subscribed and have seen 5 of your videos so far. All really fantastic videos. I apparently missed the Mario Galaxy 2 video, so there goes the next hour of my evening.