-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[mlir][ArmSME][test] Make use of arm_sme.streaming_vl (NFC) #77322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
67170f7
to
e82c327
Compare
@llvm/pr-subscribers-mlir-linalg @llvm/pr-subscribers-mlir-sme Author: Benjamin Maxwell (MacDue) ChangesFull diff: https://github.com/llvm/llvm-project/pull/77322.diff 7 Files Affected:
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.
//
|
@llvm/pr-subscribers-mlir-vector Author: Benjamin Maxwell (MacDue) ChangesFull diff: https://github.com/llvm/llvm-project/pull/77322.diff 7 Files Affected:
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.
//
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the clean-up!
This does make me think that we should introduce some tests comparing SVE and SSVE.
No description provided.