Skip to content

Commit e512833

Browse files
authoredApr 22, 2025
[mlir][vector] Update ApplyVectorReductionToContractPatternsOp (#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.
1 parent 718a509 commit e512833

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed
 

‎mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ void transform::ApplyFoldElementwiseToVectorPatternsOp::populatePatterns(
6767
void transform::ApplyVectorReductionToContractPatternsOp::populatePatterns(
6868
RewritePatternSet &patterns) {
6969
vector::populateVectorReductionToContractPatterns(patterns);
70-
71-
// TODO: As we now have a dedicated transform for
72-
// `populateSinkVectorOpsPatterns` we can remove it from here.
73-
vector::populateSinkVectorOpsPatterns(patterns);
7470
}
7571

7672
void transform::ApplyLowerCreateMaskPatternsOp::populatePatterns(

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

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ module attributes {transform.with_named_sequence} {
7979
transform.apply_patterns.vector.lower_masked_transfers
8080
transform.apply_patterns.vector.transfer_permutation_patterns
8181
transform.apply_patterns.vector.reduction_to_contract
82+
transform.apply_patterns.vector.sink_ops
8283
} : !transform.any_op
8384

8485
// Step 5: Lower vector.contract to vector.outerproduct. Also drop unit

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

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ module attributes {transform.with_named_sequence} {
9494
transform.apply_patterns.vector.lower_masked_transfers
9595
transform.apply_patterns.vector.transfer_permutation_patterns
9696
transform.apply_patterns.vector.reduction_to_contract
97+
transform.apply_patterns.vector.sink_ops
9798
} : !transform.any_op
9899

99100
// Step 5: Lower vector.contract to vector.outerproduct. Also drop unit

0 commit comments

Comments
 (0)