IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo module

varlen_causal_conv1d

Causal Conv1D with variable length sequence support (vLLM interface).

This module implements causal 1D convolution operations that support variable length sequences using cumulative sequence lengths (cu_seqlens), compatible with the vLLM inference interface.

Key Functions: - causal_conv1d_varlen_fwd: Forward pass for varlen sequences - causal_conv1d_varlen_update: Update function for decode - causal_conv1d_varlen_states: Extract states from varlen sequences

vLLM Interface: - x: (dim, cu_seq_len) for varlen - sequences concatenated left to right - query_start_loc: (batch + 1) int32 - cumulative sequence lengths - cache_indices: (batch) int32 - indices into conv_states - has_initial_state: (batch) bool - whether to use initial state - conv_states: (..., dim, width - 1) - states updated in-place - activation: None or "silu" or "swish" - pad_slot_id: int - for identifying padded entries

comptime values​

PAD_SLOT_ID​

comptime PAD_SLOT_ID = Int32(-1)

Functions​