Skip to content

Commit b39f566

Browse files
authored
[mlir][ArmSME] Add test-lower-to-arm-sme pipeline (#81732)
The ArmSME compilation pipeline has evolved significantly and is now sufficiently complex enough that it warrants a proper lowering pipeline that encapsulates the various passes and orderings. Currently the pipeline is loosely defined in our integration tests, but these have diverged and are not using the same passes or ordering everywhere. This patch introduces a test-lower-to-arm-sme pipeline mirroring test-lower-to-llvm that provides some sanity when running e2e examples and can be used a reference for targeting ArmSME in MLIR. All the integration tests are updated to use this pipeline. The intention is to productize the pipeline once it becomes more mature.
1 parent a622b21 commit b39f566

23 files changed

+141
-103
lines changed

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
// RUN: mlir-opt %s \
2-
// RUN: -transform-interpreter \
3-
// RUN: -test-transform-dialect-erase-schedule \
2+
// RUN: -transform-interpreter -test-transform-dialect-erase-schedule \
43
// RUN: -lower-vector-mask \
54
// RUN: -one-shot-bufferize="bufferize-function-boundaries" \
6-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za" \
7-
// RUN: -convert-vector-to-arm-sme -convert-arith-to-arm-sme \
8-
// RUN: -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
9-
// RUN: -convert-arm-sme-to-llvm -cse -canonicalize \
10-
// RUN: -test-lower-to-llvm | \
5+
// RUN: -test-lower-to-arm-sme -test-lower-to-llvm | \
116
// RUN: %mcr_aarch64_cmd \
127
// RUN: -e=entry -entry-point-result=void \
138
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// RUN: mlir-opt %s \
22
// RUN: -transform-interpreter -test-transform-dialect-erase-schedule \
3-
// RUN: -one-shot-bufferize="bufferize-function-boundaries" -canonicalize \
4-
// RUN: -convert-vector-to-arm-sme -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
5-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
6-
// RUN: -convert-vector-to-scf -cse -arm-sve-legalize-vector-storage \
7-
// RUN: -convert-arm-sme-to-llvm \
8-
// RUN: -convert-vector-to-llvm=enable-arm-sve \
9-
// RUN: -cse -canonicalize -test-lower-to-llvm | \
3+
// RUN: -one-shot-bufferize="bufferize-function-boundaries" \
4+
// RUN: -test-lower-to-arm-sme -test-lower-to-llvm | \
105
// RUN: %mcr_aarch64_cmd \
116
// RUN: -e=main -entry-point-result=void \
127
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
// RUN: mlir-opt %s \
22
// RUN: -transform-interpreter -test-transform-dialect-erase-schedule \
3-
// RUN: -canonicalize \
4-
// RUN: -convert-vector-to-arm-sme -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
5-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
6-
// RUN: -convert-vector-to-scf -cse -arm-sve-legalize-vector-storage \
7-
// RUN: -convert-arm-sme-to-llvm \
8-
// RUN: -convert-vector-to-llvm=enable-arm-sve \
9-
// RUN: -cse -canonicalize -test-lower-to-llvm | \
3+
// RUN: -test-lower-to-arm-sme -test-lower-to-llvm | \
104
// RUN: %mcr_aarch64_cmd \
115
// RUN: -e=main -entry-point-result=void \
126
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
// RUN: mlir-opt %s \
22
// RUN: -transform-interpreter -test-transform-dialect-erase-schedule \
33
// RUN: -one-shot-bufferize="bufferize-function-boundaries" -canonicalize \
4-
// RUN: -arm-sme-vector-legalization -canonicalize -cse \
5-
// RUN: -convert-vector-to-arm-sme -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
6-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
7-
// RUN: -convert-vector-to-scf=full-unroll -convert-arm-sme-to-llvm \
8-
// RUN: -test-lower-to-llvm | \
4+
// RUN: -test-lower-to-arm-sme -test-lower-to-llvm | \
95
// RUN: %mcr_aarch64_cmd \
106
// RUN: -e=main -entry-point-result=void \
117
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
// RUN: mlir-opt %s \
2-
// RUN: -convert-vector-to-arm-sme -convert-arith-to-arm-sme \
3-
// RUN: -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
4-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
5-
// RUN: -convert-vector-to-scf -cse -arm-sve-legalize-vector-storage \
6-
// RUN: -convert-arm-sme-to-llvm -convert-vector-to-llvm=enable-arm-sve -cse \
7-
// RUN: -canonicalize -test-lower-to-llvm -verify-diagnostics | \
2+
// RUN: -test-lower-to-arm-sme -test-lower-to-llvm -verify-diagnostics | \
83
// RUN: %mcr_aarch64_cmd \
94
// RUN: -e=main -entry-point-result=void \
105
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Vector/CPU/ArmSME/load-store-128-bit-tile.mlir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// DEFINE: %{entry_point} = test_load_store_zaq0
2-
// DEFINE: %{compile} = mlir-opt %s \
3-
// DEFINE: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za" \
4-
// DEFINE: -convert-vector-to-arm-sme -convert-arm-sme-to-scf \
5-
// DEFINE: -convert-arm-sme-to-llvm -cse -canonicalize \
6-
// DEFINE: -allocate-arm-sme-tiles -test-lower-to-llvm
2+
// DEFINE: %{compile} = mlir-opt %s -test-lower-to-arm-sme -test-lower-to-llvm
73
// DEFINE: %{run} = %mcr_aarch64_cmd \
84
// DEFINE: -march=aarch64 -mattr=+sve,+sme \
95
// DEFINE: -e %{entry_point} -entry-point-result=void \

mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-load-vertical.mlir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// DEFINE: %{entry_point} = entry
2-
// DEFINE: %{compile} = mlir-opt %s \
3-
// DEFINE: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za" \
4-
// DEFINE: -convert-vector-to-arm-sme -convert-arm-sme-to-scf -allocate-arm-sme-tiles \
5-
// DEFINE: -convert-arm-sme-to-llvm -cse -canonicalize \
6-
// DEFINE: -test-lower-to-llvm
2+
// DEFINE: %{compile} = mlir-opt %s -test-lower-to-arm-sme -test-lower-to-llvm
73
// DEFINE: %{run} = %mcr_aarch64_cmd \
84
// DEFINE: -march=aarch64 -mattr=+sve,+sme \
95
// DEFINE: -e %{entry_point} -entry-point-result=void \

mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-multi-tile-transpose.mlir

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
// RUN: mlir-opt %s -arm-sme-vector-legalization -cse -canonicalize \
2-
// RUN: -convert-vector-to-arm-sme -allocate-arm-sme-tiles -convert-arm-sme-to-scf \
3-
// RUN: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
4-
// RUN: -convert-vector-to-scf -cse -arm-sve-legalize-vector-storage \
5-
// RUN: -convert-arm-sme-to-llvm \
6-
// RUN: -convert-vector-to-llvm=enable-arm-sve \
7-
// RUN: -cse -canonicalize -test-lower-to-llvm | \
1+
// RUN: mlir-opt %s -test-lower-to-arm-sme -test-lower-to-llvm | \
82
// RUN: %mcr_aarch64_cmd \
93
// RUN: -e=main -entry-point-result=void \
104
// RUN: -march=aarch64 -mattr="+sve,+sme" \

mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-outerproduct-f16f16f32.mlir

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1+
// DEFINE: %{opts} =
12
// DEFINE: %{entry} = main
2-
// DEFINE: %{fusion_opts} = -arm-sme-outer-product-fusion
33
// DEFINE: %{compile} = mlir-opt %s \
4-
// DEFINE: -convert-vector-to-arm-sme -convert-arith-to-arm-sme %{fusion_opts} \
5-
// DEFINE: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za only-if-required-by-ops" \
6-
// DEFINE: -convert-arm-sme-to-scf -allocate-arm-sme-tiles \
7-
// DEFINE: -convert-arm-sme-to-llvm -cse -canonicalize \
8-
// DEFINE: -test-lower-to-llvm -o %t
4+
// DEFINE: -test-lower-to-arm-sme=%{opts} -test-lower-to-llvm -o %t
95
// DEFINE: %{run} = %mcr_aarch64_cmd %t \
106
// DEFINE: -march=aarch64 -mattr=+sve,+sme \
117
// DEFINE: -e %{entry} -entry-point-result=void \
@@ -18,7 +14,7 @@
1814
// Check result is the same when outerproducts are not combined into widening
1915
// variant.
2016

21-
// REDEFINE: %{fusion_opts} =
17+
// REDEFINE: %{opts} = fuse-outer-products=false
2218
// RUN: %{run} | FileCheck %s
2319

2420
func.func @main() {

mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-outerproduct-f32.mlir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// DEFINE: %{entry_point} = test_outerproduct_no_accumulator_4x4xf32
22
// DEFINE: %{compile} = mlir-opt %s \
3-
// DEFINE: -enable-arm-streaming="streaming-mode=streaming-locally za-mode=new-za" \
4-
// DEFINE: -convert-vector-to-arm-sme -convert-arith-to-arm-sme \
5-
// DEFINE: -convert-arm-sme-to-scf -allocate-arm-sme-tiles \
6-
// DEFINE: -convert-arm-sme-to-llvm -cse -canonicalize \
7-
// DEFINE: -test-lower-to-llvm -o %t
3+
// DEFINE: -test-lower-to-arm-sme -test-lower-to-llvm -o %t
84
// DEFINE: %{run} = %mcr_aarch64_cmd %t \
95
// DEFINE: -march=aarch64 -mattr=+sve,+sme \
106
// DEFINE: -e %{entry_point} -entry-point-result=void \

0 commit comments

Comments
 (0)