IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python module

max.nn.state_space

Python wrappers for the state_space Mojo kernel package.

The module layout mirrors max/kernels/src/state_space/. All ops here are registered as graph-compiler builtins, so no custom_extensions plumbing is needed. The legacy Mamba-1 eager wrappers intentionally stay in the Mamba architecture (their sole consumer) to keep max.nn from depending on max.experimental.functional.

Submodules​

Functions​

causal_conv1d_varlen_fwdApplies a slot-indexed varlen causal depthwise conv1d for prefill and decode.
gated_delta_conv1d_fwdApplies the causal conv1d pass, mutating a slot-indexed conv-state pool in place.
gated_delta_recurrence_fwdApplies the gated delta recurrence pass, mutating a slot-indexed state pool in place.
gated_group_rmsnormFuses the gated group-RMSNorm (HF Zamba2RMSNormGated with norm_before_gate=False) into a single dispatch.
kda_decodeRuns the KDA recurrence, mutating state_pool in place.
mamba2_ssd_chunk_scan_varlen_fwdPerforms the Mamba-2 SSD chunked-scan forward for prefill and decode.
mamba2_ssd_chunk_scan_varlen_fwd_inplacePerforms the Mamba-2 SSD chunked-scan forward, writing final states back into the SSM pool in place.
short_conv_ring_commitWrites each sequence's last ring_len rows of x into its slot of ring.
short_conv_ring_fwdReturns x + conv(x) over a ragged batch; reads ring, writes nothing.