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

compute_mxfp8_block_scale

def compute_mxfp8_block_scale[scales_dtype: DType](group_max: Float32) -> Tuple[Scalar[scales_dtype], Float32, Bool]

Derives an MXFP8 E8M0 block scale and the reciprocal the data path applies.

Parameters:

  • scales_dtype (DType): E8M0 scale type to emit (float8_e8m0fnu).

Args:

  • group_max (Float32): Largest absolute value in the 32-element scale block.

Returns:

Tuple[Scalar[scales_dtype], Float32, Bool]: (e8m0_scale, data_multiplier, block_is_dead). Multiply the block's data by data_multiplier and store e8m0_scale. When block_is_dead the caller MUST also zero the data: the block has no E4M3 representation, and a non-finite lane would otherwise store inf * 0.0 = NaN.