CUDA matmul optimization walkthrough: naive kernel to 93.7% of cuBLAS
RisingSayak · x · 2026-11-16
Simon Boehm's worklog-style tutorial iteratively optimizes a naive CUDA SGEMM kernel to within 93.7% of cuBLAS performance.
Key milestones:
- Naive: 309 GFLOPs/s, just 1.3% of cuBLAS
- GMEM coalescing alone: jumps to 8.5% — the biggest single win
- SMEM caching: 12.8%
- 1D/2D blocktiling: 36.5% → 68.7%
- Vectorized memory access: 78.4%
- Autotuning + warptiling: 84.8% → 93.7% (21,779 GFLOPs/s vs cuBLAS's 23,249)
The post covers coalescing global memory accesses, shared memory caching, and occupancy optimization, with all kernel code open-sourced on GitHub.
More from Infra
- Starlink Now Protects Greek Trains From Collisions With 5cm-Accurate Tracking of 134 Locomotives — XFreeze · 2026-11-16
- Google donates Agent Substrate, gVisor and OpenRL to CNCF; Agent Substrate 1.0 goes GA on GKE — dl_weekly · 2026-11-16
- Nvidia scandal isn't slowing down: Huang's near-$100B power web under strain — The Verge AI · 2026-11-16
- Volume rules chips: halvarflake says Intel lost by outsourcing demand — TheKanter · 2026-11-16
- Taipei 101 lights up "Taiwan ❤️ Jensen" as tech sector rallies behind Jensen Huang — liu_mingyu · 2026-11-16
- Dev runs 120B models on iOS by streaming MoE weights from flash in llama.cpp — Chance-Resource-4970 · 2026-11-16