# From Zero to 94% of FlashAttention-4: A B200 Attention Kernel Built in 60 Diagrams

Original title: B200 Attention Kernel from Scratch to Near-SOTA in 60 Diagrams

> Hacker News story 49535281 · language: en · submitted 2026-09-02
> Web version: https://zeli.app/story/49535281
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 23 · by [magoghm](<https://news.ycombinator.com/user?id=magoghm>) · 💬 3
[original](<https://iaroslavelistratov.github.io/b200-attention/>) · [HN discussion](<https://news.ycombinator.com/item?id=49535281>)

## Summary

This hands-on guide builds a dense B200 attention kernel from scratch in CUDA and PTX, progressing from a naive baseline to 94.4% of FlashAttention-4 performance on 4K, 8K, and 16K sequence lengths. The author uses 60 diagrams to explain each optimization step, covering Blackwell-specific features like tcgen05 MMA and TMEM, and addresses the softmax bottleneck caused by asymmetric hardware scaling. The final kernel is plugged into a video-generation model as a capstone project. All code is available on GitHub.

## Key quote

> It's one of the hardest kernels out there, running on the latest hardware, so it'll be fun.

---

## Cite

- Page: https://zeli.app/story/49535281
- Date: 2026-09-02
- Source: iaroslavelistratov.github.io (https://iaroslavelistratov.github.io/b200-attention/)
- Hacker News: https://news.ycombinator.com/item?id=49535281

## Other languages

- zh: https://zeli.app/zh/story/49535281 · markdown: https://zeli.app/zh/story/49535281.md
- ja: https://zeli.app/ja/story/49535281 · markdown: https://zeli.app/ja/story/49535281.md
- ko: https://zeli.app/ko/story/49535281 · markdown: https://zeli.app/ko/story/49535281.md
- de: https://zeli.app/de/story/49535281 · markdown: https://zeli.app/de/story/49535281.md
- es: https://zeli.app/es/story/49535281 · markdown: https://zeli.app/es/story/49535281.md
