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

pack_fp6_x4

def pack_fp6_x4(code: SIMD[DType.uint8, SIMDLength(4)]) -> UInt32

Packs four FP6 codes into the low 24 bits of a word, element 0 lowest.

Element i occupies bits [6i + 5 : 6i]. Storing the low three bytes of the result little-endian lays the group out as a contiguous 6-bit stream, which is why the group -- not the byte -- is the smallest addressable unit of packed FP6. The upper 8 bits of the returned word are always zero.

A SIMD[DType.uint8, 3] would model the three bytes more literally, but SIMD lengths must be powers of two, so the group travels in a word instead.

!!! warning "Bit order is unverified against the CDNA4 MFMA" This is the natural LSB-first reading of a packed FP6 stream, and it round-trips with unpack_fp6_x4, but nothing here proves it matches the operand layout V_MFMA_SCALE_*_F8F6F4 expects inside its 24-byte fragment. Only an MFMA run on MI355 settles that; do not build a kernel fragment loader on this convention until such a test passes.

Args:

Returns:

UInt32: The packed group in bits 23:0.