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

SharedMemoryManager

struct SharedMemoryManager[SMBP: SharedMemoryBasePtr]

Fields​

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

Implemented traits​

AnyType, ImplicitlyDeletable

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__​

def __init__(out self)

Initialize the shared memory manager.

build​

def 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.

def 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.

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

Allocate a regular array.

Returns:

T: Allocated array.