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

e2m1x8_to_e4m3x8

def e2m1x8_to_e4m3x8(word: UInt32, lut: SIMD[.uint32, 2]) -> SIMD[.uint32, 2]

Converts eight e2m1 (element 0 in the low nibble) to eight e4m3 bytes.

The magnitude comes from lut indexed by the code's low 3 bits. The sign comes from prmt's sign-replicate mode: with shifted = word << 4, element 2i's sign is the msb of shifted byte i and element 2i + 1's is the msb of word byte i, so one prmt spreads four signs into 0x00/0xFF bytes that select the 0x80 bit.

Returns:

SIMD[.uint32, 2]

Was this page helpful?