Mojo trait
MHAOperand
This serves as the trait to support arguments to our MHA kernel.
Implemented traits
AnyType
,
UnknownDestructibility
Aliases
dtype
alias dtype
Methods
block_paged_ptr
block_paged_ptr[tile_size: Int](self: _Self, batch_idx: SIMD[uint32, 1], start_tok_idx: SIMD[uint32, 1], head_idx: SIMD[uint32, 1], head_dim_idx: SIMD[uint32, 1] = 0) -> UnsafePointer[SIMD[get_witness(_Self, nn::mha_operand::MHAOperand, dtype), 1]]
Returns:
cache_length
cache_length(self: _Self, batch_idx: Int) -> Int
Returns the length of the cache for a given batch index.
Returns:
max_context_length
max_context_length(self: _Self) -> SIMD[uint32, 1]
Returns the maximum cache length in a given batch index.
Returns:
row_idx
row_idx(self: _Self, batch_idx: SIMD[uint32, 1], start_tok_idx: SIMD[uint32, 1]) -> SIMD[uint32, 1]
Returns the row idx when viewing the memory as a matrix.
Returns:
col_idx
col_idx(self: _Self, head_idx: SIMD[uint32, 1]) -> SIMD[uint32, 1]
Returns the col idx when viewing the memory as a matrix.
Returns:
create_tma_tile
create_tma_tile[tile_m: Int, tile_n: Int, swizzle_mode: TensorMapSwizzle](self: _Self, ctx: DeviceContext) -> TMATensorTile[get_witness(_Self, nn::mha_operand::MHAOperand, dtype), row_major(tile_m, tile_n)]
Creates a TMA tile for efficient GPU memory transfers.
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!