PR #19096: Add F4E2M1FN and F8E8M0FNU types #2976
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR #19096: Add F4E2M1FN and F8E8M0FNU types
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), such as MXFP4.
Related PRs:
float8_e8m0_fnu
(E8M0) OCP MX scale format jax-ml/ml_dtypes#166The PR is split into multiple commits just to make the review easier, it is possible that some tests could fail if only some (i.e. not all) of these commits are applied.
Copybara import of the project:
--
fa539fbde987ff6421fd2937fade495baf633630 by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: import mxfloat.h
--
2c014035923e0394b2cfcb81eaf090a96621b0aa by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: primitive type
--
e919ed54e825f2e905aaf0cc279dd21cd80f1ce9 by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: literal support
--
ca16839096feb93e0454ec380c5c707c30199346 by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: conversion codegen
--
eedc079ca9a4db9e611d84877a25b3da21386f16 by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: python interface
--
8e0305cd47002f0c1f8668a3cbcbce5428f2a4c6 by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: FFI
--
aabe9c68d964609f78f29e17ee0680798ad0c6ac by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: HLO evaluator
--
87da2ebfab388f113482e852009401a9e416974a by Sergey Kozub skozub@nvidia.com:
Add F4E2M1FN type: add tests
--
e0ee48c3a37018ba985c850931592d62eadf7c2e by Sergey Kozub skozub@nvidia.com:
Add F8E8M0FNU type
--
be2e457922e2cddeaf5aca13dd022f3ac2a1393b by Sergey Kozub skozub@nvidia.com:
Addressing PR#19096 review comments
Merging this change closes #19096
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#19096 from openxla:skozub/e2m1 be2e457922e2cddeaf5aca13dd022f3ac2a1393b