内核优化的常见步骤
- 分析 Kernel 的执行时间
- 统计、查看各个 Kernel 的执行时间
- 定位性能瓶颈,确定需要优化的 Kernel
- 检查 GPU 的利用率等信息
- 例如检查是否占用过多的寄存器
- (更细粒度)确定 Kernel 的性能瓶颈
- 优化 Kernel 性能
- 通过各种技术手段(软硬件、调度、内存优化)优化 Kernel
PyTorch 内置
torch.profiler
TensorBoard
- Holistic Trace Analysis
NVIDIA Nsight 工具
- Nsight System
- Nsight Compute
Triton
- Proton