For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo struct
FP6Format
struct FP6Format
Selects between the two OCP MX FP6 element encodings.
The numeric parameters returned by the accessors below are the entire difference between the two formats; every routine in this module is parameterized on this type rather than duplicated per encoding.
Implemented traitsβ
AnyType,
Copyable,
Deinitable,
Equatable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
E2M3β
comptime E2M3 = FP6Format(Int(0))
E3M2β
comptime E3M2 = FP6Format(Int(1))
Methodsβ
__init__β
def __init__(value: Int) -> Self
__eq__β
mantissa_widthβ
exponent_widthβ
exponent_biasβ
max_exponentβ
def max_exponent(self) -> Int
Returns the unbiased exponent of the largest finite value.
E2M3 tops out at 7.5 == 1.875 * 2^2 and E3M2 at 28 == 1.75 * 2^4,
so this is 2 and 4 respectively. compute_mxfp6_even_scale subtracts
it from the block maximum's exponent to derive the E8M0 scale.
Returns:
max_valueβ
def max_value(self) -> Float32
Returns the largest finite magnitude the encoding represents.
Returns: