IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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__​

def __eq__(self, other: Self) -> Bool

Returns:

Bool

mantissa_width​

def mantissa_width(self) -> Int

Returns the mantissa field width in bits.

Returns:

Int

exponent_width​

def exponent_width(self) -> Int

Returns the exponent field width in bits.

Returns:

Int

exponent_bias​

def exponent_bias(self) -> Int

Returns the exponent bias.

Returns:

Int

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:

Int

max_value​

def max_value(self) -> Float32

Returns the largest finite magnitude the encoding represents.

Returns:

Float32