{"record":{"id":"a33620adc8ecea03","repo":"tracel-ai/burn","slug":"other-doesn-t-support-native-packing","errorCode":null,"errorMessage":"{other:?} doesn't support native packing","messagePattern":"(.+?) doesn't support native packing","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-backend/src/cubecl.rs","lineNumber":106,"sourceCode":"            BoolStore::U32 => ElemType::UInt(UIntKind::U32),\n        },\n        DType::QFloat(scheme) => match scheme.store {\n            QuantStore::Native => match scheme.value {\n                QuantValue::Q8F | QuantValue::Q8S => ElemType::Int(IntKind::I8),\n                QuantValue::E4M3 => ElemType::Float(FloatKind::E4M3),\n                QuantValue::E5M2 => ElemType::Float(FloatKind::E5M2),\n                QuantValue::Q4F\n                | QuantValue::Q4S\n                | QuantValue::Q2F\n                | QuantValue::Q2S\n                | QuantValue::E2M1 => {\n                    panic!(\"Can't store native sub-byte values\")\n                }\n            },\n            QuantStore::PackedU32(_) => ElemType::UInt(UIntKind::U32),\n            QuantStore::PackedNative(_) => match scheme.value {\n                QuantValue::E2M1 => panic!(\"Can't store native sub-byte values\"),\n                other => panic!(\"{other:?} doesn't support native packing\"),\n            },\n        },\n    }\n}\n\n/// Convert a burn [`DType`] into the corresponding cubecl [`ElemType`].\n///\n/// Handles sub-byte packed quantization configurations that cannot be expressed\n/// as a plain [`ElemType`] by emitting a direct `ElemType`.\npub fn dtype_to_storage_type(dtype: DType) -> ElemType {\n    match dtype {\n        DType::QFloat(QuantScheme {\n            store: QuantStore::PackedNative(_),\n            value: QuantValue::E2M1,\n            ..\n        }) => ElemType::Float(FloatKind::E2M1x2),\n        _ => dtype_to_elem_type(dtype),\n    }","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-backend/src/cubecl.rs#L88-L124","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","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."],"exampleFix":"// before\nlet scheme = QuantScheme::new(QuantStore::PackedNative(f), QuantValue::Q2S, ...);\n\n// after\nlet scheme = QuantScheme::new(QuantStore::PackedU32(f), QuantValue::Q2S, ...);","handlingStrategy":"validation","validationCode":"// only allow PackedNative for values known to support it\nfn supports_packed_native(v: &burn::tensor::QuantValue) -> bool {\n    matches!(v, burn::tensor::QuantValue::E4M3 | burn::tensor::QuantValue::E5M2)\n}","typeGuard":"fn safe_scheme(store: &burn::tensor::QuantStore, value: &burn::tensor::QuantValue) -> bool {\n    !matches!(store, burn::tensor::QuantStore::PackedNative(_))\n        || supports_packed_native(value)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["quantization","cubecl","packed-storage","panic","burn"],"backgroundTag":"unsupported-quantization-storage","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"}