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,
EnumLike,
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: