reshape_and_cache_fp8k_turbo3v

Function reshape_and_cache_fp8k_turbo3v 

Source
pub fn reshape_and_cache_fp8k_turbo3v(
    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,
    k_scale: f32,
    k_block_stride_bytes: u64,
    v_block_stride_bytes: u64,
    v_data_section_bytes: u64,
    stream: u64,
) -> Result<()>
Expand description

Write K/V to paged Fp8K + Turbo3V (TurboQuant+ asym) cache.

K is written as FP8 E4M3 (per-tensor k_scale, NHD contiguous), V as 3-bit Lloyd-Max + FP8 per-group scale with matched-norm correction. K and V pools have separate strides (K 1 b/elem; V ~0.5 b/elem + scale).

Kernel: reshape_and_cache_flash_fp8k_turbo3v(key, value, k_cache, v_cache, slot_mapping, num_kv_heads, head_dim, block_size, key_stride, value_stride, k_scale, k_block_stride_bytes, v_block_stride_bytes, v_data_section_bytes) Grid: (num_tokens, 1, 1) Block: (256, 1, 1)