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 struct
SMemTileArray
struct SMemTileArray[dtype: DType, layout: Layout, num_tiles: Int, alignment: Int]
Array of tiles in shared memory.
Parametersβ
- βdtype (
DType): Tile data type. - βlayout (
Layout): Tile layout configuration. - βnum_tiles (
Int): Number of tiles. - βalignment (
Int): Memory alignment.
Fieldsβ
- βptr (
UnsafePointer[Scalar[dtype], MutUntrackedOrigin, address_space=AddressSpace.SHARED]):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
num_elementsβ
comptime num_elements = (layout.size() * num_tiles)
Storageβ
comptime Storage = InlineArray[Scalar[dtype], Int((mul layout.size(), num_tiles))]
storage_sizeβ
comptime storage_size = (Int((mul layout.size(), num_tiles)) * size_of[dtype]())
Tileβ
comptime Tile = LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.SHARED, alignment=alignment]
Methodsβ
__init__β
def __init__(ref[AddressSpace._value] storage: InlineArray[Scalar[dtype], Int((mul layout.size(), num_tiles))]) -> Self
Initialize with Storage.
Args:
- βstorage (
InlineArray[Scalar[dtype], Int((mul layout.size(), num_tiles))]): Storage.
def __init__(unsafe_ptr: UnsafePointer[Scalar[dtype], address_space=AddressSpace.SHARED]) -> Self
Initialize with shared memory pointer.
Args:
- βunsafe_ptr (
UnsafePointer[Scalar[dtype], address_space=AddressSpace.SHARED]): Shared memory pointer.
__getitem__β
def __getitem__[T: Intable](self, index: T) -> Self.Tile
Get tile at index.
Args:
- βindex (
T): Tile index.
Returns:
Self.Tile: Tile at index.
sliceβ
def slice[length: Int](self, start: Int) -> SMemTileArray[dtype, layout, length, alignment]
Returns:
SMemTileArray[dtype, layout, length, alignment]
stack_allocationβ
static def stack_allocation() -> Self
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!