[Mlir-commits] [mlir] [mlir][vector] Update ApplyVectorReductionToContractPatternsOp (PR #136699)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Apr 22 06:58:11 PDT 2025
https://github.com/banach-space created https://github.com/llvm/llvm-project/pull/136699
This PR removes the use of `populateSinkVectorOpsPatterns` from the
definition of:
* `transform.apply_patterns.vector.reduction_to_contract`
As of #131462, there is now a dedicated transform op for this pattern:
* `transform.apply_patterns.vector.sink_op`
Given that, we should now use the new TD op directly instead of relying
on unrelated TD ops to include it.
NOTE TO DOWNSTREAM USERS:
Please add the following to your TD scripts:
* `transform.apply_patterns.vector.sink_op`
See the updated test for an example.
>From a1cc0f9c050ef7681ac66659c2e2a0d4c5f415ed Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Tue, 22 Apr 2025 13:47:56 +0000
Subject: [PATCH] [mlir][vector] Update
ApplyVectorReductionToContractPatternsOp
This PR removes the use of `populateSinkVectorOpsPatterns` from the
definition of:
* `transform.apply_patterns.vector.reduction_to_contract`
As of #131462, there is now a dedicated transform op for this pattern:
* `transform.apply_patterns.vector.sink_op`
Given that, we should now use the new TD op directly instead of relying
on unrelated TD ops to include it.
NOTE TO DOWNSTREAM USERS:
Please add the following to your TD scripts:
* `transform.apply_patterns.vector.sink_op`
See the updated test for an example.
---
mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp | 4 ----
mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir | 1 +
.../Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir | 1 +
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
index 12dcf768dd928..adc1dd437326f 100644
--- a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
+++ b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
@@ -67,10 +67,6 @@ void transform::ApplyFoldElementwiseToVectorPatternsOp::populatePatterns(
void transform::ApplyVectorReductionToContractPatternsOp::populatePatterns(
RewritePatternSet &patterns) {
vector::populateVectorReductionToContractPatterns(patterns);
-
- // TODO: As we now have a dedicated transform for
- // `populateSinkVectorOpsPatterns` we can remove it from here.
- vector::populateSinkVectorOpsPatterns(patterns);
}
void transform::ApplyLowerCreateMaskPatternsOp::populatePatterns(
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
index 29b0bc0c19606..ad7dbb9f7e126 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
@@ -79,6 +79,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.vector.lower_masked_transfers
transform.apply_patterns.vector.transfer_permutation_patterns
transform.apply_patterns.vector.reduction_to_contract
+ transform.apply_patterns.vector.sink_ops
} : !transform.any_op
// Step 5: Lower vector.contract to vector.outerproduct. Also drop unit
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
index 78815a38612e9..71798a6affbbc 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
@@ -94,6 +94,7 @@ module attributes {transform.with_named_sequence} {
transform.apply_patterns.vector.lower_masked_transfers
transform.apply_patterns.vector.transfer_permutation_patterns
transform.apply_patterns.vector.reduction_to_contract
+ transform.apply_patterns.vector.sink_ops
} : !transform.any_op
// Step 5: Lower vector.contract to vector.outerproduct. Also drop unit
More information about the Mlir-commits
mailing list