IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

logical_product

logical_product(var _layout_a: Layout, var layout_b: Layout) -> Layout

Creates a product of two layouts.

This function creates a hierarchical layout by taking the logical product of two layouts. It's a fundamental operation for creating blocked or tiled layouts.

Args:

  • _layout_a (Layout): The first layout.
  • layout_b (Layout): The second layout.

Returns:

Layout: A new layout representing the logical product of the two layouts.

logical_product(var layout_a: Layout, tiler: List[Layout]) -> Layout

Creates a product of a layout with a list of layouts.

This is a variant of logical_product that works with a list of layouts for more complex tiling patterns. It applies the logical_product operation to each element of the layout with the corresponding element in the tiler list.

Example:

from layout import Layout, LayoutList, IntTuple
from layout.layout import logical_product

# Create a product of a layout with a list of layouts
var base = Layout.row_major(6, 8)
var tilers = LayoutList()
tilers.append(Layout(IntTuple(2, 2)))
var result = logical_product(base^, tilers)

Args:

  • layout_a (Layout): The base layout to create products with.
  • tiler (List[Layout]): A list of layouts defining the product patterns.

Returns:

Layout: A new layout representing the logical product with the tiler layouts.