Commit 2d4a8c6
committed
[APFloat] Add APFloat support for E8M0 type
This patch adds an APFloat type for unsigned E8M0 format.
This format is used for representing the "scale-format"
in the MX specification:
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 <[email protected]>1 parent f1ff3a2 commit 2d4a8c6
File tree
3 files changed
+473
-24
lines changed- llvm
- include/llvm/ADT
- lib/Support
- unittests/ADT
3 files changed
+473
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
| |||
229 | 236 | | |
230 | 237 | | |
231 | 238 | | |
| 239 | + | |
232 | 240 | | |
233 | 241 | | |
234 | 242 | | |
| |||
591 | 599 | | |
592 | 600 | | |
593 | 601 | | |
| 602 | + | |
594 | 603 | | |
595 | 604 | | |
596 | 605 | | |
| |||
652 | 661 | | |
653 | 662 | | |
654 | 663 | | |
| 664 | + | |
655 | 665 | | |
656 | 666 | | |
657 | 667 | | |
| |||
672 | 682 | | |
673 | 683 | | |
674 | 684 | | |
| 685 | + | |
675 | 686 | | |
676 | 687 | | |
677 | 688 | | |
| |||
1079 | 1090 | | |
1080 | 1091 | | |
1081 | 1092 | | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1082 | 1096 | | |
1083 | 1097 | | |
1084 | 1098 | | |
| |||
1091 | 1105 | | |
1092 | 1106 | | |
1093 | 1107 | | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1094 | 1115 | | |
1095 | 1116 | | |
1096 | 1117 | | |
| |||
0 commit comments