cubecl_common/quant/presets.rs
1use crate::quant::scheme::{QuantScheme, QuantStore, QuantValue, ScaleDtype};
2
3impl QuantScheme {
4 /// The NVFP4 format: fp4 (e2m1) values in blocks of 16, with ue4m3 block scales
5 /// normalized by one per-tensor f32 scale.
6 pub fn nvfp4() -> Self {
7 QuantScheme::default()
8 .per_block([16], ScaleDtype::UE4M3)
9 .per_tensor(ScaleDtype::F32)
10 .with_value(QuantValue::E2M1)
11 .with_store(QuantStore::PackedNative(0))
12 }
13}