IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo function

cast_f4e2m1x2_to_fp16x2

def cast_f4e2m1x2_to_fp16x2(x: UInt8) -> SIMD[DType.float16, SIMDLength(2)]

Converts two FP4 E2M1 nibbles packed in one byte to two float16 values using SM100 PTX.

Issues the cvt.rn.f16x2.e2m1x2 PTX instruction to decode both nibbles in a single hardware operation.

Constraints:

Requires NVIDIA GPU with SM100 or newer (B200 and above).

Args:

  • x (UInt8): A uint8 containing two packed FP4 E2M1 nibbles (low nibble = element 0).

Returns:

SIMD[DType.float16, SIMDLength(2)]: A two-element float16 SIMD vector with the decoded values.