Running GPT-2 on the GPU with WebGL Shaders: A Hacker's Journey
This Hacker News hit details the author's experience implementing GPT-2 using WebGL and shaders on the GPU. The article explores the origins and evolution of general-purpose GPU programming, comparing traditional graphics APIs (like OpenGL) with compute APIs (CUDA and OpenCL). The author cleverly leverages textures and framebuffers as a data bus, using fragment shaders as compute kernels to perform neural network operations like matrix multiplication and GELU activation. While acknowledging limitations in shared memory, texture size, and precision, the article showcases the power and potential of GPU programming and demonstrates innovative use of graphics processing techniques for general-purpose computation. The code is available on Github.