Expand description
Quantization descriptor types for the Hurray tensor format.
Every quantized tensor carries a quantization descriptor immediately following the tensor descriptor header. The descriptor starts with a 4-byte header (scheme tag, scheme version, flags) followed by a scheme-specific payload.
§Supported schemes
| Scheme tag | Tier | Type |
|---|---|---|
0x01 | 1 | PerTensorAffine |
0x02 | 1 | PerChannelAffine |
0x03 | 1 | PerBlockAffine |
0x04 | 1 | Nf4 |
0x05 | 1 | Mxfp |
§Encoding overview
The canonical encoding path is:
- Call
QuantizationDescriptor::encode_intoto write into a caller-owned buffer (zero-alloc, required by Layer 5 streaming writers). - Or call
QuantizationDescriptor::encode_to_vecfor a convenienceVec<u8>.
The canonical decoding path is:
- Call
QuantizationDescriptor::decodewhich returns the descriptor and the number of bytes consumed, allowing streaming readers to advance their cursor without re-scanning.
See docs/spec/quantization.md for the normative definition.
Re-exports§
pub use mxfp::Mxfp;pub use mxfp::MXFP_CANONICAL_BLOCK_SIZE;pub use mxfp::MXFP_MAX_BLOCK_SIZE;pub use mxfp::MXFP_MIN_BLOCK_SIZE;pub use nf4::Nf4;pub use nf4::NF4_LUT;pub use nf4::NF4_MIN_BLOCK_SIZE;pub use per_block_affine::PerBlockAffine;pub use per_block_affine::PER_BLOCK_AFFINE_MIN_BLOCK_SIZE;pub use per_channel_affine::PerChannelAffine;pub use per_tensor_affine::PerTensorAffine;
Modules§
- mxfp
- MXFP (OCP Microscaling) quantization descriptor (scheme tag
0x05). - nf4
- NF4 (NormalFloat4) quantization descriptor (scheme tag
0x04). - per_
block_ affine - Per-block affine quantization descriptor (scheme tag
0x03). - per_
channel_ affine - Per-channel affine quantization descriptor (scheme tag
0x02). - per_
tensor_ affine - Per-tensor affine quantization descriptor (scheme tag
0x01).
Enums§
- Quantization
Descriptor - A typed quantization descriptor carrying the parameters for one of the supported quantization schemes.
- Quantization
Scheme Tag - The wire scheme tag that identifies which quantization scheme a descriptor uses.
Functions§
- validate_
axis - Validates that
axisis a valid axis index for a tensor of the givenrank. - validate_
buffer_ placement - Validates that all quantization-parameter buffer indices in
descare valid within thebufferstable and do not alias the tensor data buffer.