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

selective_scan_fwd_gpu[kernel_dtype: DType, DSTATE: Int, output_LT: TensorLayout, x_LT: TensorLayout, out_z_LT: TensorLayout, u_LT: TensorLayout, delta_LT: TensorLayout, A_LT: TensorLayout, B_LT: TensorLayout, C_LT: TensorLayout, D_LT: TensorLayout, z_LT: TensorLayout, delta_bias_LT: TensorLayout](total_batch_dim: Int, batch: Int, dim: Int, seqlen: Int, group_size: Int, delta_softplus: Int8, output: TileTensor[kernel_dtype, output_LT, MutExternalOrigin], x: TileTensor[kernel_dtype, x_LT, MutExternalOrigin], out_z: TileTensor[kernel_dtype, out_z_LT, MutExternalOrigin], u: TileTensor[kernel_dtype, u_LT, MutExternalOrigin], delta: TileTensor[kernel_dtype, delta_LT, MutExternalOrigin], A: TileTensor[kernel_dtype, A_LT, MutExternalOrigin], B: TileTensor[kernel_dtype, B_LT, MutExternalOrigin], C: TileTensor[kernel_dtype, C_LT, MutExternalOrigin], D: TileTensor[kernel_dtype, D_LT, MutExternalOrigin], z: TileTensor[kernel_dtype, z_LT, MutExternalOrigin], delta_bias: TileTensor[kernel_dtype, delta_bias_LT, MutExternalOrigin], output_strides: IndexList[3], x_strides: IndexList[4], out_z_strides: IndexList[3], u_strides: IndexList[3], delta_strides: IndexList[3], A_strides: IndexList[2], B_strides: IndexList[4], C_strides: IndexList[4], D_strides: IndexList[1], z_strides: IndexList[3], delta_bias_strides: IndexList[1])

GPU kernel for selective scan forward pass.

Each thread processes one (batch, dim) pair and iterates through the sequence.