Back to Academia is for Ambition — Alex Zhang, MIT, with Alex Zhang & Vibhu Sapra.
Why Does Matrix Multiplication Make a Speed of Light Easy?
Alex Zhang · Shawn Wang · Vibhu Sapra
Alex Zhang says matrix multiplication makes it very easy to compute a speed of light estimate of the fastest GPU kernel, while the same kind of estimate is not easy once the problem is more complex.
The estimate moves with where the data lives at the start. All the data might start on the CPU, or it might start in DRAM on the GPU, and the transfers change the numbers slightly. The estimate assumes perfect overlapping and transfer of data. In a lot of cases it is not clear whether the theoretical number can even be hit, because some bottleneck may be impossible to get around. Kernels people write are often not even close. They are not nearly close enough to the speed of light number to be meaningful at all.
Academia is for Ambition — Alex Zhang, MIT ·
From the transcript
Like there is still an efficiency aspect of all of these things that is super, super important. Yeah. Is there, like, a theoretical right answer that you can just calculate based on physics, and then you just get close to the physics limit? Yes. So, for GPU kernels, you can compute... It's actually not that easy to compute sometimes, like, depending on how complex the problem is.
Like, for matrix multiplication, it's very easy to compute. This, like, speed of light kind of estimate of what the fastest kernel can be. And, like, this is also assuming, like, you know, maybe all of your... All your data starts on the CPU or maybe it starts in DRAM, on the GPU, et cetera. Like this changes these numbers slightly. The transfers and all these things.