[all-commits] [llvm/llvm-project] 99f527: [APFloat] Add APFloat support for E8M0 type (#107127)
Durgadoss R via All-commits
all-commits at lists.llvm.org
Wed Oct 2 10:34:42 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 99f527d2807b5a14dc7ee64d15405f09e95ee9f2
https://github.com/llvm/llvm-project/commit/99f527d2807b5a14dc7ee64d15405f09e95ee9f2
Author: Durgadoss R <durgadossr at nvidia.com>
Date: 2024-10-02 (Wed, 02 Oct 2024)
Changed paths:
M llvm/include/llvm/ADT/APFloat.h
M llvm/lib/Support/APFloat.cpp
M llvm/unittests/ADT/APFloatTest.cpp
Log Message:
-----------
[APFloat] Add APFloat support for E8M0 type (#107127)
This patch adds an APFloat type for unsigned E8M0 format. This format is
used for representing the "scale-format" in the MX specification:
(section 5.4)
https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf
This format does not support {Inf, denorms, zeroes}. Like FP32, this
format's exponents are 8-bits (all bits here) and the bias value is 127.
However, it differs from IEEE-FP32 in that the minExponent is -127
(instead of -126). There are updates done in the APFloat utility
functions to handle these constraints for this format.
* The bias calculation is different and convertIEEE* APIs are updated to
handle this.
* Since there are no significand bits, the isSignificandAll{Zeroes/Ones}
methods are updated accordingly.
* Although the format does not have any precision, the precision bit in
the fltSemantics is set to 1 for consistency with APFloat's internal
representation.
* Many utility functions are updated to handle the fact that this format
does not support Zero.
* Provide a separate initFromAPInt() implementation to handle the quirks
of the format.
* Add specific tests to verify the range of values for this format.
Signed-off-by: Durgadoss R <durgadossr at nvidia.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list