[Mlir-commits] [mlir] [mlir][ArmSME][test] Make use of arm_sme.streaming_vl (NFC) (PR #77322)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Jan 10 02:27:44 PST 2024


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

>From e82c327304143931b663605426d802715f1f2176 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Mon, 8 Jan 2024 14:30:42 +0000
Subject: [PATCH] [mlir][ArmSME][test] Make use of `arm_sme.streaming_vl` (NFC)

---
 .../Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir |  5 +----
 .../Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir  |  4 +---
 .../Vector/CPU/ArmSME/test-transfer-read-2d.mlir       |  9 +--------
 .../Vector/CPU/ArmSME/test-transfer-write-2d.mlir      |  9 +--------
 .../Dialect/Vector/CPU/ArmSME/test-transpose.mlir      |  4 +---
 .../Dialect/Vector/CPU/ArmSME/vector-load-store.mlir   | 10 ++--------
 .../Dialect/Vector/CPU/ArmSME/vector-ops.mlir          |  5 +----
 7 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
index 81546de6a3466b..6314e6f279952b 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
@@ -20,12 +20,9 @@ func.func @entry() {
 
   %c123_f32 = arith.constant 123.0 : f32
 
-  %min_elts_s = arith.constant 4 : index
-  %vscale = vector.vscale
-
   // "svl" refers to the Streaming Vector Length and "svl_s" the number of
   // 32-bit elements in a vector of SVL bits.
-  %svl_s = arith.muli %min_elts_s, %vscale : index
+  %svl_s = arm_sme.streaming_vl <word>
 
   %tile_init = bufferization.alloc_tensor(%svl_s, %svl_s) : tensor<?x?xf32>
 
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir
index 936163d1cd30d9..064141c349241e 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir
@@ -17,9 +17,7 @@ func.func @entry() {
   %c1_i32 = arith.constant 1 : i32
 
   // Calculate the size of a 32-bit tile, e.g. ZA{n}.s.
-  %vscale = vector.vscale
-  %min_elts_s = arith.constant 4 : index
-  %svl_s = arith.muli %min_elts_s, %vscale : index
+  %svl_s = arm_sme.streaming_vl <word>
   %za_s_size = arith.muli %svl_s, %svl_s : index
 
   // Allocate memory.
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-read-2d.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-read-2d.mlir
index 839aed2e840c90..6e028d5fb83614 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-read-2d.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-read-2d.mlir
@@ -134,12 +134,6 @@ func.func @initialize_memory(%d0 : index, %d1 : index) -> memref<?x?xf32> {
   return %A : memref<?x?xf32>
 }
 
-// This will be made a streaming function by enable-arm-streaming so return SVL.
-func.func @get_svl() -> index {
-  %vscale = vector.vscale
-  return %vscale : index
-}
-
 func.func @entry() {
   %c0 = arith.constant 0 : index
   %c1 = arith.constant 1 : index
@@ -148,8 +142,7 @@ func.func @entry() {
 
   // Allocate enough memory to load a 32-bit tile plus a tiny bit more to test
   // non-zero offsets while remaining inbounds.
-  %svl = call @get_svl() : () -> index
-  %svl_s = arith.muli %c4, %svl : index
+  %svl_s = arm_sme.streaming_vl <word>
   %svl_s_plus_two = arith.addi %svl_s, %c2 : index
 
   %A = call @initialize_memory(%svl_s_plus_two, %svl_s_plus_two) : (index, index) -> memref<?x?xf32>
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-write-2d.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-write-2d.mlir
index 84246606daa8af..cb30fee4e12d72 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-write-2d.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transfer-write-2d.mlir
@@ -96,12 +96,6 @@ func.func @initialize_memory(%d0 : index, %d1 : index) -> memref<?x?xf32> {
   return %A : memref<?x?xf32>
 }
 
-// This will be made a streaming function by enable-arm-streaming so return SVL.
-func.func @get_svl() -> index {
-  %vscale = vector.vscale
-  return %vscale : index
-}
-
 func.func @entry() {
   %c0 = arith.constant 0 : index
   %c2 = arith.constant 2 : index
@@ -111,8 +105,7 @@ func.func @entry() {
   //
   // Allocate enough memory to load a 32-bit tile plus a tiny bit more to test
   // non-zero offsets while remaining inbounds.
-  %svl = call @get_svl() : () -> index
-  %svl_s = arith.muli %c4, %svl : index
+  %svl_s = arm_sme.streaming_vl <word>
   %svl_s_plus_two = arith.addi %svl_s, %c2 : index
   %A = call @initialize_memory(%svl_s_plus_two, %svl_s_plus_two) : (index, index) -> memref<?x?xf32>
 
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transpose.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transpose.mlir
index 2751c2d136485e..eee3c56351d81e 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transpose.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-transpose.mlir
@@ -17,9 +17,7 @@ func.func @entry() {
   %c1_i32 = arith.constant 1 : i32
 
   // Calculate the size of a 32-bit tile, e.g. ZA{n}.s.
-  %vscale = vector.vscale
-  %min_elts_s = arith.constant 4 : index
-  %svl_s = arith.muli %min_elts_s, %vscale : index
+  %svl_s = arm_sme.streaming_vl <word>
   %za_s_size = arith.muli %svl_s, %svl_s : index
 
   // Allocate memory.
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-load-store.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-load-store.mlir
index 5d2d0a73992f1e..2f151e2ec72fb7 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-load-store.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-load-store.mlir
@@ -24,12 +24,9 @@ func.func @za0_d_f64() -> i32 {
   %c1_f64 = arith.constant 1.0 : f64
   %c1_index = arith.constant 1 : index
 
-  %min_elts_d = arith.constant 2 : index
-  %vscale = vector.vscale
-
   // "svl" refers to the Streaming Vector Length and "svl_d" the number of
   // 64-bit elements in a vector of SVL bits.
-  %svl_d = arith.muli %min_elts_d, %vscale : index
+  %svl_d = arm_sme.streaming_vl <double>
 
   // Allocate "mem1" and fill each "row" with row number.
   //
@@ -170,13 +167,10 @@ func.func @load_store_two_za_s_tiles() -> i32 {
   %c1_index = arith.constant 1 : index
   %c2_index = arith.constant 2 : index
 
-  %min_elts_s = arith.constant 4 : index
-  %vscale = vector.vscale
-
   // "svl" refers to the Streaming Vector Length and "svl_s" can mean either:
   // * the number of 32-bit elements in a vector of SVL bits.
   // * the number of tile slices (1d vectors) in a 32-bit element tile.
-  %svl_s = arith.muli %min_elts_s, %vscale : index
+  %svl_s = arm_sme.streaming_vl <word>
 
   // Allocate memory for two 32-bit element tiles.
   %size_of_tile = arith.muli %svl_s, %svl_s : index
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-ops.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-ops.mlir
index af5fe236e5bd57..073c08bff1c415 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-ops.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-ops.mlir
@@ -14,12 +14,9 @@ func.func @entry() -> i32 {
   %c1_i8 = arith.constant 1 : i8
   %c1_index = arith.constant 1 : index
 
-  %c16 = arith.constant 16 : index
-  %vscale = vector.vscale
-
   // "svl" refers to the Streaming Vector Length and "svl_b" the number of
   // 8-bit elements in a vector of SVL bits.
-  %svl_b = arith.muli %c16, %vscale : index
+  %svl_b = arm_sme.streaming_vl <byte>
 
   // Allocate memory and fill with ones.
   //



More information about the Mlir-commits mailing list