Skip to content

vllm.model_executor.layers.mamba.mamba_mixer2

Classes:

  • MambaMixer2 –

    Compute ∆, A, B, C, and D the state space parameters and compute

Functions:

MambaMixer2

Bases: MambaBase, PluggableLayer

Compute ∆, A, B, C, and D the state space parameters and compute the contextualized_states. A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective) ∆, B, C are input-dependent (this is a key difference between Mamba and the linear time invariant S4, and is why Mamba is called selective state spaces)

Methods:

  • D_bf16 –

    D cast to bfloat16 for FlashInfer's SSD, refreshed whenever the

D_bf16()

D cast to bfloat16 for FlashInfer's SSD, refreshed whenever the float32 parameter is (re)loaded.

_warmup_ssd_kernels(projected_states)

Run a minimal SSD forward pass to trigger Triton autotuning while GPU memory is still plentiful (before SSM cache allocation).

mamba_v2_sharded_weight_loader(shard_spec, tp_size, tp_rank)

Create a weight loader for mamba v2. This ensures that the projections are correctly sharded so that they can be split into x, B, C. It also ensures that all the groups corresponding to a head shard is placed together with it.