[Mlir-commits] [mlir] [mlir][Vector] Add fastmath flags to vector.reduction (PR #66905)

Tobias Gysi llvmlistbot at llvm.org
Wed Sep 20 06:56:13 PDT 2023


================
@@ -656,8 +656,9 @@ class LLVM_VecReductionI<string mnem>
 class LLVM_VecReductionAccBase<string mnem, Type element>
     : LLVM_OneResultIntrOp<"vector.reduce." # mnem, [], [0],
                            [Pure, SameOperandsAndResultElementType]>,
-      Arguments<(ins element:$start_value, LLVM_VectorOf<element>:$input,
-                 DefaultValuedAttr<BoolAttr, "false">:$reassoc)> {
+      Arguments<(ins element:$start_value,
+                     LLVM_VectorOf<element>:$input,
+                     DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags)> {
----------------
gysit wrote:

I think you can pass the fastmath flag to the LLVM_OneResultIntrOp:
`
LLVM_OneResultIntrOp<"vector.reduce." # mnem, [], [0],
                           [Pure, SameOperandsAndResultElementType], /*requiresFastmath=*/1>,
`
This will add the fastmath interface on the operation. Additionally, the import / export to LLVM IR may work without a custom mlirBuilder / llvmBuilder. At a first glance these two custom builders should not be necessary and the default ones should work. But maybe I am missing something.


https://github.com/llvm/llvm-project/pull/66905


More information about the Mlir-commits mailing list