Skip to main content
Log in

Mojo struct

RuntimeTuple

@register_passable(trivial) struct RuntimeTuple[origin: ImmutableOrigin, //, S: IntTuple[origin] = IntTuple(-1), /, *, element_bitwidth: Int = Int(bitwidthof[AnyTrivialRegType,__mlir_type.!kgen.target]()), unsigned: Bool = False]

Aliases

  • int_type = _get_returned_type[::Int,::Bool]():
  • scalar_length = len[::Sized](flatten[::Origin[{False}]](S)):

Fields

  • value (IndexList[len[::Sized](flatten[::Origin[{False}]](S)), element_bitwidth=element_bitwidth, unsigned=unsigned]):

Implemented traits

AnyType, Sized, Stringable, UnknownDestructibility, Writable

Methods

__init__

__init__() -> Self

Initialize a RuntimeTuple with default values.

For dimensions with known compile-time values in S, uses those values. For unknown dimensions, initializes them to UNKNOWN_VALUE.

@implicit __init__(*values: Int) -> Self

Initialize a RuntimeTuple with the provided values.

Args:

  • *values (Int): Variadic number of integer values to initialize the tuple with.

@implicit __init__[l: Int](values: IndexList[l, element_bitwidth=element_bitwidth, unsigned=unsigned]) -> Self

Initialize a RuntimeTuple from an IndexList.

Args:

  • values (IndexList[l, element_bitwidth=element_bitwidth, unsigned=unsigned]): IndexList to initialize from. Must have same length as the RuntimeTuple.

__getitem__

__getitem__[i: Int](self) -> RuntimeTuple[S.__getitem__(i), element_bitwidth=element_bitwidth, unsigned=unsigned]

__setitem__

__setitem__[i: Int](mut self, val: SIMD[_get_returned_type[::Int,::Bool](), 1])

offset_until

static offset_until[i: Int]() -> Int

get_int

get_int(self) -> SIMD[_get_returned_type[::Int,::Bool](), 1]

__str__

__str__(self) -> String

concat

concat[: ImmutableOrigin, //, R: IntTuple[$0]](self, rhs: RuntimeTuple[R, element_bitwidth=element_bitwidth, unsigned=unsigned]) -> RuntimeTuple[concat[::Origin[{False}],::Origin[{False}]](S, R), element_bitwidth=element_bitwidth, unsigned=unsigned]

flatten

flatten(self) -> RuntimeTuple[flatten[::Origin[{False}]](S), element_bitwidth=element_bitwidth, unsigned=unsigned]

write_to

write_to[W: Writer](self, mut writer: W)

__len__

__len__(self) -> Int

cast

cast[type: DType](self) -> RuntimeTuple[S, element_bitwidth=Int(bitwidthof[::DType,__mlir_type.!kgen.target]()), unsigned=unsigned]