[all-commits] [llvm/llvm-project] eef1d7: [MLIR] Add f8E3M4 IEEE 754 type (#101230)

Alexander Pivovarov via All-commits all-commits at lists.llvm.org
Fri Aug 2 00:22:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eef1d7e3776a4eb235012076f40b8ecc0723afce
      https://github.com/llvm/llvm-project/commit/eef1d7e3776a4eb235012076f40b8ecc0723afce
  Author: Alexander Pivovarov <pivovaa at amazon.com>
  Date:   2024-08-02 (Fri, 02 Aug 2024)

  Changed paths:
    M mlir/include/mlir-c/BuiltinTypes.h
    M mlir/include/mlir/IR/Builders.h
    M mlir/include/mlir/IR/BuiltinTypes.h
    M mlir/include/mlir/IR/BuiltinTypes.td
    M mlir/include/mlir/IR/CommonTypeConstraints.td
    M mlir/include/mlir/IR/Types.h
    M mlir/lib/AsmParser/TokenKinds.def
    M mlir/lib/AsmParser/TypeParser.cpp
    M mlir/lib/Bindings/Python/IRTypes.cpp
    M mlir/lib/CAPI/IR/BuiltinTypes.cpp
    M mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
    M mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/Builders.cpp
    M mlir/lib/IR/BuiltinTypes.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/IR/Types.cpp
    M mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
    M mlir/python/mlir/extras/types.py
    M mlir/test/IR/attribute.mlir
    M mlir/test/Target/LLVMIR/llvmir.mlir
    M mlir/test/python/ir/builtin_types.py
    M mlir/utils/lldb-scripts/mlirDataFormatters.py
    M mlir/utils/tree-sitter-mlir/grammar.js

  Log Message:
  -----------
  [MLIR] Add f8E3M4 IEEE 754 type (#101230)

This PR adds `f8E3M4` type to mlir.

`f8E3M4` type  follows IEEE 754 convention

```c
f8E3M4 (IEEE 754)
- Exponent bias: 3
- Maximum stored exponent value: 6 (binary 110)
- Maximum unbiased exponent value: 6 - 3 = 3
- Minimum stored exponent value: 1 (binary 001)
- Minimum unbiased exponent value: 1 − 3 = −2
- Precision specifies the total number of bits used for the significand (mantissa), 
    including implicit leading integer bit = 4 + 1 = 5
- Follows IEEE 754 conventions for representation of special values
- Has Positive and Negative zero
- Has Positive and Negative infinity
- Has NaNs

Additional details:
- Max exp (unbiased): 3
- Min exp (unbiased): -2
- Infinities (+/-): S.111.0000
- Zeros (+/-): S.000.0000
- NaNs: S.111.{0,1}⁴ except S.111.0000
- Max normal number: S.110.1111 = +/-2^(6-3) x (1 + 15/16) = +/-2^3 x 31 x 2^(-4) = +/-15.5
- Min normal number: S.001.0000 = +/-2^(1-3) x (1 + 0) = +/-2^(-2)
- Max subnormal number: S.000.1111 = +/-2^(-2) x 15/16 = +/-2^(-2) x 15 x 2^(-4) = +/-15 x 2^(-6)
- Min subnormal number: S.000.0001 = +/-2^(-2) x 1/16 =  +/-2^(-2) x 2^(-4) = +/-2^(-6)
```

Related PRs:
- [PR-99698](https://github.com/llvm/llvm-project/pull/99698) [APFloat]
Add support for f8E3M4 IEEE 754 type
- [PR-97118](https://github.com/llvm/llvm-project/pull/97118) [MLIR] Add
f8E4M3 IEEE 754 type



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