quantize_bf16_to_nvfp4

Function quantize_bf16_to_nvfp4 

Source
pub fn quantize_bf16_to_nvfp4(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    input: DevicePtr,
    packed_out: DevicePtr,
    scale_out: DevicePtr,
    m: u32,
    k: u32,
    stream: u64,
) -> Result<()>
Expand description

Quantize a BF16 [M, K] matrix to NVFP4 (single-level, scale2=1.0): packed E2M1 [M, K/2] + per-group-16 E4M3 scales [M, K/16]. Prepares W4A4 prefill activations. Grid = M rows (one block/row), block 128 (threads stride groups).