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 function

mxfp8_quantize

def mxfp8_quantize[width: SIMDLength, //, lanes: Int](values: SIMD[.float32, width]) -> Tuple[SIMD[.float8_e4m3fn, width], Float8_e8m0fnu]

Quantizes a group spread over adjacent lanes to E4M3 with a UE8M0 scale.

The scale is the smallest power of two that fits the group's largest magnitude, floored at 1e-4, under 448.

Parameters:

  • โ€‹width (SIMDLength): The values each lane holds.
  • โ€‹lanes (Int): The adjacent lanes that share one scale.

Args:

Returns:

Tuple[SIMD[.float8_e4m3fn, width], Float8_e8m0fnu]: The quantized values and the group's scale.

Was this page helpful?