Skip to content

Commit d5abd8a

Browse files
authored
[mlir][vector][nfc] Move tests for scalable outer-product (llvm#76035)
Tests for vector.outerproduct for scalable vectors from "vector-scalable-outerproduct.mlir" are moved to: * ops.mlir and invalid.mlir. These files are effectively used to document what Ops are supported and That's basically what the original file was testing (but specifically for scalable vectors).
1 parent 273a0c9 commit d5abd8a

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

mlir/test/Dialect/Vector/invalid.mlir

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,3 +1734,27 @@ func.func @integer_vector_contract(%arg0: vector<16x32xsi8>, %arg1: vector<32x16
17341734
} %arg0, %arg1, %arg2 : vector<16x32xsi8>, vector<32x16xsi8> into vector<16x16xsi32>
17351735
return %0: vector<16x16xsi32>
17361736
}
1737+
1738+
// -----
1739+
1740+
func.func @invalid_outerproduct(%src : memref<?xf32>) {
1741+
%idx = arith.constant 0 : index
1742+
%0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
1743+
%1 = vector.load %src[%idx] : memref<?xf32>, vector<4xf32>
1744+
1745+
// expected-error @+1 {{expected either both or only #2 operand dim to be scalable}}
1746+
%op = vector.outerproduct %0, %1 : vector<[4]xf32>, vector<4xf32>
1747+
1748+
return
1749+
}
1750+
1751+
// -----
1752+
1753+
func.func @invalid_outerproduct1(%src : memref<?xf32>) {
1754+
%idx = arith.constant 0 : index
1755+
%0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]x[4]xf32>
1756+
%1 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
1757+
1758+
// expected-error @+1 {{'vector.outerproduct' op expected 1-d vector for operand #1}}
1759+
%op = vector.outerproduct %0, %1 : vector<[4]x[4]xf32>, vector<[4]xf32>
1760+
}

mlir/test/Dialect/Vector/ops.mlir

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,17 @@ func.func @outerproduct(%arg0: vector<4xf32>, %arg1: vector<8xf32>, %arg2: vecto
301301
return %1 : vector<4x8xf32>
302302
}
303303

304+
// CHECK-LABEL: @outerproduct_scalable
305+
func.func @outerproduct_scalable(%arg0 : vector<[4]xf32>, %arg1 : vector<[8]xf32>) {
306+
// CHECK: vector.outerproduct {{.*}} : vector<[4]xf32>, vector<[8]xf32>
307+
%0 = vector.outerproduct %arg0, %arg1 : vector<[4]xf32>, vector<[8]xf32>
308+
309+
%cst = arith.constant 1.0 : f32
310+
// CHECK: vector.outerproduct {{.*}} : vector<[4]xf32>, f32
311+
%1 = vector.outerproduct %arg0, %cst : vector<[4]xf32>, f32
312+
return
313+
}
314+
304315
// CHECK-LABEL: @insert_strided_slice
305316
func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {
306317
// CHECK: vector.insert_strided_slice %{{.*}}, %{{.*}} {offsets = [2, 2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32>

mlir/test/Dialect/Vector/vector-scalable-outerproduct.mlir

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)