xGeMM
Writing single-precision matrix multiplication from scratch in CUDA, one optimisation at a time, until it gets close to cuBLAS.
Matrix multiplication sits at the heart of almost every neural network, and NVIDIA’s cuBLAS does it extremely fast. It starts from a naive CUDA kernel and closes the gap step by step: global memory coalescing, shared memory tiling, 1D and 2D thread coarsening with registers, and vectorised memory access. Each chapter explains the hardware idea first, then the code, then the benchmark.
- 0xGeMM: GPU Accelerated Matrix Multiplication (almost) like cuBLAS
Programming general matrix multiplication from scratch in CUDA.
8 min read
- 1xGeMM Chapter 1: Getting Started with CUDA Programming
A simple introduction explaining how to get started with CUDA.
9 min read
- 2
- 3
- 4xGeMM Chapter 4: 1D Thread Coarsening using GPU Registers
Explaining 1D thread coarsening using GPU registers.
5 min read
- 5xGeMM Chapter 5: 2D Thread Coarsening using GPU Registers
Explaining 2D thread coarsening using GPU registers.
4 min read
- 6