[Mlir-commits] [mlir] d5abd8a - [mlir][vector][nfc] Move tests for scalable outer-product (#76035)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Dec 20 02:53:03 PST 2023
Author: Andrzej WarzyĆski
Date: 2023-12-20T10:53:00Z
New Revision: d5abd8a1a9b5f60a16f6bfd983e1baed22313bae
URL: https://github.com/llvm/llvm-project/commit/d5abd8a1a9b5f60a16f6bfd983e1baed22313bae
DIFF: https://github.com/llvm/llvm-project/commit/d5abd8a1a9b5f60a16f6bfd983e1baed22313bae.diff
LOG: [mlir][vector][nfc] Move tests for scalable outer-product (#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).
Added:
Modified:
mlir/test/Dialect/Vector/invalid.mlir
mlir/test/Dialect/Vector/ops.mlir
Removed:
mlir/test/Dialect/Vector/vector-scalable-outerproduct.mlir
################################################################################
diff --git a/mlir/test/Dialect/Vector/invalid.mlir b/mlir/test/Dialect/Vector/invalid.mlir
index ad248d1e14e72e..3bee9e0081c3b0 100644
--- a/mlir/test/Dialect/Vector/invalid.mlir
+++ b/mlir/test/Dialect/Vector/invalid.mlir
@@ -1734,3 +1734,27 @@ func.func @integer_vector_contract(%arg0: vector<16x32xsi8>, %arg1: vector<32x16
} %arg0, %arg1, %arg2 : vector<16x32xsi8>, vector<32x16xsi8> into vector<16x16xsi32>
return %0: vector<16x16xsi32>
}
+
+// -----
+
+func.func @invalid_outerproduct(%src : memref<?xf32>) {
+ %idx = arith.constant 0 : index
+ %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
+ %1 = vector.load %src[%idx] : memref<?xf32>, vector<4xf32>
+
+ // expected-error @+1 {{expected either both or only #2 operand dim to be scalable}}
+ %op = vector.outerproduct %0, %1 : vector<[4]xf32>, vector<4xf32>
+
+ return
+}
+
+// -----
+
+func.func @invalid_outerproduct1(%src : memref<?xf32>) {
+ %idx = arith.constant 0 : index
+ %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]x[4]xf32>
+ %1 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
+
+ // expected-error @+1 {{'vector.outerproduct' op expected 1-d vector for operand #1}}
+ %op = vector.outerproduct %0, %1 : vector<[4]x[4]xf32>, vector<[4]xf32>
+}
diff --git a/mlir/test/Dialect/Vector/ops.mlir b/mlir/test/Dialect/Vector/ops.mlir
index c1ef8f2c30c05c..9f1ec21cdabf67 100644
--- a/mlir/test/Dialect/Vector/ops.mlir
+++ b/mlir/test/Dialect/Vector/ops.mlir
@@ -301,6 +301,17 @@ func.func @outerproduct(%arg0: vector<4xf32>, %arg1: vector<8xf32>, %arg2: vecto
return %1 : vector<4x8xf32>
}
+// CHECK-LABEL: @outerproduct_scalable
+func.func @outerproduct_scalable(%arg0 : vector<[4]xf32>, %arg1 : vector<[8]xf32>) {
+ // CHECK: vector.outerproduct {{.*}} : vector<[4]xf32>, vector<[8]xf32>
+ %0 = vector.outerproduct %arg0, %arg1 : vector<[4]xf32>, vector<[8]xf32>
+
+ %cst = arith.constant 1.0 : f32
+ // CHECK: vector.outerproduct {{.*}} : vector<[4]xf32>, f32
+ %1 = vector.outerproduct %arg0, %cst : vector<[4]xf32>, f32
+ return
+}
+
// CHECK-LABEL: @insert_strided_slice
func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {
// CHECK: vector.insert_strided_slice %{{.*}}, %{{.*}} {offsets = [2, 2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32>
diff --git a/mlir/test/Dialect/Vector/vector-scalable-outerproduct.mlir b/mlir/test/Dialect/Vector/vector-scalable-outerproduct.mlir
deleted file mode 100644
index 3b4e24da92aaac..00000000000000
--- a/mlir/test/Dialect/Vector/vector-scalable-outerproduct.mlir
+++ /dev/null
@@ -1,39 +0,0 @@
-// RUN: mlir-opt -split-input-file -verify-diagnostics %s | mlir-opt
-
-func.func @scalable_outerproduct(%src : memref<?xf32>) {
- %idx = arith.constant 0 : index
- %cst = arith.constant 1.0 : f32
- %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
- %1 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
-
- %op = vector.outerproduct %0, %1 : vector<[4]xf32>, vector<[4]xf32>
- vector.store %op, %src[%idx] : memref<?xf32>, vector<[4]x[4]xf32>
-
- %op2 = vector.outerproduct %0, %cst : vector<[4]xf32>, f32
- vector.store %op2, %src[%idx] : memref<?xf32>, vector<[4]xf32>
- return
-}
-
-// -----
-
-func.func @invalid_outerproduct(%src : memref<?xf32>) {
- %idx = arith.constant 0 : index
- %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
- %1 = vector.load %src[%idx] : memref<?xf32>, vector<4xf32>
-
- // expected-error @+1 {{expected either both or only #2 operand dim to be scalable}}
- %op = vector.outerproduct %0, %1 : vector<[4]xf32>, vector<4xf32>
-
- return
-}
-
-// -----
-
-func.func @invalid_outerproduct1(%src : memref<?xf32>) {
- %idx = arith.constant 0 : index
- %0 = vector.load %src[%idx] : memref<?xf32>, vector<[4]x[4]xf32>
- %1 = vector.load %src[%idx] : memref<?xf32>, vector<[4]xf32>
-
- // expected-error @+1 {{'vector.outerproduct' op expected 1-d vector for operand #1}}
- %op = vector.outerproduct %0, %1 : vector<[4]x[4]xf32>, vector<[4]xf32>
-}
More information about the Mlir-commits
mailing list