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 trait

TileTensorable

A Tensor backed by a dense layout that can project to a TileTensor view over its storage.

Adds the layout type, preferred alignment, and engine on top of Tensor. Lets the kernel work on a non-fused argument directly as a TileTensor (via to_tile_tensor) instead of going through the fused load/store/transform access. Bind it in the signature when the kernel projects the argument on every target it supports, or refine to it in the body with conforms_to when that varies by target.

The projection's origin is UntrackedOrigin because the backing memory belongs to the graph executor: its liveness guarantee is invisible to the origin system, and the generated argument has no call-site origin it could name instead.

Implemented traits​

AnyType, Tensor

comptime members​

alignment​

comptime alignment

Engine​

comptime Engine = CurrentTensorEngine[_Self.LayoutType]

How the argument's backing memory is referenced.

Per-target instantiation metadata like alignment, not part of the distilled contract: the graph compiler picks it per device label when it instantiates the argument, so a host-pointer argument and a device-pointer argument differ here while sharing one contract.

LayoutType​

comptime LayoutType

mut​

comptime mut

Required methods​

layout​

def layout(self) -> Self.LayoutType

Returns the tensor's layout (shape and strides).

Returns:

_Self.LayoutType: The argument's LayoutType instance.

Provided methods​

to_tile_tensor​

def to_tile_tensor[dtype: DType = _Self.dtype, *, mut: Bool = True if (conforms_to(_Self, Output) | conforms_to(_Self, MutableInput)) else _Self.mut](self) -> TileTensor[dtype, Self.LayoutType, UntrackedOrigin[mut], Engine=Self.Engine]

Projects the argument to a TileTensor view over its storage.

Treat this method as final: conformers implement _to_tile_tensor and must not override to_tile_tensor. The role-based mut default and the dtype and mutability checks live here, so an override would bypass them, and Mojo cannot mark a default method final.

Constraints:

dtype must equal the argument's dtype, and a mutable view needs a mutable argument.

Parameters:

  • ​dtype (DType): The argument's dtype, restated so the projection unifies with another argument's dtype parameter (defaults to the argument's own dtype). It must equal the argument's dtype; it does not convert or reinterpret.
  • ​mut (Bool): Whether to project a mutable view (defaults to the argument's own mut).

Returns:

TileTensor[dtype, _Self.LayoutType, UntrackedOrigin[mut], Engine=_Self.Engine]: A TileTensor view over the argument's storage.

Was this page helpful?