-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add float8_e8m0_fnu
(E8M0) OCP MX scale format
#166
Add float8_e8m0_fnu
(E8M0) OCP MX scale format
#166
Conversation
This looks good to me. There's a small failure in the test suite: please fix? |
(Sorry about the slow review.) |
Thanks for looking at it, I'll check the failing tests in the next few days. In the meantime, do you have an opinion on the naming? Should we stick to the name in the PR? |
521316f
to
90281bc
Compare
@hawkinsp Apologies it took me a bit longer than expected. The CI issue should be fixed now (was just a trivial |
7796088
to
e5160b5
Compare
This LGTM, but I'd appreciate @sergey-kozub's review, since he's in the process of adding the (complementary) MX data types in #181 |
There's a test failure on mac os (different integer overflow behavior?) |
Overall looks fine to me. This PR touches many files also affected by #181, so I'd like to upstream that one first. I'll do the rebase to fix the merge failures. |
@sergey-kozub @hawkinsp Removing |
Ideally we'd like to make a new |
@hawkinsp Just pushed a fix commit for MacOS and Windows. Hopefully should be the last one if @sergey-kozub is good with the PR as it is. |
I'm trying to merge #181 first, which will probably create a merge conflict and you'll need to rebase on top of that PR. Hopefully it will be in soon. |
Ok, #181 is merged. Would you: |
Oh, it looks like you have a test failure on Python 3.13t. I doubt the "free-threading" part is important, but we are trying to make a Python 3.13 release. |
I'll rebase & squash commits. On the Python 3.13 failure, we should probably skip this test as |
2953430
to
b53f481
Compare
@hawkinsp I should be hopefully the last round of rebase & fix. I added a skip on the test Note: there is a new failure on Python 3.9 introduced by the previous MX float4/float6 PR. I am looking into it. |
Adding the OCP MX scale format `E8M0`, which has the following properties: * Unsigned format; * 8 exponent bits; * Exponent range from -127 to 127; * No zero and infinity; * Single NaN value (0xFF); `ml_dtypes` `float8_base` C++ class is extended to support floating point formats which are unsigned and with no zero (i.e. additional `kIsSigned` and `kHasZero` Traits properties). Base on these traits, `float8_e8m0_fnu` has been implemented using the existing functionalities (convert, unary/binary ops, ...). Float8 Python unit tests have been extended to be able to cover unsigned floating point formats.
b53f481
to
b6d3659
Compare
The trick |
What went wrong without |
Python 3.9 does not seem to support the direct call to The merge commit on the main branch has this issue: https://github.com/jax-ml/ml_dtypes/actions/runs/10833234151/job/30059511975 |
Adding the OCP MX scale format
E8M0
, which has the following properties:The
E8M0
format is used in all MX block format definitions for scale representation (see https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf and issue #116).ml_dtypes
float8_base
C++ class is extended to support floating point formats which are unsigned and with no zero (i.e. additionalkIsSigned
andkHasZero
Traits properties).Base on these traits,
float8_e8m0_fnu
has been implemented using the existing functionalities (convert, unary/binary ops, ...). Float8 Python unit tests have been extended to be able to cover unsigned floating point formats.Points to discuss on the PR:
float8_e8m0_fnu
. Maybeufloat8_e8m0_fn
could be better?E8M0
. Is there a cleaner way?