[all-commits] [llvm/llvm-project] 2f086f: [APFloat] Add E4M3B11FNUZ

David Majnemer via All-commits all-commits at lists.llvm.org
Fri Mar 24 13:07:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f086f265bf97fe6543fb199f4ef874ca3522479
      https://github.com/llvm/llvm-project/commit/2f086f265bf97fe6543fb199f4ef874ca3522479
  Author: David Majnemer <david.majnemer at gmail.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    M clang/lib/AST/MicrosoftMangle.cpp
    M llvm/include/llvm/ADT/APFloat.h
    M llvm/lib/Support/APFloat.cpp
    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/OpBase.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/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/test/IR/attribute.mlir
    M mlir/test/python/ir/builtin_types.py
    M mlir/utils/lldb-scripts/mlirDataFormatters.py

  Log Message:
  -----------
  [APFloat] Add E4M3B11FNUZ

X. Sun et al. (https://dl.acm.org/doi/10.5555/3454287.3454728) published
a paper showing that an FP format with 4 bits of exponent, 3 bits of
significand and an exponent bias of 11 would work quite well for ML
applications.

Google hardware supports a variant of this format where 0x80 is used to
represent NaN, as in the Float8E4M3FNUZ format. Just like the
Float8E4M3FNUZ format, this format does not support -0 and values which
would map to it will become +0.

This format is proposed for inclusion in OpenXLA's StableHLO dialect: https://github.com/openxla/stablehlo/pull/1308

As part of inclusion in that dialect, APFloat needs to know how to
handle this format.

Differential Revision: https://reviews.llvm.org/D146441




More information about the All-commits mailing list