[all-commits] [llvm/llvm-project] 918222: [MLIR] Add f6E3M2FN type (#105573)

Sergey Kozub via All-commits all-commits at lists.llvm.org
Tue Sep 10 01:41:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 918222ba43f6e56208ad347ed10a3e0025d8ed38
      https://github.com/llvm/llvm-project/commit/918222ba43f6e56208ad347ed10a3e0025d8ed38
  Author: Sergey Kozub <skozub at nvidia.com>
  Date:   2024-09-10 (Tue, 10 Sep 2024)

  Changed paths:
    M llvm/unittests/ADT/APFloatTest.cpp
    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 f6E3M2FN type (#105573)

This PR adds `f6E3M2FN` type to mlir.

`f6E3M2FN` type is proposed in [OpenCompute MX
Specification](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf).
It defines a 6-bit floating point number with bit layout S1E3M2. Unlike
IEEE-754 types, there are no infinity or NaN values.

```c
f6E3M2FN
- Exponent bias: 3
- Maximum stored exponent value: 7 (binary 111)
- Maximum unbiased exponent value: 7 - 3 = 4
- Minimum stored exponent value: 1 (binary 001)
- Minimum unbiased exponent value: 1 − 3 = −2
- Has Positive and Negative zero
- Doesn't have infinity
- Doesn't have NaNs

Additional details:
- Zeros (+/-): S.000.00
- Max normal number: S.111.11 = ±2^(4) x (1 + 0.75) = ±28
- Min normal number: S.001.00 = ±2^(-2) = ±0.25
- Max subnormal number: S.000.11 = ±2^(-2) x 0.75 = ±0.1875
- Min subnormal number: S.000.01 = ±2^(-2) x 0.25 = ±0.0625
```

Related PRs:
- [PR-94735](https://github.com/llvm/llvm-project/pull/94735) [APFloat]
Add APFloat support for FP6 data types
- [PR-97118](https://github.com/llvm/llvm-project/pull/97118) [MLIR] Add
f8E4M3 type - was used as a template for this PR



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