Skip to main content

Mojo struct

SMemArrayType

@register_passable(trivial) struct SMemArrayType[type: AnyTrivialRegType, size: Int]

Shared memory array of fixed size.

Parameters

Fields

  • ptr (LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, Movable, UnknownDestructibility

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

ptr_type

alias ptr_type = LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]

storage_size

alias storage_size = (size * size_of[type]())

Methods

__init__

__init__(unsafe_ptr: LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]) -> Self

Initialize with shared memory pointer.

Args:

__getitem__

__getitem__[T: Intable](self, index: T) -> LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]

Get a pointer to the element at index.

Args:

  • index (T): Element index.

Returns:

LegacyUnsafePointer: Pointer to element.

len

static len() -> Int

Get array length in bytes.

Returns:

Int: Total size in bytes.

stack_allocation

static stack_allocation[alignment: Int = align_of[type]()]() -> Self

Was this page helpful?