Mojo struct
SharedMemoryManager
struct SharedMemoryManager[dtype: DType, BM: Int, BN: Int, BK: Int, depth: Int, num_rowwise_warps: Int, token_gen: Bool]
Fields
- p_smem (
UnsafePointer[Scalar[dtype], address_space=AddressSpace(3)]
): - k_v_smem (
UnsafePointer[Scalar[dtype], address_space=AddressSpace(3)]
):
Implemented traits
AnyType
,
Defaultable
,
UnknownDestructibility
Aliases
__del__is_trivial
alias __del__is_trivial = True
accum_type
alias accum_type = get_accum_type[dtype]()
alignment
alias alignment = align_of[SIMD[dtype, simd_width_of[dtype]()]]()
k_v_smem_size
alias k_v_smem_size = (pad[dtype, depth, depth]() * BK)
p_smem_size
alias p_smem_size = (BM * BN) if token_gen else 0
simd_width
alias simd_width = simd_width_of[dtype]()
Methods
__init__
__init__(out self)
get_kv_ptr
get_kv_ptr[dtype: DType](self) -> UnsafePointer[Scalar[dtype], address_space=AddressSpace(3), alignment=align_of[SIMD[dtype, simd_width_of[dtype]()]]()]
Returns:
get_p_ptr
get_p_ptr(self) -> UnsafePointer[Scalar[dtype], address_space=AddressSpace(3), alignment=align_of[SIMD[dtype, simd_width_of[dtype]()]]()]
Returns:
get_k_iter
get_k_iter(self) -> LayoutTensorIter[dtype, Layout.row_major(BN, BK), MutableAnyOrigin, address_space=AddressSpace(3), circular=True]
Returns:
get_v_iter
get_v_iter(self) -> LayoutTensorIter[dtype, Layout.row_major(BK, BN), MutableAnyOrigin, address_space=AddressSpace(3), circular=True]
Returns:
get_p_iter
get_p_iter(self) -> LayoutTensorIter[dtype, Layout.row_major(BM, BK), MutableAnyOrigin, address_space=AddressSpace(3), circular=True]
Returns:
get_warp_scratch_tensor
get_warp_scratch_tensor(self) -> LayoutTensor[get_accum_type[dtype](), Layout.row_major((num_rowwise_warps * 2), BM), MutableAnyOrigin, address_space=AddressSpace(3)]
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!