cs.CLNov 26, 2026

cuDNN Linear Attention: Optimized Mamba-2, GDN, GDP, KDA, and GDN-2 Kernels for NVIDIA GPUs

Authors: Joshua Park, Jingze Cui, Sherry Jiang, Mengyu Guo, Anerudhan Gopal, Vedaanta Agarwalla, Timmy Liu, Yu-Jung Chen, 

Organizations: NVIDIA

Abstract

Linear attention replaces the softmax attention of Transformers with a fixed-size recurrent state, so that the runtime of prefill grows linearly rather than quadratically with the sequence length and the runtime of every decode step is constant in it. Many recent models have adopted a hybrid architecture where some layers swap dense attention for linear attention variants. cuDNN now ships optimized fused kernels for five linear attention variants, Mamba-2, Gated DeltaNet (GDN), Gated DeltaProduct (GDP), Kimi Delta Attention (KDA), and Gated DeltaNet-2 (GDN-2), on Blackwell (SM100, SM103), covering the training forward and backward passes. All of the kernels are open source and ship in cuDNN at https://github.com/NVIDIA/cudnn-frontend. In this paper, we walk through the optimizations that produce speedups over the state-of-the-art baselines. We start the kernel design from a single persistent kernel per pass. Then, in low B⋅HB \cdot H settings, where a grid of one CTA per (batch, head) pair does not cover the SMs, we use intra-card context parallelism (intra-card CP) or a split of the value dimension (split-dvd_v), both introduced by prior work in FlashQLA. We also fuse the other components that surround the linear attention operation in the block, the L2 normalization of the queries and keys and the gate and write-strength transforms, in both the forward and the backward pass. On GB200, the fused kernels for the four delta-rule variants run up to 7.1×7.1\times faster than the reference Triton implementations in the forward pass and up to 8.1×8.1\times in the backward pass, up to 3.2×3.2\times faster than FlashQLA, and up to 6.1×6.1\times faster than FlashKDA. The Mamba-2 kernels run up to 15.9×15.9\times faster than FLA and up to 4.2×4.2\times faster than mamba_ssm in the forward pass, and up to 6.9×6.9\times and 5.5×5.5\times in the backward pass.

Figures & tables

Appendix figures & tables4 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

Feb 19, 2026

2Mamba2Furious: Linear in Complexity, Competitive in Accuracy

Linear attention transformers have become a strong alternative to softmax attention due to their efficiency. However, linear attention tends to be less expressive and results in reduced accuracy compared to softmax attention. To bridge the accuracy gap between softmax attention and linear attention, we manipulate Mamba-2, a very strong linear attention variant. We first simplify Mamba-2 down to its most fundamental and important components, evaluating which specific choices make it most accurate. From this simplified Mamba variant (Mamba-2S), we improve the A-mask and increase the order of the hidden state, resulting in a method, which we call 2Mamba, that is nearly as accurate as softmax attention, yet much more memory efficient for long context lengths. We also investigate elements to Mamba-2 that help surpass softmax attention accuracy. Code is provided for all our experiments.
Nov 4, 2026

Systolic Linear Attention: Co-Designing Tile-Grouped Gated Delta Attention for TPUs

Gated-delta linear attention layers such as Gated DeltaNet (GDN), Kimi Delta Attention (KDA), and GDN-2 are tuned for GPUs, where small tensor-core tiles and fast vector registers make unpacked heads, per-channel decay rescaling, and per-value-head chunk solves cheap. On Google TPUs, which concentrate compute in wide 256×256256 \times 256 systolic matrix units backed by a slower vector unit, direct ports leave half of each matrix tile padded (for dk=128d_k = 128 heads) and repeat decay rescaling and chunk solves across every value head. We present Systolic Linear Attention (SLA), which reshapes gated delta attention around the matrix unit by widening keys to 256256 and sharing both keys and scalar write gates βtβ_t across grouped value heads (R×R\times fewer chunk solves), grouping decay gates into four 6464-channel tiles, and fusing exact FP32 block-doubling chunk inversion and its backward reuse inside one on-chip kernel. With exact chunk inversion on TPU v7x, 22-stage SLA-R4 (four value heads per key head) runs 2.1×2.1\times--2.6×2.6\times faster than open-source MaxText KDA and 1.4×1.4\times--2.4×2.4\times faster than open-source Tokamax KDA, while using 49%49\%--61%61\% less temporary high-bandwidth memory (HBM). Across a 2,0482{,}048-chip TPU v7x pre-training study of sparse Mixture-of-Experts (MoE) models from 6.5B6.5\text{B} to 63.1B63.1\text{B} nominal parameters, SLA trains 11%11\%--24%24\% faster than MaxText KDA (4%4\%--21%21\% faster than Tokamax KDA), matches KDA perplexity on three paired seeds at 12.5B12.5\text{B}, and stays within 3%3\% at other scales.
May 7, 2026

MDN: Parallelizing Stepwise Momentum for Delta Linear Attention

Linear Attention (LA) offers a promising paradigm for scaling large language models (LLMs) to long sequences by avoiding the quadratic complexity of self-attention. Recent LA models such as Mamba2 and GDN interpret linear recurrences as closed-form online stochastic gradient descent (SGD), but naive SGD updates suffer from rapid information decay and suboptimal convergence in optimization. While momentum-based optimizers provide a natural remedy, they pose challenges in simultaneously achieving training efficiency and effectiveness. To address this, we develop a chunkwise parallel algorithm for LA with a stepwise momentum rule by geometrically reordering the update coefficients. Further, from a dynamical systems perspective, we analyze the momentum-based recurrence as a second-order system that introduces complex conjugate eigenvalues. This analysis guides the design of stable gating constraints. The resulting model, Momentum DeltaNet (MDN), leverages Triton kernels to achieve comparable training throughput with competitive linear models such as Mamba2 and KDA. Extensive experiments on the 400M and 1.3B parameter models demonstrate consistent performance improvements over strong baselines, including Transformers, Mamba2 and GDN, across diverse downstream evaluation benchmarks. Code: https://github.com/HuuYuLong/MomentumDeltaNet .