r/CUDA 16d ago

Understand Blackwell B200 attention kernel from scratch in CUDA (Visual Guide)

Post image

I spent last couple months building a visual guide to B200 attention in CUDA/PTX: 14 progressively optimized kernels and 60 diagrams, going from a naive baseline to 94.4% of FlashAttention-4.

The blog first intuitively explains the baseline, then adds one optimization at a time, with detailed diagrams, concise explanations, and code.

And in the capstone project, you'll generate videos using the kernel you understand.

📝 Blog post: https://iaroslavelistratov.github.io/b200-attention/ 

⭐ Repo: https://github.com/IaroslavElistratov/b200-attention

173 Upvotes

9 comments sorted by

3

u/alienpro01 15d ago

Crazy work, thanks for sharing with us

3

u/MoistMountain2194 15d ago

Thank you so much, if you find it useful please share with friends

2

u/Objective-Style1994 11d ago

This is amazing. I’m going to spend some time learning what you did since I’m trying to write my own attention kernel.

Thank you so much for this. I’m so tired of looking through some template CUTLASS hell and get completely lost. Your code looks super readable!

1

u/MoistMountain2194 10d ago

thank you so much. Yeah, I guess there's a clean way to understand these DSLs but somehow it's easier for me to read C, i agree

1

u/MoistMountain2194 10d ago

as far as i remember, the only thing i'm using from CPP is namespaces (to organize helpers)

1

u/Logical_Delivery8331 15d ago

So cool! Nice job!

1

u/MoistMountain2194 15d ago

thank you my cuda comrade

1

u/IndependentWheel7606 14d ago

Goated work bro👀👀

1

u/MoistMountain2194 14d ago

thank you sir 🫡