File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ layout : default
3+ title : SGEMM Optimization
4+ ---
5+
6+ # SGEMM Optimization: From Naive to Tensor Core
7+
8+ 从零手写极致优化的矩阵乘法 — HPC 领域的 "Hello World"。渐进式优化 CUDA SGEMM,展示 GPU 编程核心优化技术。
9+
10+ ## 实测性能 (RTX 3060 Laptop, 1024×1024)
11+
12+ | Kernel | GFLOPS | vs cuBLAS |
13+ | --------| --------| -----------|
14+ | cuBLAS (参考) | 5727 | 100% |
15+ | Tensor Core (WMMA) | 2300 | 40.2% |
16+ | Tiled (32×32) | 753 | 13.1% |
17+ | Double Buffer | 701 | 12.2% |
18+ | Bank Conflict Free | 673 | 11.8% |
19+ | Naive | 604 | 10.6% |
20+
21+ ## 优化路线
22+
23+ | 版本 | 关键技术 |
24+ | ------| ----------|
25+ | Naive | 每线程计算一个输出元素 |
26+ | Tiled | 共享内存分块,数据复用 |
27+ | Bank Conflict Free | 共享内存 padding (+1) |
28+ | Double Buffer | 计算与访存重叠 |
29+ | Tensor Core | WMMA API,FP16→FP32 |
30+
31+ ## 快速开始
32+
33+ ``` bash
34+ # 编译 (根据 GPU 架构调整)
35+ make GPU_ARCH=sm_86
36+
37+ # 运行基准测试
38+ ./build/sgemm_benchmark
39+
40+ # 或直接
41+ make benchmark
42+ ```
43+
44+ ## 技术栈
45+
46+ | 类别 | 技术 |
47+ | ------| ------|
48+ | 语言 | CUDA C++17 |
49+ | 构建 | Makefile |
50+ | 依赖 | cuBLAS, Google Test (可选) |
51+ | GPU | SM 70+ (Volta → Hopper) |
52+
53+ ## 链接
54+
55+ - [ GitHub 仓库] ( https://github.com/LessUp/sgemm-optimization )
56+ - [ README] ( README.md )
You can’t perform that action at this time.
0 commit comments