[all-commits] [llvm/llvm-project] b56e65: [mlir][arith] Initial support for fastmath flag at...

Jeremy Furtek via All-commits all-commits at lists.llvm.org
Wed Oct 26 11:56:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b56e65d31825fe4a1ae02fdcbad58bb7993d63a7
      https://github.com/llvm/llvm-project/commit/b56e65d31825fe4a1ae02fdcbad58bb7993d63a7
  Author: Jeremy Furtek <jfurtek at nvidia.com>
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
    M mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
    M mlir/include/mlir/Conversion/LLVMCommon/VectorPattern.h
    M mlir/include/mlir/Dialect/Arith/IR/Arith.h
    M mlir/include/mlir/Dialect/Arith/IR/ArithBase.td
    M mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
    A mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
    M mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
    M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.td
    M mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
    M mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
    M mlir/lib/Conversion/LLVMCommon/Pattern.cpp
    M mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp
    M mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td
    M mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
    M mlir/lib/Dialect/Arith/IR/CMakeLists.txt
    M mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp
    M mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
    M mlir/test/CAPI/ir.c
    M mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
    M mlir/test/Dialect/Arith/ops.mlir
    M mlir/test/Dialect/Linalg/invalid.mlir
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][arith] Initial support for fastmath flag attributes in the Arithmetic dialect (v2)

This diff adds initial (partial) support for "fastmath" attributes for floating
point operations in the arithmetic dialect. The "fastmath" attributes are
implemented using a default-valued bit enum. The defined flags currently mirror
the fastmath flags in the LLVM dialect (and in LLVM itself). Extending the
set of flags (if necessary) is left as a future task.

In this diff:
- Definition of FastMathAttr as a custom attribute in the Arithmetic dialect
  that inherits from the EnumAttr class.
- Definition of ArithFastMathInterface, which is an interface that is
  implemented by operations that have an arith::fastmath attribute.
- Declaration of a default-valued fastmath attribute for unary and (some) binary
  floating point operations in the Arithmetic dialect.
- Conversion code to lower arithmetic fastmath flags to LLVM fastmath flags

NOT in this diff (but planned or currently in progress):
- Documentation of flag meanings
- Addition of FastMathAttr attributes to other dialects that might lower to the
  Arithmetic dialect (e.g. Math and Complex)
- Folding/rewrite implementations that are enabled by fastmath flags
- Specification of fastmath values from Python bindings (pending other in-
  progress diffs)

Reviewed By: mehdi_amini, vzakhari

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




More information about the All-commits mailing list