reshape_and_cache_fp8

Function reshape_and_cache_fp8 

Source
pub fn reshape_and_cache_fp8(
    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,
    k_scale: f32,
    v_scale: f32,
    key_stride: u32,
    value_stride: u32,
    cache_stride: u64,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: Quantize BF16 K and V rows into the paged FP8 cache (kernel reshape_and_cache_flash_fp8): fp8 = sat(bf16 / scale) with the dequant scales k_scale / v_scale. k_cache / v_cache are the pool base pointers, and cache_stride is the stride between cache blocks in elements (normally block_size * num_kv_heads * head_dim).