{"record":{"id":"809ee2fa191bcb77","repo":"tracel-ai/burn","slug":"other-doesn-t-support-native-packing-809ee2","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-cubecl/src/tensor/quantization.rs","lineNumber":99,"sourceCode":"                    qparams: None,\n                }\n            }\n            QuantStore::PackedNative(packed_dim) => match scheme.value {\n                QuantValue::E2M1 => {\n                    let packed_dim = self.rank() - packed_dim - 1;\n                    let mut shape = self.shape();\n                    shape[packed_dim] = shape[packed_dim].div_ceil(scheme.num_quants());\n\n                    CubeTensor {\n                        client: self.client.clone(),\n                        handle: self.handle.clone(),\n                        meta: Box::new(Metadata::new(shape, self.meta.strides.clone())),\n                        device: self.device.clone(),\n                        dtype: DType::U8,\n                        qparams: None,\n                    }\n                }\n                other => panic!(\"{other:?} doesn't support native packing\"),\n            },\n        };\n\n        Some((values, params))\n    }\n\n    /// Construct a separate tensor for the quantization scales, if present\n    pub fn scales(&self) -> Option<CubeTensor> {\n        self.param_tensor(|qparams| Some(&qparams.scales))\n    }\n\n    /// Construct a separate tensor for the per-tensor scale, for a two-level scheme.\n    pub fn global(&self) -> Option<CubeTensor> {\n        self.param_tensor(|qparams| qparams.global.as_ref())\n    }\n\n    fn param_tensor(\n        &self,","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-cubecl/src/tensor/quantization.rs#L81-L117","documentation":"In `quantized_handles`, when the quantization scheme uses native storage, burn-cubecl matches on the `QuantValue` to pick the storage element type; any value variant that has no native (unpacked) storage mapping falls into `other => panic!(\"{other:?} doesn't support native packing\")`. Note the message is inverted terminology: it means this quant value cannot be stored natively (unpacked) and requires packed u32 storage.","triggerScenarios":"Calling `quantize`/`into_contiguous_quantized`, `launch_matmul`, `dequantize`, or `q_reshape` on a tensor whose scheme is `QuantStore::Native` with a `QuantValue` that has no native store arm (e.g. E2M1 or other sub-byte values not covered by the native match arms).","commonSituations":"Hand-built `QuantScheme` combining `QuantStore::Native` with sub-byte `QuantValue`s; deserializing/constructing quantized models where scheme store mode and value disagree; changing only the store mode from PackedU32 to Native while keeping a 4-bit value.","solutions":["Use `QuantStore::PackedU32(...)` for the sub-byte quant value instead of `QuantStore::Native`.","Use a natively-storable value (Q8F, Q8S, etc.) if you must keep `QuantStore::Native`.","Take the scheme from a library constructor/constant known to be consistent rather than assembling it ad hoc."],"exampleFix":"// before\nlet scheme = QuantScheme::default()\n    .with_value(QuantValue::E2M1)\n    .with_store(QuantStore::Native); // panic: no native storage for E2M1\n\n// after\nlet scheme = QuantScheme::default()\n    .with_value(QuantValue::E2M1)\n    .with_store(QuantStore::PackedU32(PackedParam::Rhs));","handlingStrategy":"validation","validationCode":"if matches!(scheme.store, QuantStore::Native) && !matches!(scheme.value, QuantValue::Q8F | QuantValue::Q8S | QuantValue::E4M3 | QuantValue::E5M2) {\n    panic!(\"QuantValue {:?} cannot use QuantStore::Native; use PackedU32\", scheme.value);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair each sub-byte QuantValue with QuantStore::PackedU32 at scheme construction time","Prefer deriving schemes from constants in the burn quantization module instead of hand-assembling","When changing store mode, audit the QuantValue at the same time","Test round-trip quantize/dequantize with the final scheme before large-scale use"],"tags":["quantization","burn","rust","gpu"],"backgroundTag":"sub-byte-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"}