llvm-project/llvm/unittests/ADT
Reed 88eb3c62f2 Add FP8 E4M3 support to APFloat.
NVIDIA, ARM, and Intel recently introduced two new FP8 formats, as described in the paper: https://arxiv.org/abs/2209.05433. The first of the two FP8 dtypes, E5M2, was added in https://reviews.llvm.org/D133823. This change adds the second of the two: E4M3.

There is an RFC for adding the FP8 dtypes here: https://discourse.llvm.org/t/rfc-add-apfloat-and-mlir-type-support-for-fp8-e5m2/65279. I spoke with the RFC's author, Stella, and she gave me the go ahead to implement the E4M3 type. The name of the E4M3 type in APFloat is Float8E4M3FN, as discussed in the RFC. The "FN" means only Finite and NaN values are supported.

Unlike E5M2, E4M3 has different behavior from IEEE types in regards to Inf and NaN values. There are no Inf values, and NaN is represented when the exponent and mantissa bits are all 1s. To represent these differences in APFloat, I added an enum field, fltNonfiniteBehavior, to the fltSemantics struct. The possible enum values are IEEE754 and NanOnly. Only Float8E4M3FN has the NanOnly behavior.

After this change is submitted, I plan on adding the Float8E4M3FN type to MLIR, in the same way as E5M2 was added in https://reviews.llvm.org/D133823.

Reviewed By: bkramer

Differential Revision: https://reviews.llvm.org/D137760
2022-11-15 20:26:42 +01:00
..
APFixedPointTest.cpp Revert "Remove sign comparaison warning in APFixedPointTest.cpp" 2022-10-14 13:40:12 -07:00
APFloatTest.cpp Add FP8 E4M3 support to APFloat. 2022-11-15 20:26:42 +01:00
APIntTest.cpp Fix DenseMap with APInt keys 2022-11-01 16:23:32 -07:00
APSIntTest.cpp
AnyTest.cpp [ADT] Implement Any::has_value 2022-08-20 07:28:04 -07:00
ArrayRefTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
BitFieldsTest.cpp
BitTest.cpp [ADT] Add llvm::has_single_bit helper similar to the c++20 std::has_single_bit implementation 2022-08-23 19:51:05 +01:00
BitVectorTest.cpp
BitmaskEnumTest.cpp
BreadthFirstIteratorTest.cpp
BumpPtrListTest.cpp
CMakeLists.txt [ADT] Add IntervalTree - light tree data structure to hold intervals. 2022-09-27 08:22:28 +01:00
CoalescingBitVectorTest.cpp
CombinationGeneratorTest.cpp
DAGDeltaAlgorithmTest.cpp
DeltaAlgorithmTest.cpp
DenseMapTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
DenseSetTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
DepthFirstIteratorTest.cpp
DirectedGraphTest.cpp
EditDistanceTest.cpp [ADT][NFC] Early bail out for ComputeEditDistance 2022-06-08 08:20:29 +01:00
EnumeratedArrayTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
EquivalenceClassesTest.cpp
FallibleIteratorTest.cpp
FloatingPointMode.cpp
FoldingSet.cpp
FunctionExtrasTest.cpp
FunctionRefTest.cpp
HashingTest.cpp
IListBaseTest.cpp
IListIteratorTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
IListNodeBaseTest.cpp
IListNodeTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
IListSentinelTest.cpp
IListTest.cpp
ImmutableListTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
ImmutableMapTest.cpp
ImmutableSetTest.cpp
IntEqClassesTest.cpp
IntervalMapTest.cpp [IntervalMap] Add move and copy ctors and assignment operators 2022-10-27 09:45:24 +01:00
IntervalTreeTest.cpp [ADT] Add IntervalTree - light tree data structure to hold intervals. 2022-09-27 12:48:44 +01:00
IntrusiveRefCntPtrTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
IteratorTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
MapVectorTest.cpp
MappedIteratorTest.cpp Add explicit cast to fix MSVC error: "'return': cannot convert from 'int (__cdecl *)(int)' to '`anonymous-namespace'::Plus1FunctionRef::FuncT'" 2022-10-31 12:01:06 +00:00
OptionalTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
PackedVectorTest.cpp Canonicalize PowerPC detection macros to __powerpc__ 2022-11-06 17:29:45 -08:00
PointerEmbeddedIntTest.cpp
PointerIntPairTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
PointerSumTypeTest.cpp
PointerUnionTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
PostOrderIteratorTest.cpp
PriorityWorklistTest.cpp
RangeAdapterTest.cpp
SCCIteratorTest.cpp
STLExtrasTest.cpp [llvm] Deprecate llvm::empty (NFC) 2022-09-18 22:01:32 -07:00
STLForwardCompatTest.cpp [ADT] Remove STLForwardCompat.h's C++17 equivalents 2022-08-12 12:50:52 -06:00
ScopeExitTest.cpp
SequenceTest.cpp
SetVectorTest.cpp
SimpleIListTest.cpp
SmallPtrSetTest.cpp Use the range-based overload of llvm::sort where possible 2022-07-23 15:13:25 +02:00
SmallSetTest.cpp [ADT] Make SmallSet::insert(const T &) return const_iterator 2022-08-15 13:53:34 +08:00
SmallStringTest.cpp
SmallVectorTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
SparseBitVectorTest.cpp
SparseMultiSetTest.cpp
SparseSetTest.cpp
StatisticTest.cpp [Support] Fix no-stat build. NFC 2022-08-14 23:55:31 +01:00
StringExtrasTest.cpp
StringMapTest.cpp [llvm][ADT] Fix formatting for files relevant to `StringMap`. 2022-08-29 06:57:29 +00:00
StringRefTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00
StringSetTest.cpp
StringSwitchTest.cpp
TestGraph.h
TinyPtrVectorTest.cpp [llvm] Use std::size instead of llvm::array_lengthof 2022-09-08 09:01:53 -06:00
TripleTest.cpp [ADT][Triple] Add environment kinds for LoongArch GNU multiarch tuples 2022-11-10 15:05:04 +08:00
TwineTest.cpp [Support] Remove some #if __cplusplus > 201402L 2022-08-11 17:35:02 +00:00
TypeSwitchTest.cpp
TypeTraitsTest.cpp Reland "[llvm][NFC] Use c++17 style variable type traits" 2022-11-08 14:15:15 +00:00