IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

blocked_product

def blocked_product[BlockLayoutType: TensorLayout, TilerLayoutType: TensorLayout, //](block: BlockLayoutType, tiler: TilerLayoutType) -> Layout[TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]])](), TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]])]()]

Creates a blocked layout by combining a block and tiler layout.

This function creates a hierarchical blocked layout where each element of the tiler layout is replaced by a block. This is useful for creating tiled layouts for efficient cache utilization.

Example:

from layout.tile_layout import row_major, blocked_product

# Create a 2x2 block layout
var block = row_major[2, 2]()
# Create a 2x3 tiler (2 rows, 3 cols of blocks)
var tiler = row_major[2, 3]()
# Create blocked layout
var blocked = blocked_product(block, tiler)
# Result: shape ((2,2), (2,3)), stride ((2,12), (1,4))

Parameters:

  • ​BlockLayoutType (TensorLayout): The type of the block layout.
  • ​TilerLayoutType (TensorLayout): The type of the tiler layout.

Args:

  • ​block (BlockLayoutType): The inner layout defining the structure of each tile.
  • ​tiler (TilerLayoutType): The outer layout defining the arrangement of tiles.

Returns:

Layout[TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]])](), TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]])]()]: A new layout representing the blocked structure.

def blocked_product[BlockLayoutType: TensorLayout, TilerLayoutType: TensorLayout, //, *, coalesce_output: Bool](block: BlockLayoutType, tiler: TilerLayoutType) -> Layout[TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] ComptimeInt[Int((mul BlockLayoutType.__shape_types[idx].static_value, TilerLayoutType.__shape_types[idx].static_value))] if identical((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value), (mul BlockLayoutType.__shape_types[idx].static_value, BlockLayoutType.__stride_types[idx].static_value)) else Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]]) if coalesce_output else #kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]])](), TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] BlockLayoutType.__stride_types[idx] if identical((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value), (mul BlockLayoutType.__shape_types[idx].static_value, BlockLayoutType.__stride_types[idx].static_value)) else Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]]) if coalesce_output else #kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]])]()]

Creates a blocked layout with optional output coalescing.

This overload accepts a coalesce_output keyword parameter. When True, contiguous inner/outer dimension pairs are merged into flat dimensions, reducing the layout rank where possible.

Example:

from layout.tile_layout import row_major, blocked_product

var block = row_major[4]()
var tiler = row_major[3]()
# Coalesced: shape (12,), stride (1,) instead of ((4,), (3,))
var coalesced = blocked_product[coalesce_output=True](block, tiler)

Parameters:

  • ​BlockLayoutType (TensorLayout): The type of the block layout.
  • ​TilerLayoutType (TensorLayout): The type of the tiler layout.
  • ​coalesce_output (Bool): When True, merge contiguous inner/outer pairs.

Args:

  • ​block (BlockLayoutType): The inner layout defining the structure of each tile.
  • ​tiler (TilerLayoutType): The outer layout defining the arrangement of tiles.

Returns:

Layout[TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] ComptimeInt[Int((mul BlockLayoutType.__shape_types[idx].static_value, TilerLayoutType.__shape_types[idx].static_value))] if identical((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value), (mul BlockLayoutType.__shape_types[idx].static_value, BlockLayoutType.__stride_types[idx].static_value)) else Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]]) if coalesce_output else #kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__shape_types[idx], TilerLayoutType.__shape_types[idx]])](), TypeList[#kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] BlockLayoutType.__stride_types[idx] if identical((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value), (mul BlockLayoutType.__shape_types[idx].static_value, BlockLayoutType.__stride_types[idx].static_value)) else Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]]) if coalesce_output else #kgen.param_list.tabulate(len(BlockLayoutType.__stride_types), [idx: __mlir_type.index] Coord[BlockLayoutType.__stride_types[idx], ComptimeInt[Int((mul #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))) if #kgen.param_list.reduce(BlockLayoutType.__shape_types, base=True, reducer=[PrevV: Bool, VA: KGENParamList[CoordLike], idx: __mlir_type.index] PrevV and (xor VA[idx].is_tuple, True)) else #kgen.param_list.reduce(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(BlockLayoutType.__shape_types), [idx: __mlir_type.index] BlockLayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)), base=Int(1), reducer=[PrevV: Int, VA: KGENParamList[CoordLike], idx: __mlir_type.index] Int((mul VA[idx].static_value, PrevV))), TilerLayoutType.__stride_types[idx].static_value))]])]()]: A new layout representing the blocked structure, coalesced if requested.

Was this page helpful?