Skip to content

vllm.model_executor.layers.mamba.ops.ssd_flashinfer

Mamba2 prefill SSD scan through FlashInfer's fused SSD (Cake backend).

Runs the chunked scan of mamba_chunk_scan_combined_varlen in two kernel launches instead of five, with the packed-varlen cu_seqlens form (the kernels derive their chunk metadata on the device).

Functions:

mamba_chunk_scan_flashinfer(x, dt, A, B, C, D, dt_bias, cu_seqlens, out, ssm_state, state_indices, has_initial_states)

Scan the prefill tokens and write each sequence's final state.

x: (seqlen, nheads, headdim) bf16, may be a strided view dt: (seqlen, nheads) A, dt_bias: (nheads,) fp32 B, C: (seqlen, ngroups, dstate) bf16, may be strided views D: (nheads,) bf16 cu_seqlens: (batch + 1,) int32, starting at 0 out: (seqlen, nheads, headdim) bf16, contiguous; written in place ssm_state: (num_slots, nheads, headdim, dstate) state cache state_indices: (batch,) cache slot of each sequence has_initial_states: (batch,) bool, or None when no sequence has a state