TLDR Web Dev · ARTICLES & TUTORIALS

OPTIMIZING A WEBGPU MATMUL KERNEL FOR 1TFLOP+ PERFORMANCE

zanussbaum.substack.com15 min read

Summary from the TLDR Web Dev newsletter

This article discusses the optimization of a WebGPU matrix multiplication kernel that achieved over 1 TFLOPS performance. It explores each stage of the kernel optimization, starting with a naive implementation and progressing through increasing thread count, 2D workgroups, kernel tiling, and loop unrolling. Through these optimizations, the kernel achieved a performance improvement approaching the theoretical peak of the Apple M2 Pro chip.