One sparse paged GQA decode kernel written six ways: raw CUDA beats PyTorch eager by 14x on RTX 4060

Daemontatox · reddit · 2026-10-22

The author implemented the same sparse paged GQA decode attention kernel (FP8 KV cache, Top-K 512, page size 16, 256 requests) six ways on an RTX 4060 Laptop (SM89/Ada)—Raw CUDA, Triton, two CuTe DSL variants, Mojo (MAX), and eager PyTorch—and open-sourced all code, charts, and Nsight Compute reports.

Results:

Observation: occupancy alone doesn't predict latency.

Open problem: grouped kernels don't share K/V loads across the 4 query heads in a CTA—the logical K/V request is 1 GiB vs 256 MiB for eager gather—and the author found no low-risk fix, inviting suggestions. Single-run, laptop-GPU, synthetic-data limits are acknowledged.

Original post →

More from Infra

Infra channel →