pub fn reshape_and_cache(
gpu: &dyn GpuBackend,
kernel: KernelHandle,
key: DevicePtr,
value: DevicePtr,
k_cache: DevicePtr,
v_cache: DevicePtr,
slot_mapping: DevicePtr,
num_tokens: u32,
num_kv_heads: u32,
head_dim: u32,
block_size: u32,
key_stride: u32,
value_stride: u32,
_cache_stride: u64,
stream: u64,
) -> Result<()>Expand description
2026-09-25: Copy BF16 K and V rows into the paged BF16 cache at slot_mapping (kernel
reshape_and_cache_flash), one block per token. key_stride / value_stride are the row
strides in elements. _cache_stride is not passed to the kernel, which derives the block
stride from block_size.