[Mlir-commits] [mlir] [mlir]Add a check to ensure bailing out when reducing to a scalar (PR #129694)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Mar 5 00:14:36 PST 2025


================
@@ -222,6 +222,13 @@ func.func @vector_multi_reduction(%v : vector<4x6xf32>, %acc: vector<4xf32>) ->
 //       CHECK:   %[[V2:.*]] = vector.insert_strided_slice %[[R5]], %[[V1]] {offsets = [2], strides = [1]} : vector<2xf32> into vector<4xf32>
 //       CHECK:   return %[[V2]] : vector<4xf32>
 
+func.func @negative_vector_multi_reduction(%v: vector<4x2xf32>, %acc: f32) -> f32 {
+  %0 = vector.multi_reduction #vector.kind<add>, %v, %acc [0, 1] : vector<4x2xf32> to f32
+  return %0 : f32
+}
+// CHECK-LABEL: func @negative_vector_multi_reduction
+//       CHECK:   %[[R0:.*]] = vector.multi_reduction <add>, %{{.*}}, %{{.*}} [0, 1] : vector<4x2xf32> to f32
+//       CHECK:   return %[[R0]] : f32
----------------
banach-space wrote:

To make sure that there's nothing in-between:
```suggestion
//       CHECK-NEXT:   %[[R0:.*]] = vector.multi_reduction <add>, %{{.*}}, %{{.*}} [0, 1] : vector<4x2xf32> to f32
//       CHECK-NEXT:   return %[[R0]] : f32
```

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


More information about the Mlir-commits mailing list