[Mlir-commits] [mlir] [mlir][linalg][nfc] Update "pack-dynamic-inner-tile.mlir" (PR #117533)

Andrzej Warzyński llvmlistbot at llvm.org
Mon Nov 25 10:16:56 PST 2024


================
@@ -89,26 +85,49 @@ module @transforms attributes { transform.with_named_sequence } {
     %tiled_pack_op_p, %loops:2 = transform.structured.tile_using_for %pack tile_sizes [1, 1]
        : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)
 
-    // 2. Decompose the tiled Op into (trimmed for brevity):
+    // 2. Decompose the tiled pack Op into (trimmed for brevity):
     //
     //  %padded = tensor.pad %slice_of_A (..) :
     //      tensor<?x?xi32> to tensor<8x1xi32>
     //  %inserted_slice = tensor.insert_slice %padded into %slice_of_A_pack (...) :
     //      tensor<8x1xi32> into tensor<1x1x?x1xi32>
     //
-    // NOTE: no tile is transposed, hence no linalg.transpose
-    %func_1 = transform.get_parent_op %tiled_pack_op_p {isolated_from_above} : (!transform.any_op) -> !transform.any_op
-    transform.apply_patterns to %func_1 {
+    // (NOTE: no tile is transposed, hence no linalg.transpose)
----------------
banach-space wrote:

In this example, note that no dimensions are transposed:

* `inner_dims_pos` is an identity.
* There's no `outer_dims_perm` (so it's also an identity).

Referring to the original `tensor.pack`:

* We start with `tensor<7x16xi32>` and tile:
  * Dimension `7` using `%tile_size` (which is `%c8`).
  * Dimension `16` using `1`.
* This results in `?x1` as the **trailing/inner dimensions** in the output tensor.
* The remaining dimensions form `?x16` as the **outer dimensions** in the output tensor:
  * `?` corresponds to the tiling along `7`.
  * `16` comes from the calculation `original_dim` / `tile_size` = 16 / 1 = 16.

Does this make sense? Let me know if anything needs clarification - I want to ensure I'm explaining this correctly 😅.

https://github.com/llvm/llvm-project/pull/117533


More information about the Mlir-commits mailing list