[Mlir-commits] [mlir] [mlir][vector][nfc] Move tests for scalable outer-product (PR #76035)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Dec 20 02:06:38 PST 2023
https://github.com/banach-space created https://github.com/llvm/llvm-project/pull/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).
>From e2fe48b2add13d1a34df1c0cc3f03e48743160d3 Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Wed, 20 Dec 2023 09:56:47 +0000
Subject: [PATCH] [mlir][vector][nfc] Move tests for scalable outer-product
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).
---
mlir/test/Dialect/Vector/invalid.mlir | 24 ++++++++++++
mlir/test/Dialect/Vector/ops.mlir | 11 ++++++
.../Vector/vector-scalable-outerproduct.mlir | 39 -------------------
3 files changed, 35 insertions(+), 39 deletions(-)
delete mode 100644 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