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
dispatch_amd_4wave_conv2d
def dispatch_amd_4wave_conv2d[input_type: DType, filter_type: DType, output_type: DType, filter_is_fcrs: Bool, has_residual: Bool = False, elementwise_lambda_fn: Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None] = None](input: TileTensor[input_type, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type], filter: TileTensor[filter_type, Storage=filter.Storage, address_space=filter.address_space, linear_idx_type=filter.linear_idx_type], output: TileTensor[output_type, Storage=output.Storage, 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: DeviceContext, source_ptr: Optional[Pointer[Scalar[output_type], MutAnyOrigin, _safe=False]] = None, beta: Float32 = 0) -> Bool
Try to dispatch a Conv2D to amd_4wave_conv on MI355X.
Returns True if the convolution was handled; False if the caller should fall back (typically to MIOpen). See module docstring for the full acceptance criteria.
When has_residual=True and source_ptr is set, computes
D = Conv(A, B) + beta * source via the in-kernel fused residual
path (amd_4wave_conv[has_residual=True]). The source pointer is
expected to point to an NHWC-contiguous buffer with the same shape
as output. When has_residual=False (default), the call is
identical to the no-residual variant: no extra ABI overhead beyond
the launch packet's 16 bytes (DCE'd source_ptr / stride / beta).
Parameters:
- βinput_type (
DType):DTypeof the input activation tensor; must befloat8_e4m3fn,bfloat16, orfloat16. - βfilter_type (
DType):DTypeof the filter tensor; must equalinput_type. - βoutput_type (
DType):DTypeof the output tensor;bfloat16for FP8 inputs, otherwise tracksinput_type. - βfilter_is_fcrs (
Bool):Truewhenfilteris in FCRS layout;Falsefor RSCF. Selects the transpose path and the R/S dim indices. - βhas_residual (
Bool):Trueto fuseD = Conv + beta * sourcein-kernel viasource_ptr(defaults toFalse). - βelementwise_lambda_fn (
Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None]): Optional fused 2D-coord epilogue lambda wrapping a 4D NHWCelementwise_simd_epilogue_type;Nonefuses no epilogue (defaults toNone).
Args:
- βinput (
TileTensor[input_type, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type]): Input activationTileTensor, rank-4 NHWC with staticC_in;N,H,Wmay be dynamic. - βfilter (
TileTensor[filter_type, Storage=filter.Storage, address_space=filter.address_space, linear_idx_type=filter.linear_idx_type]): FilterTileTensor, rank-4 FCRS or RSCF perfilter_is_fcrs, with staticR,S,C_in,C_out. - βoutput (
TileTensor[output_type, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Output activationTileTensor, rank-4 NHWC, mutable, with staticC_out. - βstride (
IndexList[Int(2)]): Convolution stride[stride_h, stride_w]; must be(1, 1)or(2, 2)withstride_h == stride_w. - βdilation (
IndexList[Int(2)]): Dilation[dh, dw]; must be(1, 1). - βsymmetric_padding (
IndexList[Int(2)]): Symmetric padding[ph, pw]; must be(0, 0),(1, 1), or(2, 2)withph == pw. - βnum_groups (
Int): Number of convolution groups; must be1. - βctx (
DeviceContext):DeviceContextfor kernel launches and buffer allocation. - βsource_ptr (
Optional[Pointer[Scalar[output_type], MutAnyOrigin, _safe=False]]): Optional pointer to an NHWC-contiguous residual source buffer with the same shape asoutput; read only whenhas_residual=True(defaults toNone). - βbeta (
Float32): Scale factor for the residual term inD = Conv + beta * source(defaults to0.0).
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!