Skip to content

Commit 9a9c909

Browse files
qedawkinsGroverkss
authored andcommitted
[mlir][Tensor] Retain discardable attrs in pack(cast) folder (llvm#115772)
1 parent 348b936 commit 9a9c909

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mlir/test/Dialect/Tensor/canonicalize.mlir

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,7 +2750,10 @@ func.func @fold_cast_multiple_results(%arg0: tensor<2x2xf32>, %arg1: tensor<2x2x
27502750
// CHECK-SAME: %[[DEST:.*]]: tensor<1x1x8x1xi32>,
27512751
// CHECK-SAME: %[[SRC:.*]]: tensor<7x?xi32>,
27522752
// CHECK-SAME: %[[PAD:.*]]: i32) -> tensor<1x1x8x1xi32> {
2753-
// CHECK: %[[PACK:.*]] = tensor.pack %[[SRC]] padding_value(%[[PAD]] : i32) inner_dims_pos = [0, 1] inner_tiles = [8, 1] into %[[DEST]] : tensor<7x?xi32> -> tensor<1x1x8x1xi32>
2753+
// CHECK: %[[PACK:.*]] = tensor.pack %[[SRC]] padding_value(%[[PAD]] : i32)
2754+
// CHECK-SAME: inner_dims_pos = [0, 1] inner_tiles = [8, 1] into %[[DEST]]
2755+
// CHECK-SAME: some_attr
2756+
// CHECK-SAME: : tensor<7x?xi32> -> tensor<1x1x8x1xi32>
27542757
// CHECK: return %[[PACK]] : tensor<1x1x8x1xi32>
27552758
func.func @fold_cast_pack_dynamic_tile_size(
27562759
%dest: tensor<1x1x8x1xi32>,
@@ -2759,7 +2762,10 @@ func.func @fold_cast_pack_dynamic_tile_size(
27592762

27602763
%cast = tensor.cast %dest : tensor<1x1x8x1xi32> to tensor<1x1x?x1xi32>
27612764
%c8 = arith.constant 8 : index
2762-
%pack = tensor.pack %src padding_value(%pad : i32) inner_dims_pos = [0, 1] inner_tiles = [%c8, 1] into %cast : tensor<7x?xi32> -> tensor<1x1x?x1xi32>
2765+
%pack = tensor.pack %src padding_value(%pad : i32)
2766+
inner_dims_pos = [0, 1]
2767+
inner_tiles = [%c8, 1]
2768+
into %cast {some_attr} : tensor<7x?xi32> -> tensor<1x1x?x1xi32>
27632769
%res = tensor.cast %pack : tensor<1x1x?x1xi32> to tensor<1x1x8x1xi32>
27642770
return %res : tensor<1x1x8x1xi32>
27652771
}

0 commit comments

Comments
 (0)