Skip to content

Commit 04d4303

Browse files
committed
Add a negative test and also update the diagnostic test with lesser ops
1 parent b8df120 commit 04d4303

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

mlir/test/Dialect/Vector/invalid.mlir

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,11 +768,10 @@ func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
768768

769769
// -----
770770

771-
func.func @extract_strided_slice() -> () {
771+
func.func @extract_strided_slice(%arg0: vector<3x2x2xf32>) {
772772
// expected-error@+1 {{expected input vector rank to match target shape rank}}
773-
%0 = arith.constant dense<1.000000e+00> : vector<24x2x2xf32>
774-
%1 = vector.extract_strided_slice %0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}:
775-
vector<24x2x2xf32> to vector<2x2xf32>
773+
%1 = vector.extract_strided_slice %arg0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}:
774+
vector<3x2x2xf32> to vector<2x2xf32>
776775
return
777776
}
778777

mlir/test/Dialect/Vector/vector-unroll-options.mlir

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ func.func @vector_fma(%a: vector<4x4xf32>, %b: vector<4x4xf32>, %c: vector<4x4xf
188188
// CHECK-LABEL: func @vector_fma
189189
// CHECK-COUNT-4: vector.fma %{{.+}}, %{{.+}}, %{{.+}} : vector<2x2xf32>
190190

191+
func.func @higher_rank_unroll() {
192+
%cst_25 = arith.constant dense<3.718400e+04> : vector<4x2x2xf16>
193+
%cst_26 = arith.constant dense<1.000000e+00> : vector<24x2x2xf32>
194+
%47 = vector.fma %cst_26, %cst_26, %cst_26 : vector<24x2x2xf32>
195+
%818 = scf.execute_region -> vector<24x2x2xf32> {
196+
scf.yield %47 : vector<24x2x2xf32>
197+
}
198+
%823 = vector.extract_strided_slice %cst_25 {offsets = [2], sizes = [1], strides = [1]} : vector<4x2x2xf16> to vector<1x2x2xf16>
199+
return
200+
}
201+
202+
// CHECK-LABEL: func @higher_rank_unroll
203+
// CHECK: return
204+
191205
func.func @vector_multi_reduction(%v : vector<4x6xf32>, %acc: vector<4xf32>) -> vector<4xf32> {
192206
%0 = vector.multi_reduction #vector.kind<add>, %v, %acc [1] : vector<4x6xf32> to vector<4xf32>
193207
return %0 : vector<4xf32>

0 commit comments

Comments
 (0)