[Mlir-commits] [mlir] [mlir] Fix padding shape computation in PadTilingInterface (PR #149576)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jul 21 07:00:21 PDT 2025


MaheshRavishankar wrote:

I dont know all the details ( @yzhang93  can fill them in), but basically I think the issue comes with using the "size" of the iteration domain directly. Indexing maps work on indices and dont translate to size (such errors have been seen previously w.r.t shape computations using convolutions).

Basically, take the `affine_map<(d0, d1) -> (d0 + d1)>`. If the domain size is `s0, s1`, then to compute the  range size, you can just do `s0 + s1` . You need to 
1. convert the size to "indices" by subtracting 1,
2. Apply the map
3. Add 1 to get the size back.

So the correct range size is `(s0 - 1) + (s1 - 1) + 1`.

When the map is a projected permutation like `affine_map(d0) -> (d0)`, then the expression just boils down to `(s0 - 1) + 1` which just simplifies to `s0`. 

I think something similar is happening here, but I dont know all the details w.r.t to padding.

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


More information about the Mlir-commits mailing list