[Mlir-commits] [mlir] [mlir][SME] Update E2E test to show potential optimisation (NFC) (PR #107585)
Hugo Trachino
llvmlistbot at llvm.org
Mon Sep 9 06:11:05 PDT 2024
https://github.com/nujaa updated https://github.com/llvm/llvm-project/pull/107585
>From b7d6b764e843a0c7380713e6738ec40ae1fbe463 Mon Sep 17 00:00:00 2001
From: Hugo <hugo.trachino at huawei.com>
Date: Mon, 2 Sep 2024 17:26:12 +0800
Subject: [PATCH 1/3] [mlir][SME] Update E2E test to show potential
optimisation (NFC)
---
.../Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir | 8 ++++++++
.../Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
index a57348a543c3cf..886211b65efa2d 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
@@ -82,8 +82,16 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns to %func {
transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
transform.apply_patterns.vector.lower_masks
+ transform.apply_patterns.canonicalization
} : !transform.any_op
+ // Step 5: Hoist load of accumulator.
+ %func_h = transform.structured.hoist_redundant_vector_transfers %func
+ : (!transform.any_op) -> !transform.any_op
+ %all_loops = transform.structured.match interface{LoopLikeInterface} in %module
+ : (!transform.any_op) -> !transform.any_op
+ transform.apply_licm to %all_loops : !transform.any_op
+ transform.loop.hoist_loop_invariant_subsets %all_loops : !transform.any_op
transform.yield
}
}
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
index 79c9fcac70604b..4b6b9a9c746499 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
@@ -88,8 +88,16 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
transform.apply_patterns.vector.lower_masks
transform.apply_patterns.vector.rank_reducing_subview_patterns
+ transform.apply_patterns.canonicalization
} : !transform.any_op
+ // Step 6: Hoist load of accumulator.
+ %func_h = transform.structured.hoist_redundant_vector_transfers %func
+ : (!transform.any_op) -> !transform.any_op
+ %all_loops = transform.structured.match interface{LoopLikeInterface} in %bufferize
+ : (!transform.any_op) -> !transform.any_op
+ transform.apply_licm to %all_loops : !transform.any_op
+ transform.loop.hoist_loop_invariant_subsets %all_loops : !transform.any_op
transform.yield
}
}
>From b6cc59147fae1b2f16d3ebacf966361e8a2ac92e Mon Sep 17 00:00:00 2001
From: Hugo <hugo.trachino at huawei.com>
Date: Mon, 9 Sep 2024 18:32:09 +0800
Subject: [PATCH 2/3] fixup! [mlir][SME] Update E2E test to show potential
optimisation (NFC)
---
.../Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir | 2 +-
mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
index 886211b65efa2d..ba5e5e2c7b6793 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
@@ -85,7 +85,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.canonicalization
} : !transform.any_op
- // Step 5: Hoist load of accumulator.
+ // Step 5 (optionnal): Hoist accumulator load/store.
%func_h = transform.structured.hoist_redundant_vector_transfers %func
: (!transform.any_op) -> !transform.any_op
%all_loops = transform.structured.match interface{LoopLikeInterface} in %module
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
index 4b6b9a9c746499..5145a59f2150ac 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
@@ -91,7 +91,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.canonicalization
} : !transform.any_op
- // Step 6: Hoist load of accumulator.
+ // Step 6 (optionnal): Hoist accumulator load/store.
%func_h = transform.structured.hoist_redundant_vector_transfers %func
: (!transform.any_op) -> !transform.any_op
%all_loops = transform.structured.match interface{LoopLikeInterface} in %bufferize
>From 784ee2d30f33640d719ead5e754f4134bd20e038 Mon Sep 17 00:00:00 2001
From: Hugo <hugo.trachino at huawei.com>
Date: Mon, 9 Sep 2024 21:10:51 +0800
Subject: [PATCH 3/3] fixup! fixup! [mlir][SME] Update E2E test to show
potential optimisation (NFC)
---
.../Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir | 2 +-
mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
index ba5e5e2c7b6793..06a6e2279b6a75 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
@@ -85,7 +85,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.canonicalization
} : !transform.any_op
- // Step 5 (optionnal): Hoist accumulator load/store.
+ // Step 5 (optional optimization): Hoist accumulator load/store.
%func_h = transform.structured.hoist_redundant_vector_transfers %func
: (!transform.any_op) -> !transform.any_op
%all_loops = transform.structured.match interface{LoopLikeInterface} in %module
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
index 5145a59f2150ac..29b0bc0c196061 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
@@ -91,7 +91,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.canonicalization
} : !transform.any_op
- // Step 6 (optionnal): Hoist accumulator load/store.
+ // Step 6 (optional optimization): Hoist accumulator load/store.
%func_h = transform.structured.hoist_redundant_vector_transfers %func
: (!transform.any_op) -> !transform.any_op
%all_loops = transform.structured.match interface{LoopLikeInterface} in %bufferize
More information about the Mlir-commits
mailing list