MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mx_schemes.hpp File Reference
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>

Classes

struct  mtl::mx::mxint8
 MXINT8: a scale byte, then 32 two's-complement int8 elements. 33 bytes. More...
struct  mtl::mx::mxfp4
 MXFP4: a scale byte, then 16 bytes of packed E2M1 elements in GGML's block_mxfp4 order (element j low nibble, element j + 16 high nibble of byte 1 + j). More...

Namespaces

namespace  mtl
namespace  mtl::mx

Functions

float mtl::mx::e8m0_to_float (std::uint8_t e) noexcept
 The value of an E8M0 scale byte: 2^(e - 127), or NaN for 0xFF.
float mtl::mx::e2m1_to_float (std::uint8_t code) noexcept
 The value of an FP4 E2M1 code (low four bits of code): sign, two exponent bits with bias 1, one mantissa bit, and a subnormal at exponent 0.