Great article! For context: this WebGPU version achieves ~17% of peak theoretical performance of M2. With CUDA (i.e. CuBLAS), you can reach ~75% of peak performance for same matrix config (without tensor core).
Optimizing a WebGPU Matmul Kernel for 1 TFLOP
11–20 of 88 posts
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#12The smoothness of an iPhone map zoom, on any device.
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#13WebGPU will make Web maps even more competitive than they are already. The smoothness of an iPhone map zoom, on any device.
Any device except an iPhone, until Apple finally gets around to shipping WebGPU in Safari. Any year now...
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#14Couple years ago, I wanted about the same thing in HLSL language, for a Direct3D 11.0 compute shader. Here’s the fastest version I managed to make back then: https://github.com/Const-me/Cgml/blob/master/Mistral/Mistral... As you see, I have implemented 32×32 tiling, using thread groups of 32×8 threads, two groupshared buffers to load tiles of the input matrices, and I accumulate numbers into local variables, 32 / 8 =…
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#15Couple years ago, I wanted about the same thing in HLSL language, for a Direct3D 11.0 compute shader. Here’s the fastest version I managed to make back then: https://github.com/Const-me/Cgml/blob/master/Mistral/Mistral... As you see, I have implemented 32×32 tiling, using thread groups of 32×8 threads, two groupshared buffers to load tiles of the input matrices, and I accumulate numbers into local variables, 32 / 8 =…
[deleted]
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#16Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#17Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#18Great article! For context: this WebGPU version achieves ~17% of peak theoretical performance of M2. With CUDA (i.e. CuBLAS), you can reach ~75% of peak performance for same matrix config (without tensor core).
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#19Great article! For context: this WebGPU version achieves ~17% of peak theoretical performance of M2. With CUDA (i.e. CuBLAS), you can reach ~75% of peak performance for same matrix config (without tensor core).
75% can't be the best we can do. What would reach 100% or nearly 100%? Handcoded assembly?
That can lead you to some pretty counter-intuitive optimizations because it's often faster to do more compute work if it means you touch less memory in the process.
Re: Optimizing a WebGPU Matmul Kernel for 1 TFLOP
#20WebGPU will make Web maps even more competitive than they are already. The smoothness of an iPhone map zoom, on any device.
> The smoothness of an iPhone map zoom, on any device. Any device except an iPhone, until Apple finally gets around to shipping WebGPU in Safari. Any year now...