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).
lt_to_tt
lt_to_tt[dtype: DType, lt_layout: Layout, //, ResultLayout: TensorLayout = Layout[*?, *?]](lt: LayoutTensor[dtype, lt_layout, address_space=lt.address_space, element_layout=lt.element_layout, layout_int_type=lt.layout_int_type, linear_idx_type=lt.linear_idx_type, masked=lt.masked, alignment=lt.alignment]) -> TileTensor[dtype, Layout[ResultLayout._shape_types, ResultLayout._stride_types], lt.origin, address_space=lt.address_space]
Convert a LayoutTensor to a TileTensor.
Static dimensions (known at compile time) are preserved as ComptimeInt. Dynamic dimensions (UNKNOWN_VALUE) become RuntimeInt, filled from the LayoutTensor's runtime layout. The address space is preserved from the source LayoutTensor. Works for any flat rank.
By default the TileTensor layout is derived automatically from the
LayoutTensor's legacy layout. Pass an explicit ResultLayout to
override which dimensions are static vs runtime.
The result's linear_idx_type is the TileTensor default
(int32 for SHARED/CONSTANT or small static cosize, int64
otherwise). This may differ from lt.linear_idx_type -- in
particular, when the parent LayoutTensor has a runtime dimension
in GENERIC space, the parent uses int64 but the converted tile
(with all dims static after tiling) defaults to int32. To force
the result to match lt.linear_idx_type, use lt_to_tt_idx.
Parameters:
- dtype (
DType): Element type of the tensor. - lt_layout (
Layout): The legacy Layout of the LayoutTensor. - ResultLayout (
TensorLayout): The target TileTensor layout type. Defaults toLTToTTLayout[lt_layout].
Args:
- lt (
LayoutTensor[dtype, lt_layout, address_space=lt.address_space, element_layout=lt.element_layout, layout_int_type=lt.layout_int_type, linear_idx_type=lt.linear_idx_type, masked=lt.masked, alignment=lt.alignment]): The LayoutTensor to convert.
Returns:
TileTensor[dtype, Layout[ResultLayout._shape_types, ResultLayout._stride_types], lt.origin, address_space=lt.address_space]: A TileTensor with the same data, equivalent layout, and matching
address space.