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

Mojo function

dispatch_im2col_matmul_conv2d

def dispatch_im2col_matmul_conv2d[input_type: DType, filter_type: DType, output_type: DType, //, filter_is_fcrs: Bool = False, maybe_epilogue_func: Optional[def[dtype: DType, width: SIMDLength, alignment: Int = Int(1)](Coord[*?], SIMD[dtype, width]) capturing thin -> None] = None, m_tile_byte_budget: Int = Int(268435456)](input: TileTensor[input_type, Engine=input.Engine, address_space=input.address_space, linear_idx_type=input.linear_idx_type], filter: TileTensor[filter_type, Engine=filter.Engine, address_space=filter.address_space, linear_idx_type=filter.linear_idx_type], output: TileTensor[output_type, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type], stride: IndexList[Int(2)], dilation: IndexList[Int(2)], symmetric_padding: IndexList[Int(2)], num_groups: Int, ctx: DeviceContextBase) -> Bool

Try to dispatch a 2-D conv as explicit im2col + generic matmul.

Returns True if the conv was handled; False if the caller should fall back to another implementation (naive Mojo kernel, cuDNN, etc.).

Skips on: non-bf16 dtype, grouped conv, dilation != 1, kernel size 1x1 (the vectorized naive kernel wins on tiny shapes), and K too small for the matmul fast path.

Parameters:

  • ​input_type (DType): Element DType of the input activation tensor (inferred).
  • ​filter_type (DType): Element DType of the filter tensor (inferred).
  • ​output_type (DType): Element DType of the output tensor (inferred).
  • ​filter_is_fcrs (Bool): True if the filter is laid out as [F, C, R, S]; False for [R, S, C, F] (defaults to False).
  • ​maybe_epilogue_func (Optional[def[dtype: DType, width: SIMDLength, alignment: Int = Int(1)](Coord[*?], SIMD[dtype, width]) capturing thin -> None]): Optional SIMD elementwise epilogue applied to each output element in 4D (batch, h, w, channel) coordinates (defaults to None).
  • ​m_tile_byte_budget (Int): Byte budget cap for the im2col [M, K] scratch tile used to chunk the M axis (defaults to _DEFAULT_M_TILE_BYTE_BUDGET).

Args:

Returns:

Bool

Was this page helpful?