Exponent-only scaling formats #
OCP microscaling uses E8M0 for a scale shared by a block of narrow elements. E8M0 is not a member
of the sign/exponent/fraction family: it has no sign bit, no zero, and no explicit fraction. Codes
0 through 254 denote powers of two from 2^-127 through 2^127; code 255 is NaN.
Keeping this scale type beside, rather than inside, FloatFormat prevents artificial optional
fields and invalid combinations in the ordinary float API.
References:
- Open Compute Project, Microscaling Formats (MX) Specification, Version 1.0, Section 5.4, https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf.
- ONNX, Float stored in 8 bits: E8M0, https://onnx.ai/onnx/technical/float8.html#e8m0.
Exact E8M0 storage word.
The transparent definition has the same compiled representation as BitVec 8, while retaining
the exponent-only format identity for proof-aware type inspection.
Instances For
Construct an E8M0 word from its raw code.
Instances For
Raw code as a natural number.
Instances For
The sole NaN encoding (0xff).
Instances For
Unbiased power-of-two exponent, or none for NaN.
Instances For
Exact positive dyadic scale, or none for NaN.
Instances For
Apply an E8M0 scale to an exact dyadic by adding its power-of-two exponent.
Instances For
Decode and scale one element of a microscaling block.
none records either the E8M0 NaN code or a non-finite element. The operation is exact: scaling by
a power of two changes only the dyadic exponent.
Instances For
Exact mathematical decoding of a microscaling block with one shared E8M0 scale.
This function decodes an already encoded block; it does not choose the shared scale. An empty array succeeds without inspecting the scale. On a nonempty array, a NaN scale or any non-finite element causes decoding to fail.
Instances For
Encode an in-range exponent; return none outside [-127, 127].
Instances For
Encode an exponent after clamping it to the finite E8M0 range.
Instances For
Every successfully decoded E8M0 scale has significand one.
Every successfully decoded E8M0 scale has its sign bit clear.