IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo module

managed_tensor_slice

ManagedTensorSlice and the types kernel authors compose against.

A custom kernel's entry-point signature uses these:

  • ManagedTensorSlice β€” view of a tensor argument.
  • IOSpec (and IO) β€” input/output/mutability annotations.
  • StaticTensorSpec β€” runtime + compile-time tensor metadata.
  • Fusion traits (InputFusion, OutputFusion, ...) and their _NoFusion* sentinels.

The decorators that register a kernel (register, register_internal, view_kernel) live next to this file in register.mojo.

comptime values​

DynamicTensor​

comptime DynamicTensor[dtype: DType, rank: Int] = ManagedTensorSlice[IOUnknown, static_spec=_get_unknown_tensor_spec[dtype, rank]()]

Parameters​

  • ​dtype (DType):
  • ​rank (Int):

FusedInput​

comptime FusedInput = IOSpec()

FusedOutput​

comptime FusedOutput = IOSpec()

Input​

comptime Input = IOSpec()

InputTensor​

comptime InputTensor = ManagedTensorSlice[Input, static_spec=_]

InputVariadicTensors​

comptime InputVariadicTensors = VariadicTensors[_, Input, static_specs=_]

IOUnknown​

comptime IOUnknown = IOSpec()

MutableInput​

comptime MutableInput = IOSpec()

Output​

comptime Output = IOSpec()

OutputTensor​

comptime OutputTensor = ManagedTensorSlice[Output, static_spec=_]

OutputVariadicTensors​

comptime OutputVariadicTensors = VariadicTensors[_, Output, static_specs=_]

Structs​

  • ​IO:
  • ​IOSpec: Parameter used to encode whether a particular tensor argument to a DPS kernel is an output, input, or mutable input.
  • ​ManagedTensorSlice: A view of a tensor that does not own the underlying allocated pointer. When the object lifetime ends it does not free the underlying pointer. Conversely, if a ManagedTensorSlice is created, it will not extend the life of the underlying pointer.
  • ​StaticTensorSpec:
  • ​StaticTensorSpecInternal:
  • ​StaticTensorSpecList: A statically indexable list of data that can be assembled into a StaticTensorSpecList on demand. This handles the complexities that arise with heterogenous specs.
  • ​VariadicTensors: A tuple-like container of tensors representing variadic arguments from the graph compiler.

Traits​

Functions​