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 struct
ConvIm2colParams
struct ConvIm2colParams
Runtime conv geometry for the online im2col A-operand loader.
SM100/Apple M5 (compute_capability == 5). The fused conv path
(AppleM5MatMul.run_conv) never materialises the [M, K] im2col matrix;
instead each A MMA-fragment is gathered directly from the NHWC input by the
address math below. This struct carries the per-launch conv parameters the
gather needs, and is DevicePassable (all-Int32 POD, device_type = Self)
so it can cross enqueue_function directly.
The (M, K) -> NHWC map mirrors nn/conv/gpu/im2col_matmul_2d.mojo bit-for-bit
so the fused result matches the materialised path:
m -> (batch, h_out, w_out): batch = m // HW_out; spatial = m % HW_out; h_out = spatial // W_out; w_out = spatial % W_out k -> (r, s, c): r = k // (SC); sc = k % (SC); s = sc // C; c = sc % C h_in = h_outstride_h - pad_h + r; w_in = w_outstride_w - pad_w + s OOB (h_in/w_in outside [0,H)/[0,W)) -> 0 in_idx = batch*(HWC) + h_in*(WC) + w_inC + c
Dilation is assumed 1 (enforced at the conv dispatch gate); the map matches the materialiser, which also hardcodes dilation 1.
Fieldsβ
- βH (
Int32): - βW (
Int32): - βC (
Int32): - βR (
Int32): - βS (
Int32): - βH_out (
Int32): - βW_out (
Int32): - βpad_h (
Int32): - βpad_w (
Int32): - βstride_h (
Int32): - βstride_w (
Int32):
Implemented traitsβ
AnyType,
Copyable,
DevicePassable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable
comptime membersβ
device_typeβ
comptime device_type = ConvIm2colParams
Methodsβ
__init__β
def __init__(out self)
Zero-init all fields, for the dense matmul path that ignores conv.
get_type_nameβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!