Skip to main content
Log in

Mojo struct

KVCacheMHAOperand

@register_passable(trivial) struct KVCacheMHAOperand[cache_t: KVCacheT]

An implementation for mo.opaque KVCacheT arguments to MHA kernels.

We can eventually remove this trait and just add it as a sub-trait in the KVCacheT type, but we need to solve some cyclic dependencies first.

Aliases

  • type = get_vtable_entry(:trait<@kv_cache::@types::@KVCacheT> cache_t, "type"):

Fields

  • cache (cache_t):

Implemented traits

AnyType, MHAOperand, UnknownDestructibility

Methods

__init__

__init__(cache: cache_t) -> Self

block_paged_ptr

block_paged_ptr[tile_size: Int](self, batch_idx: SIMD[uint32, 1], start_tok_idx: SIMD[uint32, 1], head_idx: SIMD[uint32, 1], head_dim_idx: SIMD[uint32, 1] = __init__[__mlir_type.!pop.int_literal](0)) -> UnsafePointer[SIMD[get_vtable_entry(:trait<_kv_cache::_types::_KVCacheT> cache_t, "type"), 1]]

cache_length

cache_length(self, batch_idx: Int) -> Int

max_context_length

max_context_length(self) -> SIMD[uint32, 1]