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 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], MutAnyOrigin, address_space=AddressSpace.SHARED]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

num_elements​

comptime num_elements = (layout.size() * num_tiles)

Storage​

comptime Storage = InlineArray[Scalar[dtype], SMemTileArray[dtype, layout, num_tiles, alignment].num_elements]

storage_size​

comptime storage_size = (SMemTileArray[dtype, layout, num_tiles, alignment].num_elements * size_of[dtype]())

Tile​

comptime Tile = LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.SHARED, alignment=alignment]

Methods​

__init__​

__init__(ref[AddressSpace._value] storage: InlineArray[Scalar[dtype], SMemTileArray[dtype, layout, num_tiles, alignment].num_elements]) -> Self

Initialize with Storage.

Args:

__init__(unsafe_ptr: UnsafePointer[Scalar[dtype], address_space=AddressSpace.SHARED]) -> Self

Initialize with shared memory pointer.

Args:

__getitem__​

__getitem__[T: Intable](self, index: T) -> SMemTileArray[dtype, layout, num_tiles, alignment].Tile

Get tile at index.

Args:

  • ​index (T): Tile index.

Returns:

SMemTileArray[dtype, layout, num_tiles, alignment].Tile: Tile at index.

slice​

slice[length: Int](self, start: Int) -> SMemTileArray[dtype, layout, length, alignment]

Returns:

SMemTileArray[dtype, layout, length, alignment]

stack_allocation​

static stack_allocation() -> Self