News ·
Accelerating Mamba-2 with High-Performance Forward Pass Kernels in NVIDIA CUDA Tile
NVIDIA and Jane Street implemented and optimized three custom forward-pass kernels for the Mamba-2 state-space model in cuTile, NVIDIA's Python-based GPU kernel DSL.

NVIDIA CUDA Tile (cuTile) is a Python-based DSL and parallel programming model that abstracts thread- and warp-level scheduling behind tile-centric primitives, letting developers write GPU kernels in Python while the compiler automatically targets hardware features like Tensor Cores. Machine learning engineers at Jane Street implemented the Mamba-2 state-space model in cuTile and partnered with NVIDIA to optimize three custom forward-pass kernels: chunk_cumsum, fwd_pass_state, and compute_out.
The chunk_cumsum kernel computes per-token, per-head cumulative sums of the decay term in log-space using ct.cumsum and stores results for reuse by later kernels. The fwd_pass_state kernel uses ct.mma to run Tensor Core matrix-multiply operations that advance the hidden state across sequence chunks using a jump formula with exponential decay. The compute_out kernel fuses the carried-state term, the decayed and causally masked interaction matrix, and the skip connection into one tiled kernel that keeps intermediates in registers and casts to TF32 for Tensor Core execution.
Optimizations include latency hints for DRAM traffic modeling, operand swapping to route fused operands to Tensor Memory, transposed layouts for TMA-friendly memory access, and an autotuner that searches block size and occupancy parameters per input shape. The chunkwise approach addresses Mamba-2's core trade-off: like an RNN it keeps a fixed-size hidden state and constant inference cost, while computing future states directly via matrix multiplication avoids the memory-bound parallel scan and enables Tensor Core use during training and prefill.
For builders, this shows a path to implementing custom sequence-model kernels in pure Python that still hit advanced GPU hardware features, without manually managing thread-level scheduling. cuTile documentation, GitHub repositories, and sample code are available for those who want to try the same approach.

References
- NVIDIA · developer.nvidia.com
Read the full story at NVIDIA ↗Like, save or discuss on Buzz


