[Mlir-commits] [mlir] [mlir][vector] Improve `makeArithReduction` expansion (PR #75846)
Han-Chung Wang
llvmlistbot at llvm.org
Mon Dec 18 14:45:51 PST 2023
================
@@ -27,13 +27,13 @@ func.func @vector_multi_reduction_min(%arg0: vector<2x4xf32>, %acc: vector<2xf32
// CHECK-SAME: %[[INPUT:.+]]: vector<2x4xf32>, %[[ACC:.*]]: vector<2xf32>
// CHECK: %[[TRANSPOSED:.+]] = vector.transpose %[[INPUT]], [1, 0] : vector<2x4xf32> to vector<4x2xf32>
// CHECK: %[[V0:.+]] = vector.extract %[[TRANSPOSED]][0] : vector<2xf32> from vector<4x2xf32>
-// CHECK: %[[RV0:.+]] = arith.minimumf %[[V0]], %[[ACC]] : vector<2xf32>
+// CHECK: %[[RV0:.+]] = arith.minnumf %[[V0]], %[[ACC]] : vector<2xf32>
// CHECK: %[[V1:.+]] = vector.extract %[[TRANSPOSED]][1] : vector<2xf32> from vector<4x2xf32>
-// CHECK: %[[RV01:.+]] = arith.minimumf %[[V1]], %[[RV0]] : vector<2xf32>
+// CHECK: %[[RV01:.+]] = arith.minnumf %[[V1]], %[[RV0]] : vector<2xf32>
// CHECK: %[[V2:.+]] = vector.extract %[[TRANSPOSED]][2] : vector<2xf32> from vector<4x2xf32>
-// CHECK: %[[RV012:.+]] = arith.minimumf %[[V2]], %[[RV01]] : vector<2xf32>
+// CHECK: %[[RV012:.+]] = arith.minnumf %[[V2]], %[[RV01]] : vector<2xf32>
// CHECK: %[[V3:.+]] = vector.extract %[[TRANSPOSED]][3] : vector<2xf32> from vector<4x2xf32>
-// CHECK: %[[RESULT_VEC:.+]] = arith.minimumf %[[V3]], %[[RV012]] : vector<2xf32>
+// CHECK: %[[RESULT_VEC:.+]] = arith.minnumf %[[V3]], %[[RV012]] : vector<2xf32>
----------------
hanhanW wrote:
I was confused because the RFC says that we should map `minf/maxf` to `minimumf/minimumf`.
https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671#proposed-solution-2
However, this is not the case in vector dialect. The execution introduces two combiner kinds `minimumf/minimumf` and keeps `minf/maxf` in https://reviews.llvm.org/D158618
Not sure who is working on it, but the current mapping is
```
<minimumf> --> arith.minimumf
<maximumf> --> arith.maximumf
<maxf> --> arith.maxnumf
<minf> --> arith.minnumf
```
In this context, the change looks okay to me.
https://github.com/llvm/llvm-project/pull/75846
More information about the Mlir-commits
mailing list