[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:02:36 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.
----------------
banach-space wrote:

Hm, in this case `padding_value` is present, so it's slightly different case, no?
```mlir
func.func @pack_with_artificial_padding(%input: tensor<9xf32>, %output: tensor<3x8xf32>) -> tensor<3x8xf32> {
  %cst = arith.constant 0.0 : f32
  // expected-error at +1 {{expected 'tensor<2x8xf32>' for the unpacked domain value, got 'tensor<3x8xf32>'}}
  %0 = linalg.pack %input padding_value(%cst : f32) inner_dims_pos = [0]
      inner_tiles = [8] into %output
      : tensor<9xf32> -> tensor<3x8xf32>
  return %0 : tensor<3x8xf32>
}
```

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


More information about the llvm-branch-commits mailing list