[Mlir-commits] [mlir] [mlir][vector] Update ApplyVectorReductionToContractPatternsOp (PR #136699)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Apr 22 06:58:51 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-linalg
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/136699.diff
3 Files Affected:
- (modified) mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp (-4)
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir (+1)
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir (+1)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/136699
More information about the Mlir-commits
mailing list