pub fn conv2d_forward<T: Triton, D: Num, const KH: i32, const KW: i32, const STRIDE_H: i32, const STRIDE_W: i32, const PAD_H: i32, const PAD_W: i32, const G: i32, const BLOCK_OW: i32>(
x_ptr: T::Pointer<D>,
w_ptr: T::Pointer<D>,
y_ptr: T::Pointer<D>,
_B: i32,
C_IN: i32,
C_OUT: i32,
H: i32,
W: i32,
OH: i32,
OW: i32,
)where
T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>,
T::BoolTensor: BitAnd<Output = T::BoolTensor>,
T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,Expand description
2-D convolution forward pass (supports grouped and depthwise conv).
Grid: one CTA per (b, c_out, oh, ow-tile):
pid = ((b * C_OUT + c_out) * OH + oh) * num_ow_tiles + ow_tile
Each CTA computes a BLOCK_OW-wide strip of output columns by iterating over
(C_IN/G) * KH * KW combinations for its assigned group. The weight for
each (c_in_local, kh, kw) is loaded as a [1] tensor and broadcast to
[BLOCK_OW].
G is the number of groups (1 = standard conv, G = C_IN = C_OUT for depthwise).
Weight layout: [C_OUT, C_IN/G, KH, KW].
Zero-padding of PAD_H / PAD_W elements is applied on each spatial side.
OH = (H + 2*PAD_H - KH) / STRIDE_H + 1, OW = (W + 2*PAD_W - KW) / STRIDE_W + 1.