[all-commits] [llvm/llvm-project] 85fe8e: [mlir] Add mlir::LLVM::FastmathFlags to LLVM instr...

bmyerz0 via All-commits all-commits at lists.llvm.org
Fri Mar 10 09:15:03 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85fe8e01a0005539b7c137b026afce6a60fdaf01
      https://github.com/llvm/llvm-project/commit/85fe8e01a0005539b7c137b026afce6a60fdaf01
  Author: Brandon Myers <brandonmyers at microsoft.com>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
    M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    M mlir/test/Dialect/LLVMIR/roundtrip.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
    M mlir/test/Target/LLVMIR/Import/fastmath.ll
    M mlir/test/Target/LLVMIR/Import/intrinsic.ll
    M mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
    M mlir/test/Target/LLVMIR/llvmir-invalid.mlir
    M mlir/test/Target/LLVMIR/llvmir.mlir

  Log Message:
  -----------
  [mlir] Add mlir::LLVM::FastmathFlags to LLVM instrinsic vector reductions

Rationale:
The LLVM dialect supports passing fastmath flags from floating point ops to LLVMIR instructions. However, not all LLVM ops have the required attribute. This change adds support for fastmath flags to `llvm.intr.vector.reduce.{fmin,fmax}`. One scenario where this is useful is in lowering llvm.intr.vector.reduce.{fmax,fmin} to LLVMIR with `nnan` (NoNans) flag so it may be [[ https://github.com/llvm/llvm-project/blob/115c7beda74f3cfaf83b91d14bc97a39bff4cf19/llvm/lib/CodeGen/ExpandReductions.cpp#L159 | lowered to a shuffle reduction ]].

Changes:

  - Make `LLVM_VecReductionF` implement the `FastmathFlagsInterface`; change is modeled on `LLVM_UnaryIntrOpF`
  - Add an assembly format for `LLVM_VecReductionF` ops. The purpose is to keep existing functionality: avoid printing the fastmath flags attribute when it has its default value (`none`). Change is modeled on `LLVM_UnaryIntrOpBase`

Reviewed By: gysit

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




More information about the All-commits mailing list