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_fp32_to_fp4e2m1
def cast_fp32_to_fp4e2m1[width: SIMDLength, //](x: SIMD[DType.float32, width]) -> UInt32
Converts eight float32 values to a packed FP4 E2M1 word using SM100 PTX instructions.
Issues four cvt.rn.satfinite.e2m1x2.f32 PTX instructions to convert pairs of
float32 values to 4-bit FP4 E2M1, packing the results into a single UInt32.
Constraints:
Requires NVIDIA GPU with SM100 or newer (B200 and above).
Parameters:
- width (
SIMDLength): Must be 8; each call converts exactly eight float32 values.
Args:
- x (
SIMD[DType.float32, width]): Eight float32 input values to convert.
Returns:
UInt32: A UInt32 with the eight FP4 E2M1 nibbles packed in byte order.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!