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
Write K/V to paged FP8 cache using slot_mapping.
Kernel: reshape_and_cache_flash_fp8(key, value, k_cache, v_cache, slot_mapping, num_kv_heads, head_dim, block_size, k_scale, v_scale, key_stride, value_stride, cache_stride)
Grid: (num_tokens, 1, 1) Block: (256, 1, 1)
slot_mapping is a device pointer to i64[num_tokens].
BF16 reshape and cache — no quantization, direct BF16 copy.