[Mlir-commits] [mlir] [mlir][test] Add integration tests for vector.interleave (PR #80969)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Feb 21 07:29:56 PST 2024


https://github.com/MacDue updated https://github.com/llvm/llvm-project/pull/80969

>From dba3b5a3ca9f0326af78d3fb1e7f3811018c9db8 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Wed, 7 Feb 2024 10:25:47 +0000
Subject: [PATCH 1/3] [mlir][test] Add integration tests for vector.interleave

---
 .../CPU/ArmSVE/test-scalable-interleave.mlir  | 24 +++++++++++++++++++
 .../Dialect/Vector/CPU/test-interleave.mlir   | 24 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
 create mode 100644 mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir

diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
new file mode 100644
index 00000000000000..fba23b24b8c910
--- /dev/null
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
@@ -0,0 +1,24 @@
+// RUN: mlir-opt %s -test-lower-to-llvm | \
+// RUN: %mcr_aarch64_cmd -e entry -entry-point-result=void  \
+// RUN:   -shared-libs=%mlir_c_runner_utils,%mlir_arm_runner_utils | \
+// RUN: FileCheck %s
+
+func.func @entry() {
+  %f1 = arith.constant 1.0 : f32
+  %f2 = arith.constant 2.0 : f32
+  %v1 = vector.splat %f1 : vector<[4]xf32>
+  %v2 = vector.splat %f2 :  vector<[4]xf32>
+  vector.print %v1 : vector<[4]xf32>
+  vector.print %v2 : vector<[4]xf32>
+  //
+  // Test vectors:
+  //
+  // CHECK: ( 1, 1, 1, 1
+  // CHECK: ( 2, 2, 2, 2
+
+  %v3 = vector.interleave %v1, %v2 : vector<[4]xf32>
+  vector.print %v3 : vector<[8]xf32>
+  // CHECK: ( 1, 2, 1, 2, 1, 2, 1, 2
+
+  return
+}
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir b/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir
new file mode 100644
index 00000000000000..69bf0320a36970
--- /dev/null
+++ b/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir
@@ -0,0 +1,24 @@
+// RUN: mlir-opt %s -test-lower-to-llvm | \
+// RUN: mlir-cpu-runner -e entry -entry-point-result=void  \
+// RUN:   -shared-libs=%mlir_c_runner_utils | \
+// RUN: FileCheck %s
+
+func.func @entry() {
+  %f1 = arith.constant 1.0 : f32
+  %f2 = arith.constant 2.0 : f32
+  %v1 = vector.splat %f1 : vector<2x4xf32>
+  %v2 = vector.splat %f2 :  vector<2x4xf32>
+  vector.print %v1 : vector<2x4xf32>
+  vector.print %v2 : vector<2x4xf32>
+  //
+  // Test vectors:
+  //
+  // CHECK: ( ( 1, 1, 1, 1 ), ( 1, 1, 1, 1 ) )
+  // CHECK: ( ( 2, 2, 2, 2 ), ( 2, 2, 2, 2 ) )
+
+  %v3 = vector.interleave %v1, %v2 : vector<2x4xf32>
+  vector.print %v3 : vector<2x8xf32>
+  // CHECK: ( ( 1, 2, 1, 2, 1, 2, 1, 2 ), ( 1, 2, 1, 2, 1, 2, 1, 2 ) )
+
+  return
+}

>From f7e4f7ee3dd16e512885c3301b5d8007ed1534ea Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Wed, 21 Feb 2024 15:29:42 +0000
Subject: [PATCH 2/3] Update
 mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir

Co-authored-by: Cullen Rhodes <cullen.rhodes at arm.com>
---
 mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir b/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir
index 69bf0320a36970..0bc78af6aba031 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/test-interleave.mlir
@@ -7,7 +7,7 @@ func.func @entry() {
   %f1 = arith.constant 1.0 : f32
   %f2 = arith.constant 2.0 : f32
   %v1 = vector.splat %f1 : vector<2x4xf32>
-  %v2 = vector.splat %f2 :  vector<2x4xf32>
+  %v2 = vector.splat %f2 : vector<2x4xf32>
   vector.print %v1 : vector<2x4xf32>
   vector.print %v2 : vector<2x4xf32>
   //

>From c4bdd120d759ab0d7da5de24ef9bc358044845f5 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Wed, 21 Feb 2024 15:29:49 +0000
Subject: [PATCH 3/3] Update
 mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir

Co-authored-by: Cullen Rhodes <cullen.rhodes at arm.com>
---
 .../Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
index fba23b24b8c910..8ae3eee6462ca7 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-interleave.mlir
@@ -7,7 +7,7 @@ func.func @entry() {
   %f1 = arith.constant 1.0 : f32
   %f2 = arith.constant 2.0 : f32
   %v1 = vector.splat %f1 : vector<[4]xf32>
-  %v2 = vector.splat %f2 :  vector<[4]xf32>
+  %v2 = vector.splat %f2 : vector<[4]xf32>
   vector.print %v1 : vector<[4]xf32>
   vector.print %v2 : vector<[4]xf32>
   //



More information about the Mlir-commits mailing list