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

ssd_combined_cpu

def ssd_combined_cpu[kernel_dtype: DType, DSTATE: Int, output_LT: TensorLayout, x_LT: TensorLayout, out_z_LT: TensorLayout, residual_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, gamma_LT: TensorLayout](batch: Int, dim: Int, seqlen: Int, group_size: Int, delta_softplus: Int8, output: TileTensor[kernel_dtype, output_LT, MutAnyOrigin], x: TileTensor[kernel_dtype, x_LT, MutAnyOrigin], out_z: TileTensor[kernel_dtype, out_z_LT, MutAnyOrigin], residual: TileTensor[kernel_dtype, residual_LT, MutAnyOrigin], u: TileTensor[kernel_dtype, u_LT, MutAnyOrigin], delta: TileTensor[kernel_dtype, delta_LT, MutAnyOrigin], A: TileTensor[kernel_dtype, A_LT, MutAnyOrigin], B: TileTensor[kernel_dtype, B_LT, MutAnyOrigin], C: TileTensor[kernel_dtype, C_LT, MutAnyOrigin], D: TileTensor[kernel_dtype, D_LT, MutAnyOrigin], z: TileTensor[kernel_dtype, z_LT, MutAnyOrigin], delta_bias: TileTensor[kernel_dtype, delta_bias_LT, MutAnyOrigin], gamma: TileTensor[kernel_dtype, gamma_LT, MutAnyOrigin], epsilon: Scalar[kernel_dtype], weight_offset: Scalar[kernel_dtype], ctx: Optional[DeviceContext] = None)

CPU kernel for SSD combined operation.

Each worker processes one (batch, dim) pair, runs the selective scan recurrence over the sequence, adds the residual, scales by gamma + weight_offset, and optionally gates the result by silu(z).

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.
  • ​out_z_LT (TensorLayout): Memory layout of the out_z gated output tensor.
  • ​residual_LT (TensorLayout): Memory layout of the residual 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.
  • ​D_LT (TensorLayout): Memory layout of the D skip connection tensor.
  • ​z_LT (TensorLayout): Memory layout of the z gating tensor.
  • ​delta_bias_LT (TensorLayout): Memory layout of the delta_bias tensor.
  • ​gamma_LT (TensorLayout): Memory layout of the gamma normalization scale tensor.

Args:

Was this page helpful?