[all-commits] [llvm/llvm-project] 14de5a: [mlir][complex] Initial support for FastMath flag ...

Kai Sasaki via All-commits all-commits at lists.llvm.org
Sun Aug 20 18:44:16 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14de5a2a4f27ed719b1f59f99d2730624a26f706
  Author: Kai Sasaki <lewuathe at gmail.com>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    M flang/test/Lower/Intrinsics/abs.f90
    M flang/test/Lower/Intrinsics/exp.f90
    M flang/test/Lower/Intrinsics/log.f90
    M flang/test/Lower/complex-operations.f90
    M mlir/include/mlir/Dialect/Complex/IR/Complex.h
    M mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
    M mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
    M mlir/lib/Dialect/Complex/IR/CMakeLists.txt
    M mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir

  Log Message:
  [mlir][complex] Initial support for FastMath flag when converting to LLVM

This change contains the initial support of FastMath flag in complex dialect. Similar to what we did in [Arith dialect](https://reviews.llvm.org/rGb56e65d31825fe4a1ae02fdcbad58bb7993d63a7), `fastmath` attributes in the complex dialect are directly mapped to the corresponding LLVM fastmath flags.

In this diff,

- Definition of FastMathAttr as a custom attribute in the Complex dialect that inherits from the EnumAttr class.
- Definition of ComplexFastMathInterface, which is an interface that is implemented by operations that have a complex::fastmath attribute.
- Declaration of a default-valued fastmath attribute for unary and arithmetic operations in the Complex dialect.
- Conversion code to lower arithmetic fastmath flags to LLVM fastmath flags

NOT in this diff (but planned and progressively implemented):

- Documentation of flag meanings
- Support the fastmath flag conversion to Arith dialect
- Folding/rewrite implementations that are enabled by fastmath flags (although it's the original motivation to support the flag)

RFC: https://discourse.llvm.org/t/rfc-fastmath-flags-support-in-complex-dialect/71981

Reviewed By: kiranchandramohan

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

More information about the All-commits mailing list