{"record":{"id":"640eed182b5d963d","repo":"tracel-ai/burn","slug":"not-yet-supported-will-be-used-for-quantization","errorCode":null,"errorMessage":"Not yet supported, will be used for quantization","messagePattern":"Not yet supported, will be used for quantization","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-backend/src/cubecl.rs","lineNumber":46,"sourceCode":"///\n/// Panics if the cubecl type has no direct burn equivalent (e.g. `TF32`).\npub fn elem_type_to_dtype(value: ElemType) -> DType {\n    match value {\n        ElemType::Float(float_kind) => match float_kind {\n            FloatKind::F16 => DType::F16,\n            FloatKind::BF16 => DType::BF16,\n            FloatKind::Flex32 => DType::Flex32,\n            FloatKind::F32 => DType::F32,\n            FloatKind::F64 => DType::F64,\n            FloatKind::TF32 => panic!(\"Not a valid DType for tensors.\"),\n            FloatKind::E2M1\n            | FloatKind::E2M1x2\n            | FloatKind::E2M3\n            | FloatKind::E3M2\n            | FloatKind::E4M3\n            | FloatKind::E5M2\n            | FloatKind::UE8M0 => {\n                unimplemented!(\"Not yet supported, will be used for quantization\")\n            }\n        },\n        ElemType::Int(int_kind) => match int_kind {\n            IntKind::I8 => DType::I8,\n            IntKind::I16 => DType::I16,\n            IntKind::I32 => DType::I32,\n            IntKind::I64 => DType::I64,\n        },\n        ElemType::UInt(uint_kind) => match uint_kind {\n            UIntKind::U8 => DType::U8,\n            UIntKind::U16 => DType::U16,\n            UIntKind::U32 => DType::U32,\n            UIntKind::U64 => DType::U64,\n        },\n        _ => panic!(\"Not a valid DType for tensors.\"),\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-backend/src/cubecl.rs#L28-L64","documentation":"`elem_type_to_dtype` in crates/burn-backend/src/cubecl.rs converts CubeCL element types to Burn `DType`; low-precision float kinds (E2M1x2, E2M3, E3M2, E4M3, E5M2, UE8M0 — FP4/FP6/FP8-style formats) hit `unimplemented!(\"Not yet supported, will be used for quantization\")` because these formats are reserved for future quantization support.","triggerScenarios":"Converting a CubeCL `FloatKind::E2M1x2|E2M3|E3M2|E4M3|E5M2|UE8M0` element type to a Burn dtype — e.g. when a kernel or tensor uses microscaling/FP8 types and the result metadata is mapped back to Burn dtypes via `run`, `reduce_logical`, `reduce_dim_with_indices`, or `init_reduce_output`.","commonSituations":"Enabling FP8/FP4 quantized kernels on CubeCL-backed hardware; upgrading CubeCL where new float kinds appear in tensor metadata while Burn's mapping lacks support.","solutions":["Use a supported float dtype (F32/F16/BF16) for the tensor/kernel output instead of the microscaling float kinds.","Keep quantized data in a supported scale dtype (see ScaleDtype handling) and store quantized values as integer dtypes.","Upgrade Burn to a version where the FP8/FP4 dtype mapping is implemented."],"exampleFix":"// before\nlet dtype = elem_type_to_dtype(ElemType::Float(FloatKind::E4M3)); // panics\n\n// after\nlet dtype = elem_type_to_dtype(ElemType::Float(FloatKind::BF16)); // supported","handlingStrategy":"validation","validationCode":"fn is_supported_float_kind(kind: &FloatKind) -> bool {\n    !matches!(kind, FloatKind::E2M1x2 | FloatKind::E2M3 | FloatKind::E3M2 | FloatKind::E4M3 | FloatKind::E5M2 | FloatKind::UE8M0)\n}","typeGuard":"fn is_microscaling(kind: &FloatKind) -> bool {\n    matches!(kind, FloatKind::E2M1x2 | FloatKind::E2M3 | FloatKind::E3M2 | FloatKind::E4M3 | FloatKind::E5M2 | FloatKind::UE8M0)\n}","tryCatchPattern":null,"preventionTips":["Restrict kernels/outputs to F32/F16/BF16 until FP8/FP4 mapping lands.","Validate dtype conversions in tests when upgrading CubeCL versions.","Keep quantized payloads in int dtypes with supported scale dtypes."],"tags":["rust","dtype","quantization","cubecl","low-precision"],"backgroundTag":"dtype-not-supported","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}