Skip to main content

Mojo struct

SMemTileArrayType

@register_passable(trivial) struct SMemTileArrayType[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 (LegacyUnsafePointer[Scalar[dtype], address_space=AddressSpace.SHARED]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable

comptime members

__copyinit__is_trivial

comptime __copyinit__is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__moveinit__is_trivial

comptime __moveinit__is_trivial = True

num_elements

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

storage_size

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

StorageType

comptime StorageType = InlineArray[Scalar[dtype], SMemTileArrayType[dtype, layout, num_tiles, alignment].num_elements]

Tile

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

Methods

__init__

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

Initialize with StorageType.

Args:

__init__[mut: Bool, //, origin: Origin[mut=mut]](unsafe_ptr: LegacyUnsafePointer[Scalar[dtype], address_space=AddressSpace.SHARED, origin=origin]) -> Self

Initialize with shared memory pointer.

Args:

__getitem__

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

Get tile at index.

Args:

  • index (T): Tile index.

Returns:

SMemTileArrayType: Tile at index.

slice

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

Returns:

SMemTileArrayType

stack_allocation

static stack_allocation() -> Self

Was this page helpful?