For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo module
tensor_arg_traits
Composable traits for graph-compiler kernel tensor arguments.
A kernel declares each tensor argument by combining small, orthogonal traits with trait composition instead of naming a single monolithic tensor type.
The traits fall into three groups:
- Role traits (
Input,Output,MutableInput) declare how the kernel uses the argument: read-only, write-only destination, or read-write in place. Exactly one role applies to each argument. - The
Fusedmarker declares that the operand participates in prologue or epilogue fusion. - Metadata and access traits describe what the kernel can read off the argument
(
Tensor,DenseTensor) and how it touches individual elements.
Element access is split into marker / capability pairs. A graph-visible marker
(LoadAccess, StoreAccess, TransformAccess) records the access form in the
distilled contract but adds no method; the matching capability (Loadable,
Storable, Transformable) additionally supplies the method the kernel body
calls. A kernel typically binds the marker in its signature and refines to the
capability inside its body, so the same argument type works whether it stays on
the host or is projected to a device.
Traitsβ
- β
DenseTensor: Metadata trait: aTensorbacked by a dense (contiguous) layout. - β
Fused: Marker trait: the operand participates in fusion. - β
Input: Tells the graph compiler this argument is a read-only input. - β
Loadable:LoadAccessrefined with the callableloadmethod. - β
LoadAccess: Marker trait: this tensor supports SIMD loads. - β
MutableInput: Tells the graph compiler this argument is a mutable input. - β
Output: Tells the graph compiler this argument is an output. - β
Storable:StoreAccessrefined with the callablestoremethod. - β
StoreAccess: Marker trait: this tensor supports SIMD stores. - β
Tensor: Metadata trait exposing a tensor's element type, known rank, and shape. - β
TileTensorable: ADenseTensorthat can project to aTileTensorview over its storage. - β
Transformable:TransformAccessrefined with the callabletransformmethod. - β
TransformAccess: Marker trait: this tensor transforms a kernel-computed SIMD value.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!