Skip to content

Commit 2b22047

Browse files
committed
Address comments from HanHan
Note, I deleted `getUnPackInverseSrcPerm(UnPackOp unpackOp)` - I couldn't find any uses of that hook.
1 parent 182bb0c commit 2b22047

File tree

4 files changed

+9
-29
lines changed

4 files changed

+9
-29
lines changed

mlir/include/mlir/Dialect/Linalg/Utils/Utils.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,13 @@ namespace linalg {
3333
//===----------------------------------------------------------------------===//
3434
// Utilities for inferring various semantics properties of Linalg ops.
3535
//===----------------------------------------------------------------------===//
36-
/// Shell function to compute the Destination Permutation of PackOp
37-
/// This function uses the helper function `computePackUnPackPerm` to get
38-
/// the permutation vector. Only major difference between UnPack and Pack is
39-
/// that packOp uses destination rank whereas unpack Uses source rank.
36+
/// Compute inverse permutation for the destination tensor (i.e. in the packed
37+
/// domain).
4038
SmallVector<int64_t> getPackInverseDestPerm(linalg::PackOp packOp,
41-
PackingMetadata &metadatap);
42-
43-
/// Shell function to compute the Source Permutation of unPackOp.
44-
/// This function, like the getPackInverseDestPerm uses the helper function
45-
/// computePackUnPackPerm` to get the permutation vector.
46-
/// Only major difference between UnPack and Pack is that packOp uses
47-
/// destination rank whereas unpack Uses source rank.
48-
SmallVector<int64_t> getUnPackInverseSrcPerm(linalg::UnPackOp unpackOp);
49-
50-
/// Shell function to compute the Source rank permutation for unpackOp
51-
/// Unpack requires some packing metadata data information, so created
52-
/// another function where this value is passed by reference.
39+
PackingMetadata &metadata);
40+
41+
/// Compute inverse permutation for the source tensor (i.e. in the packed
42+
/// domain).
5343
SmallVector<int64_t> getUnPackInverseSrcPerm(linalg::UnPackOp,
5444
PackingMetadata &metadata);
5545

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ vectorizeAsTensorPackOp(RewriterBase &rewriter, linalg::PackOp packOp,
18611861
if (writeVectorSizes.empty()) {
18621862
if (ShapedType::isDynamicShape(destShape))
18631863
return rewriter.notifyMatchFailure(packOp,
1864-
"Unable to infer vector sizes!");
1864+
"unable to infer vector sizes");
18651865

18661866
writeVectorSizes = destShape;
18671867
useInBoundsInsteadOfMasking = true;

mlir/lib/Dialect/Linalg/Utils/Utils.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,16 @@ namespace mlir {
172172
namespace linalg {
173173

174174
SmallVector<int64_t> getPackInverseDestPerm(PackOp packOp,
175-
PackingMetadata &pMetadata) {
175+
PackingMetadata &metadata) {
176176

177177
int64_t packedRank = packOp.getDestType().getRank();
178178
ArrayRef<int64_t> innerDimPos = packOp.getInnerDimsPos();
179179
ArrayRef<int64_t> outerPerm = packOp.getOuterDimsPerm();
180180
SmallVector<int64_t> packInvDestPerm =
181-
computePackUnPackPerm(packedRank, innerDimPos, outerPerm, pMetadata);
181+
computePackUnPackPerm(packedRank, innerDimPos, outerPerm, metadata);
182182
return packInvDestPerm;
183183
}
184184

185-
SmallVector<int64_t> getUnPackInverseSrcPerm(UnPackOp unpackOp) {
186-
PackingMetadata metadata;
187-
return getUnPackInverseSrcPerm(unpackOp, metadata);
188-
}
189-
190185
SmallVector<int64_t> getUnPackInverseSrcPerm(UnPackOp unpackOp,
191186
PackingMetadata &metadata) {
192187
int64_t packedRank = unpackOp.getSourceType().getRank();

mlir/test/Dialect/Linalg/vectorization/linalg-ops.mlir

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,12 +1427,10 @@ module attributes {transform.with_named_sequence} {
14271427
func.func @pack_with_dynamic_dims(
14281428
%src: tensor<?x?xf32>,
14291429
%dest: tensor<?x?x16x2xf32>) -> tensor<?x?x16x2xf32> {
1430-
14311430
%pack = linalg.pack %src
14321431
inner_dims_pos = [1, 0]
14331432
inner_tiles = [16, 2]
14341433
into %dest : tensor<?x?xf32> -> tensor<?x?x16x2xf32>
1435-
14361434
return %pack : tensor<?x?x16x2xf32>
14371435
}
14381436

@@ -1492,14 +1490,11 @@ module attributes {transform.with_named_sequence} {
14921490
func.func @pack_with_dynamic_dims_and_dynamic_inner_tile(
14931491
%src: tensor<?x?xf32>,
14941492
%dest: tensor<?x?x?x2xf32>) -> tensor<?x?x?x2xf32> {
1495-
14961493
%c16 = arith.constant 16 : index
1497-
14981494
%pack = linalg.pack %src
14991495
inner_dims_pos = [1, 0]
15001496
inner_tiles = [%c16, 2]
15011497
into %dest : tensor<?x?xf32> -> tensor<?x?x?x2xf32>
1502-
15031498
return %pack : tensor<?x?x?x2xf32>
15041499
}
15051500

0 commit comments

Comments
 (0)