Skip to content

Commit adfde79

Browse files
committed
[mlir][vector][nfc] Rename populateVectorTransferCollapseInnerMostContiguousDimsPatterns
Renames `populateVectorTransferCollapseInnerMostContiguousDimsPatterns` as `populateDropInnerMostUnitDimsXferOpPatterns` + updates the corresponding comments. This addresses a TODO and makes the difference between these two `populate*` methods clearer: * `populateDropUnitDimWithShapeCastPatterns`, * `populateDropInnerMostUnitDimsXferOpPatterns`,
1 parent 577199f commit adfde79

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ void populateVectorReductionToContractPatterns(RewritePatternSet &patterns,
137137
void populateVectorTransferFullPartialPatterns(
138138
RewritePatternSet &patterns, const VectorTransformsOptions &options);
139139

140-
/// Collect a set of patterns to reduce the rank of the operands of vector
141-
/// transfer ops to operate on the largest contigious vector.
142-
/// These patterns are useful when lowering to dialects with 1d vector type
143-
/// such as llvm and it will result fewer memory reads.
144-
void populateVectorTransferCollapseInnerMostContiguousDimsPatterns(
145-
RewritePatternSet &patterns, PatternBenefit benefit = 1);
140+
/// Collect a set of patterns to collapse the most inner unit dims in xfer Ops
141+
///
142+
/// These patters reduce the rank of the operands of vector transfer ops to
143+
/// operate on vectors without trailing unit dims. This helps reduce the rank of
144+
/// the operands, which can be helpful when lowering to dialects that only
145+
/// support 1D vector type such as LLVM.
146+
void populateDropInnerMostUnitDimsXferOpPatterns(RewritePatternSet &patterns,
147+
PatternBenefit benefit = 1);
146148

147149
/// Patterns that remove redundant Vector Ops by re-ordering them with
148150
/// e.g. elementwise Ops:

mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,11 +2266,6 @@ void mlir::vector::populateVectorMaskMaterializationPatterns(
22662266

22672267
void mlir::vector::populateDropUnitDimWithShapeCastPatterns(
22682268
RewritePatternSet &patterns, PatternBenefit benefit) {
2269-
// TODO: Consider either:
2270-
// * including DropInnerMostUnitDimsTransferRead and
2271-
// DropInnerMostUnitDimsTransferWrite, or
2272-
// * better naming to distinguish this and
2273-
// populateVectorTransferCollapseInnerMostContiguousDimsPatterns.
22742269
patterns.add<DropUnitDimFromElementwiseOps, DropUnitDimsFromScfForOp,
22752270
DropUnitDimsFromTransposeOp>(patterns.getContext(), benefit);
22762271
}
@@ -2305,9 +2300,8 @@ void mlir::vector::populateVectorReductionToContractPatterns(
23052300
patterns.getContext(), benefit);
23062301
}
23072302

2308-
void mlir::vector::
2309-
populateVectorTransferCollapseInnerMostContiguousDimsPatterns(
2310-
RewritePatternSet &patterns, PatternBenefit benefit) {
2303+
void mlir::vector::populateDropInnerMostUnitDimsXferOpPatterns(
2304+
RewritePatternSet &patterns, PatternBenefit benefit) {
23112305
patterns.add<DropInnerMostUnitDimsTransferRead,
23122306
DropInnerMostUnitDimsTransferWrite>(patterns.getContext(),
23132307
benefit);

mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ struct TestVectorTransferCollapseInnerMostContiguousDims
368368

369369
void runOnOperation() override {
370370
RewritePatternSet patterns(&getContext());
371-
populateVectorTransferCollapseInnerMostContiguousDimsPatterns(patterns);
371+
populateDropInnerMostUnitDimsXferOpPatterns(patterns);
372372
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
373373
}
374374
};

0 commit comments

Comments
 (0)