Skip to content

Commit 1f44ee1

Browse files
committed
(linalg.pack): clarify comments and test names
1 parent eae9f99 commit 1f44ee1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgRelayoutOps.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ class Linalg_RelayoutOp<string mnemonic, list<Trait> traits = []> :
5757
/// tile factors.
5858
DenseMap<int64_t, OpFoldResult> getDimAndTileMapping();
5959

60+
// TODO: Return the folded result.
6061
/// Return the tile sizes as OpFoldResult. Will return the Value
6162
/// of the constant Op, not the constant Attribute.
63+
/// E.g., for %size = arith.constant 1 : i32 will return %size,
64+
/// not 1.
6265
SmallVector<OpFoldResult> getMixedTiles();
6366

6467
/// Return the tile sizes as `int64_t`. If a tile size is dynamic

mlir/test/Dialect/Linalg/decompose-pack.mlir

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,14 @@ func.func @pack_with_adjacent_trailing_dimensions_inner_dims_pos_and_unit_outer(
277277

278278
// -----
279279

280-
func.func @pack_with_zero_pos_tile_size(%arg0: tensor<8x1x1x1xf32>, %arg1:tensor<1x1x1x1x8x1xf32>) -> tensor<1x1x1x1x8x1xf32> {
280+
// The following example shows a pack operation where the inner dims
281+
// positions are non-adjacent and non-permuted.
282+
func.func @pack_with_non_adjacent_and_non_permuted_inner_dims(%arg0: tensor<8x1x1x1xf32>, %arg1:tensor<1x1x1x1x8x1xf32>) -> tensor<1x1x1x1x8x1xf32> {
281283
%pack = linalg.pack %arg0 outer_dims_perm = [0, 1, 2, 3] inner_dims_pos = [0, 3] inner_tiles = [8, 1] into %arg1: tensor<8x1x1x1xf32> -> tensor<1x1x1x1x8x1xf32>
282284
return %pack : tensor<1x1x1x1x8x1xf32>
283285
}
284286

285-
// CHECK-LABEL: func.func @pack_with_zero_pos_tile_size
287+
// CHECK-LABEL: func.func @pack_with_non_adjacent_and_non_permuted_inner_dims
286288
// CHECK-SAME: %[[SRC:[a-zA-Z0-9]+]]
287289
// CHECK-SAME: %[[DEST:[a-zA-Z0-9]+]]
288290
// CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<1x1x8x1xf32>
@@ -292,4 +294,4 @@ func.func @pack_with_zero_pos_tile_size(%arg0: tensor<8x1x1x1xf32>, %arg1:tensor
292294
// CHECK-SAME: permutation = [1, 2, 0, 3]
293295
// CHECK: %[[INSERT:.+]] = tensor.insert_slice %[[TRANSP]] into %[[DEST]]
294296
// CHECK-SAME: [0, 0, 0, 0, 0, 0] [1, 1, 1, 1, 8, 1] [1, 1, 1, 1, 1, 1] : tensor<1x1x8x1xf32> into tensor<1x1x1x1x8x1xf32>
295-
// CHECK: return %[[INSERT]]
297+
// CHECK: return %[[INSERT]]

0 commit comments

Comments
 (0)