Skip to main content

Mojo struct

SharedMemoryManager

struct SharedMemoryManager[SMBP: SharedMemoryBasePtr]

Fields​

  • ​base_ptr (UnsafePointer[Int8, MutAnyOrigin, address_space=AddressSpace.SHARED]):
  • ​offset (Int):

Implemented traits​

AnyType, ImplicitlyDestructible

comptime members​

Array​

comptime Array[type: TrivialRegisterPassable, size: Int] = SMemArray[type, size]

Parameters​

Tile​

comptime Tile[dtype: DType, layout: Layout] = LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.SHARED, alignment=SMBP.alignment]

Parameters​

TileArray​

comptime TileArray[dtype: DType, layout: Layout, num_tiles: Int] = SMemTileArray[dtype, layout, num_tiles, SMBP.alignment]

Parameters​

Methods​

__init__​

__init__(out self)

Initialize the shared memory manager.

build​

build[dtype: DType, layout: Layout, //, T: AnyStruct[LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.SHARED, alignment=SMBP.alignment]]](mut self) -> T

Allocate a single tile.

Returns:

T: Allocated tile.

build[dtype: DType, layout: Layout, num_tiles: Int, //, T: AnyStruct[SMemTileArray[dtype, layout, num_tiles, SMBP.alignment]]](mut self) -> T

Allocate a tile array.

Returns:

T: Allocated tile array.

build[type: TrivialRegisterPassable, size: Int, //, T: AnyStruct[SMemArray[type, size]]](mut self) -> T

Allocate a regular array.

Returns:

T: Allocated array.