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
mxfp4_quantize
def mxfp4_quantize[dtype: DType, width: SIMDLength, //, lanes: Int](values: SIMD[dtype, width]) -> Tuple[SIMD[.uint32, (SIMD(width) // Int(8))], Float8_e8m0fnu]
Quantizes a group spread over adjacent lanes to E2M1 with a UE8M0 scale.
The scale is the smallest power of two that brings the group's largest magnitude, floored at 6 * 2^-126, to at most 6.
Parameters:
- βdtype (
DType): The values' type, FP32 or BF16. - βwidth (
SIMDLength): The values each lane holds, a multiple of 8. - βlanes (
Int): The adjacent lanes that share one scale.
Args:
- βvalues (
SIMD[dtype, width]): This lane's part of the group.
Returns:
Tuple[SIMD[.uint32, (SIMD(width) // Int(8))], Float8_e8m0fnu]: The packed codes, even values in the low nibbles, and the group's
scale.