Mojo struct
RuntimeLayout
@register_passable(trivial)
struct RuntimeLayout[layout: Layout, /, *, bitwidth: Int = Int(bitwidthof[AnyTrivialRegType,__mlir_type.!kgen.target]())]
Fields
- shape (
RuntimeTuple[layout.shape, element_bitwidth=bitwidth, unsigned=True]
): - stride (
RuntimeTuple[layout.stride, unsigned=True]
):
Implemented traits
AnyType
,
Stringable
,
UnknownDestructibility
,
Writable
Methods
__init__
__init__() -> Self
__init__(shape: RuntimeTuple[layout.shape, element_bitwidth=bitwidth, unsigned=True], stride: RuntimeTuple[layout.stride, unsigned=True]) -> Self
__call__
__call__(self, idx: Int) -> Int
__call__[: ImmutableOrigin, //, t: IntTuple[$0]](self, idx: RuntimeTuple[t, element_bitwidth=element_bitwidth, unsigned=unsigned]) -> Int
size
size(self) -> Int
bound_check_required
bound_check_required(self) -> Bool
cast
cast[type: DType](self) -> RuntimeLayout[layout, bitwidth=Int(bitwidthof[::DType,__mlir_type.!kgen.target]())]
__str__
__str__(self) -> String
row_major
static row_major[rank: Int, //](shape: IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned]) -> RuntimeLayout[layout, bitwidth=element_bitwidth]
col_major
static col_major[rank: Int, //](shape: IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned]) -> RuntimeLayout[layout, bitwidth=element_bitwidth]
write_to
write_to[W: Writer](self, mut writer: W)
sublayout
sublayout[i: Int](self) -> RuntimeLayout[layout.__getitem__(i), bitwidth=bitwidth]
dim
dim(self, i: Int) -> Int
__len__
static __len__() -> Int
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!