bf16_to_fp8

Function bf16_to_fp8 

Source
pub fn bf16_to_fp8(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    src: DevicePtr,
    dst: DevicePtr,
    total_elements: u32,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: Cast total_elements BF16 values to FP8 E4M3, two per thread. total_elements must be even: the kernel reads and writes pairs.

2026-09-29: The cast has no scale, so a value past 448 saturates; debug builds check the source range first (check_e4m3_range).