tracel-ai/burn · error
Unsupported precision for fusion
Error message
Unsupported precision for fusion
What it means
The fusion engine's codegen IR maps Burn DTypes to fusion IR element types. When a tensor carries a quantized dtype (QFloat) whose quantization scheme cannot be lowered to a fusion IR type, this unimplemented! panics. It signals that fused-kernel codegen does not yet support that quantization scheme.
Source
Thrown at crates/burn-cubecl-fusion/src/engine/codegen/ir.rs:1009
match value {
DType::F32 => Self::F32,
DType::Flex32 => Self::Flex32,
DType::F16 => Self::F16,
DType::BF16 => Self::BF16,
DType::I64 => Self::I64,
DType::I32 => Self::I32,
DType::I16 => Self::I16,
DType::I8 => Self::I8,
DType::U64 => Self::U64,
DType::U32 => Self::U32,
DType::U16 => Self::U16,
DType::U8 => Self::U8,
DType::Bool(BoolStore::Native) => Self::U32,
DType::Bool(BoolStore::U8) => Self::U8,
DType::Bool(BoolStore::U32) => Self::U32,
DType::F64 => Self::F64,
DType::QFloat(scheme) => Self::from_quant_scheme(scheme)
.unwrap_or_else(|| unimplemented!("Unsupported precision for fusion")),
}
}
}
impl Display for FuseArg {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
FuseArg::Input(pos, ..) => write!(f, "input({pos})"),
FuseArg::Output(pos, ..) => write!(f, "output({pos})"),
FuseArg::BlockLocal { pos, ty } => write!(f, "local({pos}, {ty:?})"),
FuseArg::MultiBlockLocal(mbp, ..) => write!(f, "{mbp}"),
FuseArg::MultiBlockGlobal(mbp, ..) => write!(f, "global_{mbp}"),
FuseArg::Scalar(pos, ..) => write!(f, "scalar({pos})"),
FuseArg::ScalarShape(pos) => write!(f, "scalar_shape({pos})"),
FuseArg::Literal(val, ..) => write!(f, "literal_{val}"),
FuseArg::InputReshaped { original, .. } => write!(f, "input_reshaped_{original}"),
FuseArg::InputSwapDims { original, .. } => write!(f, "input_swap_dims_{original}"),
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Disable the fusion engine for this workload or run the quantized op outside a fused region so it falls back to the eager CubeCL path
- Use a quantization scheme supported by the fusion engine (e.g. plain per-tensor/per-block INT8) via QuantScheme::setting or q_params configuration
- Check the burn version and upgrade — fusion support for more quant schemes is added over time
- File/track an issue on burn to request fusion codegen for the specific scheme
Example fix
// before let tensor = Tensor::<Backend, 2>::from_data(data, &device).quantize(&qconfig); // fused op panics // after let tensor = Tensor::<Backend, 2>::from_data(data, &device).quantize(&QuantizationStrategy::PerTensorInt8(...)); // supported scheme
Defensive patterns
Strategy: validation
Validate before calling
fn fusion_supports_dtype(dtype: DType) -> bool {
match dtype {
DType::QFloat(scheme) => matches!(scheme, QuantScheme::PerTensor... /* supported schemes only */),
_ => true,
}
} Type guard
fn is_non_quant(t: &Tensor<B, R>) -> bool { !matches!(t.dtype, DType::QFloat(_)) } Try / catch
// unimplemented! panics; cannot be caught as Result in Rust.
// Guard before the fused call:
if fusion_supports_dtype(tensor.dtype) { fused_op(tensor) } else { eager_op(tensor) } Prevention
- Check the quant scheme against fusion-supported schemes before enabling fusion
- Run quantized workloads on the eager path
- Keep burn updated for new fusion quant support
When it happens
Trigger: Calling a fused operation (via burn-cubecl-fusion engine) on a tensor whose dtype is DType::QFloat with a quantization scheme whose From<QuantScheme> conversion returns None, e.g. an exotic packing/block scheme unsupported by the fusion IR.
Common situations: Using quantized models (INT8/FP8/4-bit packing variants) with the fusion engine enabled; enabling fusion after migrating a quantized workload; new quant schemes added to burn-core but not yet supported by fusion codegen.
Related errors
- todo!("Quantization not supported yet")
- ctc_loss_backward: 2 * max_target_len + 1 = {} exceeds the k
- Invalid broadcast shapes: Next grad shape {:?}, Previous gra
- Can't differentiate embedding backward.
- Can't differentiate linear_x_backward.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/e2024bcfe3b937af.
Report an issue: GitHub.