Study note

How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance

Properties

Type
Blogs
Status
已读
Domain
AI / ML
Category
GPU、CUDA 与内核优化
Source
siboehm.com
Vault note
library/articles/ai_ml/How-to-Optimize-a-CUDA-Matmul-Kernel-for-cuBLAS-like-Performance-78ef29b78fd25933.md

Summary

从只达到 cuBLAS 约 1.3% 性能的 naive FP32 kernel 出发,逐步加入 global-memory coalescing、shared-memory cache blocking、1D/2D block tiling、向量化访存、autotuning 和 warp tiling,并结合 roofline、occupancy、寄存器与内存流量解释每一步的收益。

Highlights

每个优化阶段都有代码、性能数字和失败思路,最终在作者的 A6000 测试环境中达到约 93.7% 的 cuBLAS FP32 性能。特别适合作为 xGeMM 与 Salykova 高级 SGEMM 之间的主线文章。

Notes

Simon Boehm 的 CUDA SGEMM 逐步优化工作日志。

Comments

Loading comments...