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 function

selective_scan_fwd_gpu_minimal

def selective_scan_fwd_gpu_minimal[kernel_dtype: DType, DSTATE: Int, output_LT: TensorLayout, x_LT: TensorLayout, u_LT: TensorLayout, delta_LT: TensorLayout, A_LT: TensorLayout, B_LT: TensorLayout, C_LT: TensorLayout](total_batch_dim: Int, batch: Int, dim: Int, seqlen: Int, group_size: Int, delta_softplus: Int8, output: TileTensor[kernel_dtype, output_LT, MutUntrackedOrigin], x: TileTensor[kernel_dtype, x_LT, MutUntrackedOrigin], u: TileTensor[kernel_dtype, u_LT, MutUntrackedOrigin], delta: TileTensor[kernel_dtype, delta_LT, MutUntrackedOrigin], A: TileTensor[kernel_dtype, A_LT, MutUntrackedOrigin], B: TileTensor[kernel_dtype, B_LT, MutUntrackedOrigin], C: TileTensor[kernel_dtype, C_LT, MutUntrackedOrigin], output_strides: IndexList[Int(3)], x_strides: IndexList[Int(4)], u_strides: IndexList[Int(3)], delta_strides: IndexList[Int(3)], A_strides: IndexList[Int(2)], B_strides: IndexList[Int(4)], C_strides: IndexList[Int(4)])

Minimal GPU kernel for selective scan forward - no D, z, or delta_bias.

Each thread processes one (batch, dim) pair and iterates through the sequence. Omits the D skip connection, z gating, and delta_bias supported by selective_scan_fwd_gpu.

Parameters:

  • ​kernel_dtype (DType): Element type of the input and output tensors.
  • ​DSTATE (Int): Number of SSM state elements per (batch, dim) pair.
  • ​output_LT (TensorLayout): Memory layout of the output tensor.
  • ​x_LT (TensorLayout): Memory layout of the x checkpoint tensor.
  • ​u_LT (TensorLayout): Memory layout of the u input tensor.
  • ​delta_LT (TensorLayout): Memory layout of the delta time-step tensor.
  • ​A_LT (TensorLayout): Memory layout of the A recurrence matrix.
  • ​B_LT (TensorLayout): Memory layout of the B input projection tensor.
  • ​C_LT (TensorLayout): Memory layout of the C output projection tensor.

Args:

Was this page helpful?