Study note

Making Softmax Fast

Properties

Type
Blogs
Status
待读
Domain
AI / ML
Category
GPU、CUDA 与内核优化
Source
heyyanshuman.com
Vault note
library/articles/ai_ml/Making-Softmax-Fast-edd252d7afe3e4f3.md

Summary

一篇以 CUDA Softmax kernel 为主线的性能优化实录。文章先解释数值稳定的 Softmax,再从“每个线程处理一行”的三遍扫描实现出发,通过在线更新最大值与指数和减少全局内存访问,最后演进到“每个 warp 处理一行”的并行实现。

Highlights

把算法公式、内存流量与 GPU 执行模型联系起来,具体展示合并访存、warp 内归约和减少数据遍历如何提升 kernel 性能;适合作为从正确 CUDA kernel 走向高性能 kernel 的小型案例。

Comments

Loading comments...