---
title: "Accelerating Mamba-2 with High-Performance Forward Pass Kernels in NVIDIA CUDA Tile"
description: "Mamba-2 is a sequence model that combines the efficient training of attention with the constant inference cost of RNNs through a recurrent update computable chunkwise via Tensor Cores. The forward pass is implemented in NVIDIA CUDA Tile (cuTile), a Python DSL for tile-level GPU programming. Three custom kernels are used: chunk_cumsum computes cumulative sums of decay terms, fwd_pass_state computes hidden states at chunk boundaries using a jump formula, and compute_out produces outputs for each chunk. Optimizations include latency hints for DRAM traffic, swap A/B to route fused operands to Tensor Memory, GMEM layout transposition for TMA, and an autotuner for block size and occupancy. Benchmarks on a B300 GPU show the cuTile kernels are 1.14x to 1.82x faster than a Triton reference implementation, with speedups growing with sequence length and state size."
---

# Accelerating Mamba-2 with High-Performance Forward Pass Kernels in NVIDIA CUDA Tile

[NVIDIA](https://yomu.fyi/company/nvidia-developer-blog) · Tanya Lenz · Oct 19, 2026

**Type:** Explainer

## Summary

Mamba-2 is a sequence model that combines the efficient training of attention with the constant inference cost of RNNs through a recurrent update computable chunkwise via Tensor Cores. The forward pass is implemented in NVIDIA CUDA Tile (cuTile), a Python DSL for tile-level GPU programming. Three custom kernels are used: chunk\_cumsum computes cumulative sums of decay terms, fwd\_pass\_state computes hidden states at chunk boundaries using a jump formula, and compute\_out produces outputs for each chunk. Optimizations include latency hints for DRAM traffic, swap A/B to route fused operands to Tensor Memory, GMEM layout transposition for TMA, and an autotuner for block size and occupancy. Benchmarks on a B300 GPU show the cuTile kernels are 1.14x to 1.82x faster than a Triton reference implementation, with speedups growing with sequence length and state size.

## Context

Mamba-2’s recurrent formulation is efficient for sequential inference but training requires faster computation than a for-loop. The chunking approach computes hidden states and outputs using matrix multiplications to leverage Tensor Cores, avoiding materializing the full hidden state tensor.

## Approach / What changed

Three custom kernels written in cuTile: chunk\_cumsum computes cumulative sums of decay terms within each chunk; fwd\_pass\_state computes hidden state at chunk boundaries using a jump formula; compute\_out produces outputs for each chunk using the initial hidden state. Optimizations include latency hints, swap A/B operand routing, GMEM layout transposition, and an autotuner.

## Takeaways

- Mamba-2’s recurrence can be computed chunkwise using matrix multiplications, enabling Tensor Core utilization and avoiding memory-bound parallel scans.
- The forward pass consists of three cuTile kernels: chunk\_cumsum, fwd\_pass\_state, and compute\_out, each handling a specific part of the chunked computation.
- cuTile optimizations (latency hints, swap A/B, GMEM layout, autotuner) yield 1.14x to 1.82x speedup over Triton on a B300 GPU.

## FAQ

### How does Mamba-2 avoid the computational trade-off between attention and RNNs?

Mamba-2 uses a fixed-size hidden state and a recurrent update that can be computed chunkwise using Tensor Cores, combining efficient training with constant inference cost.

### What are the three kernels in the Mamba-2 forward pass?

chunk\_cumsum computes cumulative sums of decay terms, fwd\_pass\_state computes hidden state at chunk boundaries, and compute\_out computes outputs for each chunk.

### What optimizations does cuTile provide for Mamba-2?

Latency hints for DRAM traffic, swap A/B to route fused operand to Tensor Memory, GMEM layout transposition for TMA, and an autotuner to find optimal block size and occupancy.

**Tags:** [cuTile](https://yomu.fyi/topic/cutile), [GPU](https://yomu.fyi/topic/gpu), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Mamba-2](https://yomu.fyi/topic/mamba-2), [Performance](https://yomu.fyi/topic/performance)

- Source: [NVIDIA](https://developer.nvidia.com/blog/accelerating-mamba-2-with-high-performance-forward-pass-kernels-in-nvidia-cuda-tile)
- Source URL: https://developer.nvidia.com/blog/accelerating-mamba-2-with-high-performance-forward-pass-kernels-in-nvidia-cuda-tile
- Ingested by Yomu: 2026-10-19T18:00:17.538Z

[Read original post](https://developer.nvidia.com/blog/accelerating-mamba-2-with-high-performance-forward-pass-kernels-in-nvidia-cuda-tile)
