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
lt_to_tt
def 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 Scalar, 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.