Skip to content

Commit

Permalink
PR #19096: Add F4E2M1FN and F8E8M0FNU types
Browse files Browse the repository at this point in the history
Imported from GitHub PR openxla/xla#19096

This PR adds F4E2M1FN primitive type (4-bit float with 2 bits exponent and 1 bit mantissa), F8E8M0FNU primitive type (8-bit float with 8 bits exponent, no mantissa and no sign) and enables loads/stores in the same way S4/U4 type is implemented.

This will enable using microscaling (MX) formats ([RFC](openxla/xla#18085)), such as MXFP4.

```c...

PiperOrigin-RevId: 709153611
  • Loading branch information
jaeyoo authored and The ml_dtypes Authors committed Dec 23, 2024
1 parent 986e373 commit a09b65f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ml_dtypes/include/mxfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ namespace Eigen {
namespace numext {

#define MXFLOAT_EIGEN_SIGNBIT_IMPL(Type) \
template <> \
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Type signbit(const Type& x) { \
int8_t t = bit_cast<int8_t, Type>(x) << (8 - Type::kBits); \
return bit_cast<Type, int8_t>(t >> 7); \
Expand Down

0 comments on commit a09b65f

Please sign in to comment.