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 module

fp4_utils

Provides low-level FP4 encode/decode utilities and scale-factor helpers.

comptime values

E2M1_TO_FLOAT32

comptime E2M1_TO_FLOAT32 = SIMD(SIMD(0), SIMD(0.5), SIMD(1), SIMD(1.5), SIMD(2), SIMD(3), SIMD(4), SIMD(6), SIMD(-0.0), SIMD(-0.5), SIMD(-1), SIMD(-1.5), SIMD(-2), SIMD(-3), SIMD(-4), SIMD(-6), __list_literal__=NoneType(None))

E4M3_MAXABS_RECIP

comptime E4M3_MAXABS_RECIP = 0.002232142857142857

FP4_E2M1_MANTISSA_WIDTH

comptime FP4_E2M1_MANTISSA_WIDTH = 1

FP4_E2M1_MAX_EXPONENT

comptime FP4_E2M1_MAX_EXPONENT = 2

MXFP4_SF_DTYPE

comptime MXFP4_SF_DTYPE = DType.float8_e8m0fnu

MXFP4_SF_VECTOR_SIZE

comptime MXFP4_SF_VECTOR_SIZE = 32

MXFP8_SF_DTYPE

comptime MXFP8_SF_DTYPE = DType.float8_e8m0fnu

MXFP8_SF_VECTOR_SIZE

comptime MXFP8_SF_VECTOR_SIZE = 32

NVFP4_SF_DTYPE

comptime NVFP4_SF_DTYPE = DType.float8_e4m3fn

NVFP4_SF_VECTOR_SIZE

comptime NVFP4_SF_VECTOR_SIZE = 16

SF_ATOM_K

comptime SF_ATOM_K = 4

SF_ATOM_M

comptime SF_ATOM_M = Tuple(Int(32), Int(4))

SF_K_GROUP_SIZE

comptime SF_K_GROUP_SIZE[SF_VECTOR_SIZE: Int] = (Int(4) * SF_VECTOR_SIZE)

Parameters

  • SF_VECTOR_SIZE (Int):

SF_MN_GROUP_SIZE

comptime SF_MN_GROUP_SIZE = ((load_from_mem SF_ATOM_M.__getitem_param__[Int(0)]()) * (load_from_mem SF_ATOM_M.__getitem_param__[Int(1)]()))

Functions