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 module
tile_tensor
TileTensor type for structured memory access with compile-time layout information.
comptime values
ImmTileTensor
comptime ImmTileTensor[dtype: DType, LayoutType: TensorLayout, origin: ImmOrigin, *, Engine: TensorEngine = DefaultEngine, address_space: AddressSpace = .GENERIC, linear_idx_type: DType = _get_index_type[LayoutType](address_space)] = TileTensor[dtype, LayoutType, origin, Engine=Engine, address_space=address_space, linear_idx_type=linear_idx_type]
Names a TileTensor over immutable storage.
TileTensor infers its mut parameter from origin, so a declaration that
must accept only read-only views has to bind and constrain mut itself. This
alias restricts origin to ImmOrigin instead, leaving the mutability spelled
in the type. See MutTileTensor for the mutable counterpart.
Parameters
- dtype (
DType): The data type of tensor elements (e.g.,DType.float32). - LayoutType (
TensorLayout): A type implementingTensorLayoutthat defines the tensor's shape and stride structure. - origin (
ImmOrigin): The immutable origin of the underlying pointer. - Engine (
TensorEngine): A type implementingTensorEnginethat supplies the storage handle and the load/store/offset operations acting on it. Defaults toDefaultEngine[element_width=1]. - address_space (
AddressSpace): Memory address space (GENERIC, SHARED, CONSTANT, etc.). Defaults to GENERIC. - linear_idx_type (
DType): Integer type for memory indexing. Defaults to int32 for shared/constant memory, int64 otherwise.
MutTileTensor
comptime MutTileTensor[dtype: DType, LayoutType: TensorLayout, origin: MutOrigin, *, Engine: TensorEngine = DefaultEngine, address_space: AddressSpace = .GENERIC, linear_idx_type: DType = _get_index_type[LayoutType](address_space)] = TileTensor[dtype, LayoutType, origin, Engine=Engine, address_space=address_space, linear_idx_type=linear_idx_type]
Names a TileTensor over mutable storage.
The mutable counterpart of ImmTileTensor: origin is restricted to
MutOrigin, so the view is writable without the declaration having to bind
TileTensor's inferred mut parameter.
Parameters
- dtype (
DType): The data type of tensor elements (e.g.,DType.float32). - LayoutType (
TensorLayout): A type implementingTensorLayoutthat defines the tensor's shape and stride structure. - origin (
MutOrigin): The mutable origin of the underlying pointer. - Engine (
TensorEngine): A type implementingTensorEnginethat supplies the storage handle and the load/store/offset operations acting on it. Defaults toDefaultEngine[element_width=1]. - address_space (
AddressSpace): Memory address space (GENERIC, SHARED, CONSTANT, etc.). Defaults to GENERIC. - linear_idx_type (
DType): Integer type for memory indexing. Defaults to int32 for shared/constant memory, int64 otherwise.
Structs
-
NullableTileTensor: A TileTensor variant whose pointer may be absent (null). -
TileTensor: A tensor type with trait-based layouts supporting nested and hierarchical indexing.
Traits
-
MutabilityKnown: Exposes whether a value can write the storage it refers to.
Functions
-
flatten_leading: Merge the first two dimensions of a rank-3 TileTensor: (A, B, C) -> (A*B, C). -
stack_allocation: Allocate a TileTensor on the stack with the given layout.