[Mlir-commits] [mlir] [mlir][linalg] Update pack and unpack documentation (PR #143903)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jun 12 14:41:03 PDT 2025


================
@@ -117,6 +119,16 @@ def Linalg_PackOp : Linalg_RelayoutOp<"pack", [
         into %dest : tensor<128x256xf32> -> tensor<16x8 x 8x32 xf32>
     //                                             \  /   \  /
     //                                       outer dims  inner dims
+    // CHW to CHWhw
+    %0 = linalg.pack %source inner_dims_pos = [2, 1] inner_tiles = [4, 2]
+        into %dest : tensor<1x8x16xf32> -> tensor<1x2x4 x 4x2 xf32>
+    //                                             \  /   \  /
+    //                                       outer dims  inner dims
+    // HCW to HCWhw
+    %0 = linalg.pack %source inner_dims_pos = [2, 0] inner_tiles = [4, 2]
+        into %dest : tensor<20x1x12xf32> -> tensor<10x1x3 x 4x2xf32>
+    //                                              \  /      \ /
+    //                                  Outer Dims: 10x1x3    Inner Dims: 4x2
----------------
banach-space wrote:

To me the repetition feels a bit noisy, but I don't mind much and I will be happy either way. However, please make sure that all examples use identical formatting :) 

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


More information about the Mlir-commits mailing list