tracel-ai/burn · error
{other:?} doesn't support native packing
Error message
{other:?} doesn't support native packing What it means
On the `QuantStore::PackedNative` arm of `dtype_to_elem_type`, values other than E2M1 that still don't support native packing trigger `{other:?} doesn't support native packing`. This documents that PackedNative storage is only valid for a subset of QuantValues; attempting to use it with an unsupported sub-byte or exotic value panics with the value's debug name embedded.
Source
Thrown at crates/burn-backend/src/cubecl.rs:106
BoolStore::U32 => ElemType::UInt(UIntKind::U32),
},
DType::QFloat(scheme) => match scheme.store {
QuantStore::Native => match scheme.value {
QuantValue::Q8F | QuantValue::Q8S => ElemType::Int(IntKind::I8),
QuantValue::E4M3 => ElemType::Float(FloatKind::E4M3),
QuantValue::E5M2 => ElemType::Float(FloatKind::E5M2),
QuantValue::Q4F
| QuantValue::Q4S
| QuantValue::Q2F
| QuantValue::Q2S
| QuantValue::E2M1 => {
panic!("Can't store native sub-byte values")
}
},
QuantStore::PackedU32(_) => ElemType::UInt(UIntKind::U32),
QuantStore::PackedNative(_) => match scheme.value {
QuantValue::E2M1 => panic!("Can't store native sub-byte values"),
other => panic!("{other:?} doesn't support native packing"),
},
},
}
}
/// Convert a burn [`DType`] into the corresponding cubecl [`ElemType`].
///
/// Handles sub-byte packed quantization configurations that cannot be expressed
/// as a plain [`ElemType`] by emitting a direct `ElemType`.
pub fn dtype_to_storage_type(dtype: DType) -> ElemType {
match dtype {
DType::QFloat(QuantScheme {
store: QuantStore::PackedNative(_),
value: QuantValue::E2M1,
..
}) => ElemType::Float(FloatKind::E2M1x2),
_ => dtype_to_elem_type(dtype),
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Read the embedded `{other:?}` value in the panic to identify the unsupported QuantValue.
- Switch to `QuantStore::PackedU32`, which supports the full sub-byte value set.
- Re-quantize the model with a supported store/value combination if loading legacy checkpoints.
- Validate the scheme (store mode vs value width) at config-load time before it reaches kernel dispatch.
Example fix
// before let scheme = QuantScheme::new(QuantStore::PackedNative(f), QuantValue::Q2S, ...); // after let scheme = QuantScheme::new(QuantStore::PackedU32(f), QuantValue::Q2S, ...);
Defensive patterns
Strategy: validation
Validate before calling
// only allow PackedNative for values known to support it
fn supports_packed_native(v: &burn::tensor::QuantValue) -> bool {
matches!(v, burn::tensor::QuantValue::E4M3 | burn::tensor::QuantValue::E5M2)
} Type guard
fn safe_scheme(store: &burn::tensor::QuantStore, value: &burn::tensor::QuantValue) -> bool {
!matches!(store, burn::tensor::QuantStore::PackedNative(_))
|| supports_packed_native(value)
} Prevention
- Default to PackedU32 for all sub-byte values; use PackedNative only for byte-wide float values.
- Validate schemes at load time and log the offending QuantValue (as the panic embeds).
- Cover store/value combinations in unit tests before kernel dispatch.
When it happens
Trigger: `dtype_to_elem_type` called (via `dtype_to_storage_type`, `fuse_base`, `create_key`, `generate_reduce_autotune_key`, `compute_input_grad`, `with_bounds`) with `QuantStore::PackedNative(_)` and a QuantValue that is neither E2M1 nor accepted by the native packing path (e.g. Q4S/Q2S variants not enabled for native packing).
Common situations: Deserializing a quantization scheme from an old checkpoint format whose PackedNative + value combination is no longer supported; hand-building schemes with mismatched store/value pairs; version upgrades changing which values PackedNative supports.
Related errors
- Can't store native sub-byte values
- Quantization scheme is not valid for dtype {other:?}
- q_matmul inputs are on different backends
- float_storage_as_f32: unsupported dtype {:?}
- Expected quantized dtype, got {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/a33620adc8ecea03.
Report an issue: GitHub.