[Mlir-commits] [mlir] [mlir][arith] Add neutral element support to arith.maxnumf/arith.minnumf (PR #93278)

Jakub Kuderski llvmlistbot at llvm.org
Mon May 27 08:10:30 PDT 2024


================
@@ -407,3 +407,49 @@ module attributes {transform.with_named_sequence} {
       transform.yield
   }
 }
+
+// -----
+
+// Checks we use nan as the neutral element for maxnumf op.
+func.func @generic_split_maxnumf(%in: tensor<32xf32>, %out: tensor<f32>) -> tensor<f32> {
+  %r = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>,
+                                        affine_map<(d0) -> ()>],
+        iterator_types = ["reduction"]}
+  ins(%in : tensor<32xf32>)
+  outs(%out : tensor<f32>) {
+  ^bb0(%arg1: f32, %arg2: f32):
+    %y = arith.maxnumf %arg1, %arg2 : f32
----------------
kuhar wrote:

Should we also have a test for `minnumf`? I don't mean to duplicate this test case, just match what the key ops and capture what the differences should be.

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


More information about the Mlir-commits mailing list