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

quantize_mxfp8_lane_group

def quantize_mxfp8_lane_group[in_dtype: DType, width: Int, //, out_dtype: DType, scales_dtype: DType, *, SF_VECTOR_SIZE: Int = Int(32)](val: SIMD[in_dtype, width]) -> Tuple[SIMD[out_dtype, width], Scalar[scales_dtype]]

Quantizes one thread's slice of an MX block to MXFP8, cooperatively.

The block max spans SF_VECTOR_SIZE // width lanes, so the caller's thread-to-column map must land each MX block on one aligned lane group.

Parameters:

  • in_dtype (DType): Element type of the incoming values (bfloat16).
  • width (Int): Number of elements this thread holds.
  • out_dtype (DType): Quantized element type (float8_e4m3fn).
  • scales_dtype (DType): Block-scale type (float8_e8m0fnu).
  • SF_VECTOR_SIZE (Int): Elements covered by one block scale (32).

Args:

Returns:

Tuple[SIMD[out_dtype, width], Scalar[scales_dtype]]: (quantized, e8m0_scale). Every lane in the group returns the same scale; the caller stores it once, from the group's first lane.