[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


================
@@ -266,7 +280,11 @@ def Linalg_UnPackOp : Linalg_RelayoutOp<"unpack"> {
     dimensions. If specified, it must have `n - k` elements. If specified, this
     permutation is applied before combining any dimensions.
 
-    Example:
+    Note, the amount of elements in the source (packed tensor) and the result
+    (unpacked) can be unequal, i.e. `SizeOf(source) >= SizeOf(result)`. As
+    the unpack operation may drop any padding introduced by the pack operation.
----------------
banach-space wrote:

1. I'd keep this shorter and favour code over text.
2. Personally, I feel that it makes more sense to say that the packing op may drop elements and, as an outcome of that, the resulting tensor might be smaller than the source tensor. 
3. I suggest more explicit `NumElementsOf` instead of `SizeOf` ("size" is a bit context-sensitive).
```suggestion
    Note,  the unpack operation may drop any padding introduced by the pack operation and hence the following holds `NumElementsOf(source) >= NumElementsOf(result)`. 
```

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


More information about the Mlir-commits mailing list