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_amd_4wave_conv2d
def dispatch_amd_4wave_conv2d[EpilogueFnType: ElementwiseEpilogueFn = inflated$def[comptime[dtype: DType, width: SIMDLength, *, alignment: Int] #kgen.func.symbol<@linalg::@utils::@"_no_epilogue_body[::DType,::SIMDLength,::SIMD[DType.int, 1],KGENParamList[::Intable & ::Defaultable & ::RegisterPassable & ::TrivialRegisterPassable & ::Writable & ::AnyType & ::Copyable & ::ImplicitlyCopyable & ::Deinitable & ::Movable & ::CoordLike],::TypeList[::Intable & ::Defaultable & ::RegisterPassable & ::TrivialRegisterPassable & ::Writable & ::AnyType & ::Copyable & ::ImplicitlyCopyable & ::Deinitable & ::Movable & ::CoordLike, $3]](::Coord[$3, $4],::SIMD[$0, $1])"<:!lit.struct<@std::@builtin::@dtype::@DType> dtype, :!lit.struct<@std::@builtin::@simd_length::@SIMDLength> width, :!lit.struct<@std::@simd::@SIMD<:!lit.struct<@std::@builtin::@dtype::@DType> {:dtype index}, :!lit.struct<@std::@builtin::@simd_length::@SIMDLength> {1}>> alignment, :param_list<trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>> *?, :!lit.struct<@std::@builtin::@variadics::@TypeList<:meta<!lit.trait<@std::@traits::@anytype::@AnyType>> trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>, :param_list<trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>> *?>> *?>>], ComputeFnType: ElementwiseComputeFn = inflated$def[comptime[dtype: DType, width: SIMDLength, *, alignment: Int] #kgen.func.symbol<@linalg::@utils::@"identity_compute_fn[::DType,::SIMDLength,::SIMD[DType.int, 1],KGENParamList[::Intable & ::Defaultable & ::RegisterPassable & ::TrivialRegisterPassable & ::Writable & ::AnyType & ::Copyable & ::ImplicitlyCopyable & ::Deinitable & ::Movable & ::CoordLike],::TypeList[::Intable & ::Defaultable & ::RegisterPassable & ::TrivialRegisterPassable & ::Writable & ::AnyType & ::Copyable & ::ImplicitlyCopyable & ::Deinitable & ::Movable & ::CoordLike, $3]](::Coord[$3, $4],::SIMD[$0, $1])"<:!lit.struct<@std::@builtin::@dtype::@DType> dtype, :!lit.struct<@std::@builtin::@simd_length::@SIMDLength> width, :!lit.struct<@std::@simd::@SIMD<:!lit.struct<@std::@builtin::@dtype::@DType> {:dtype index}, :!lit.struct<@std::@builtin::@simd_length::@SIMDLength> {1}>> alignment, :param_list<trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>> *?, :!lit.struct<@std::@builtin::@variadics::@TypeList<:meta<!lit.trait<@std::@traits::@anytype::@AnyType>> trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>, :param_list<trait<@std::@builtin::@int::@Intable, @std::@builtin::@value::@Defaultable, @std::@builtin::@value::@RegisterPassable, @std::@builtin::@value::@TrivialRegisterPassable, @std::@format::@__init__::@Writable, @std::@traits::@anytype::@AnyType, @std::@traits::@copyable::@Copyable, @std::@traits::@copyable::@ImplicitlyCopyable, @std::@traits::@deinitable::@Deinitable, @std::@traits::@movable::@Movable, @std::@utils::@coord::@CoordLike>> *?>> *?>>], //, input_type: DType, filter_type: DType, output_type: DType, filter_is_fcrs: Bool, has_residual: Bool = False, has_epilogue_fn: Bool = False, has_compute_fn: Bool = False](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: Coord[Int, Int], dilation: Coord[Int, Int], symmetric_padding: Coord[Int, Int], num_groups: Int, ctx: DeviceContext, source_ptr: Optional[Pointer[Scalar[output_type], MutAnyOrigin]] = None, beta: Float32 = 0, epilogue_fn: EpilogueFnType = no_epilogue_fn, compute_fn: ComputeFnType = no_compute_fn) -> 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:
- EpilogueFnType (
ElementwiseEpilogueFn): Type ofepilogue_fn. - ComputeFnType (
ElementwiseComputeFn): Type ofcompute_fn. - 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). - has_epilogue_fn (
Bool):Trueto store each output chunk throughepilogue_fninstead of writingoutput(defaults toFalse). - has_compute_fn (
Bool):Trueto storecompute_fnof each output chunk, applied before the residual add (defaults toFalse).
Args:
- input (
TileTensor[input_type, Engine=input.Engine, 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, Engine=filter.Engine, 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, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Output activationTileTensor, rank-4 NHWC, mutable, with staticC_out. - stride (
Coord[Int, Int]): Convolution stride[stride_h, stride_w]; must be(1, 1)or(2, 2)withstride_h == stride_w. - dilation (
Coord[Int, Int]): Dilation[dh, dw]; must be(1, 1). - symmetric_padding (
Coord[Int, Int]): 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]]): 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). - epilogue_fn (
EpilogueFnType): Stores each output chunk at a 2D coordinate(m, n), wherem = b*H_out*W_out + h*W_out + wandnis the output channel. Used whenhas_epilogue_fnis set. - compute_fn (
ComputeFnType): Transforms each output chunk at the same 2D coordinate, before the residual add. Used whenhas_compute_fnis set.
Returns: