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
test_matmul_sm90_swapAB_comparison_v2
def test_matmul_sm90_swapAB_comparison_v2[MType: CoordLike, NType: CoordLike, KType: 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>> *?>> *?>>], //, a_type: DType, b_type: DType, c_type: DType, BM: Int, BN: Int, BK: Int, MMA_M: Int, MMA_N: Int, MMA_K: Int, num_pipeline_stages: Int, num_consumer: Int, k_group_size: Int = Int(1), num_k_partitions: Int = Int(1), partitioned_multicast: Bool = False, BM_SWAPAB: Int = BM, BN_SWAPAB: Int = BN, BK_SWAPAB: Int = BK, MMA_M_SWAPAB: Int = MMA_M, MMA_N_SWAPAB: Int = MMA_N, MMA_K_SWAPAB: Int = MMA_K, num_pipeline_stages_swapAB: Int = num_pipeline_stages, num_consumer_swapAB: Int = num_consumer, k_group_size_swapAB: Int = k_group_size, num_k_partitions_swapAB: Int = num_k_partitions, partitioned_multicast_swapAB: Bool = partitioned_multicast, use_vendor_reference: Bool = False, default_epilogue: Bool = False, has_compute_fn: Bool = False](ctx: DeviceContext, m: MType, n: NType, k: KType, compute_fn: ComputeFnType = no_compute_fn)
Compare matmul results between normal execution and swapAB execution.
This version accepts config parameters directly as compile-time values and builds configs internally.
Both compute: C[M,N] = A[M,K] @ B[N,K]^T swapAB internally swaps A/B and transposes C on store, but result should match.
Parameters:
- MType (
CoordLike): The type of the M dimension. - NType (
CoordLike): The type of the N dimension. - KType (
CoordLike): The type of the K dimension. - ComputeFnType (
ElementwiseComputeFn): Type ofcompute_fn(inferred). - a_type (
DType): Data type of matrix A. - b_type (
DType): Data type of matrix B. - c_type (
DType): Data type of output matrix C. - BM (
Int): Block tile M dimension for normal kernel. - BN (
Int): Block tile N dimension for normal kernel. - BK (
Int): Block tile K dimension for normal kernel. - MMA_M (
Int): MMA M dimension for normal kernel. - MMA_N (
Int): MMA N dimension for normal kernel. - MMA_K (
Int): MMA K dimension for normal kernel. - num_pipeline_stages (
Int): Number of pipeline stages for normal kernel. - num_consumer (
Int): Number of consumers for normal kernel. - k_group_size (
Int): K group size for normal kernel. - num_k_partitions (
Int): Number of K partitions for normal kernel. - partitioned_multicast (
Bool): Partitioned multicast for normal kernel. - BM_SWAPAB (
Int): Block tile M dimension for swapAB kernel. - BN_SWAPAB (
Int): Block tile N dimension for swapAB kernel. - BK_SWAPAB (
Int): Block tile K dimension for swapAB kernel. - MMA_M_SWAPAB (
Int): MMA M dimension for swapAB kernel. - MMA_N_SWAPAB (
Int): MMA N dimension for swapAB kernel. - MMA_K_SWAPAB (
Int): MMA K dimension for swapAB kernel. - num_pipeline_stages_swapAB (
Int): Number of pipeline stages for swapAB kernel. - num_consumer_swapAB (
Int): Number of consumers for swapAB kernel. - k_group_size_swapAB (
Int): K group size for swapAB kernel. - num_k_partitions_swapAB (
Int): Number of K partitions for swapAB kernel. - partitioned_multicast_swapAB (
Bool): Partitioned multicast for swapAB kernel. - use_vendor_reference (
Bool): If True, use vendor matmul (cuBLAS) as reference instead of normal kernel. - default_epilogue (
Bool): If True, store the output through an epilogue closure instead of the kernel's own store. - has_compute_fn (
Bool): If True, the kernels storecompute_fn(idx, a @ b); takes precedence overdefault_epilogue.
Args:
- ctx (
DeviceContext): The device context. - m (
MType): The M dimension (can be static or dynamic). - n (
NType): The N dimension (can be static or dynamic). - k (
KType): The K dimension (can be static or dynamic). - compute_fn (
ComputeFnType): Maps each output index and value to the value to store whenhas_compute_fnis set.