HN Hall of Fame Weekly email

How to Optimize a CUDA Matmul Kernel for CuBLAS-Like Performance: A Worklog

siboehm.com Books & learning Tutorials & guides Computer science Candidate
Screenshot of siboehm.com captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 2 of them.

submissions
3
submitters
3
observed span
2023–2026
peak thread · 33 comments
130 pts
latest 20+ return · 2024-07-26
103 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

This is a great post for people who are new to optimizing GPU code. It is interesting to see that the author got this far without interchanging the innermost loop over k to the outermost loop, as is done in CUTLASS (https://github.com/NVIDIA/cutlass). As you can see in this blog post the code ends up with a lot of compile-time constants (e.g. BLOCKSIZE, BM, BN, BK, TM, TN) one way to optimize this code further is to use an auto-tuner to…

Another point to consider here is that this project of writing a cuBLAS level GEMM kernel becomes much more challenging if you are doing it with fp16, and are thus competing with the cuBLAS kernels that use tensor cores. The (theoretical) arithmetic throughput of tensor cores is ~8x higher as compared to fp32 math on the Turing arch, I dont know off the top of my head but I think this ratio is the same or greater for Ampere/Hopper tensor…

aaa370·103-point thread·

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
234

reference only — not used in Hall rules or ranking

Total comments
49

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2023-01-05How to Optimize a CUDA Matmul Kernel for CuBLAS-Like Performance: A WorklogFirst breakout · Best threadtodsacerdoti13016
2024-07-26How to optimize a CUDA matmul kernel for cuBLAS-like performance (2022)Latest 20+ point returnmpweiher10333
2026-06-02How to Optimize a CUDA Matmul Kernel for cuBLAS-Like Performance: A WorklogAreibman10