[llvm-branch-commits] [mlir] [mlir][linalg] Restrict linalg.pack to not have artificial padding. (PR #149624)

Andrzej WarzyƄski via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 23 11:23:55 PDT 2025


================
@@ -150,9 +150,13 @@ def Linalg_PackOp : Linalg_RelayoutOp<"pack", [
 
     `padding_value` specifies a padding value at the boundary on non-perfectly
     divisible dimensions. Padding is optional:
-    - If absent, it is UB if the tile does not perfectly divide the dimension.
+    - If absent, it assumes the tile perfectly divides the dimension.
     - If present, it will pad along high dimensions (high-padding) to make the
-      tile complete.
+      tile complete. Note that it is not allowed to have artificial padding that
+      is not strictly required by linalg.pack (i.e., padding past what is needed
+      to complete the last tile along each packed dimension).. It is UB if extra
+      padding is requested for dynamic cases. For static cases, they are caught
+      by the verifier.
----------------
banach-space wrote:

I think that you are right.

`/` means `FloorDiv` and to me that looks incorrect, it should be `CeilDiv` instead.

> Thus, I think the statement is still valuable. How about I trim away the dynamic and static part?

If you find it valuable then lets keep, these things are very subjective and there's non-zero likelihood that others find it helpful as well.

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


More information about the llvm-branch-commits mailing list