[Mlir-commits] [mlir] [mlir][tensor] Verify that `tensor.pad` padding is non-negative (PR #231389)

Renato Golin llvmlistbot at llvm.org
Tue Oct 13 02:38:52 PDT 2026


rengolin wrote:

Why the dynamic nature of this dimension changes how negative padding is treated?

If it is "meaningful" to have negative padding at all, it should work for both static and dynamic. If it's not, then it should not work for either.

Do you have more information if people use negative padding values today? @banach-space any ideas? A potential usage would be to `floor` instead of `ceil` the dimension size. So, `1023 pad 1` is the same as `1025 pad -1`. This would apply even for dynamic shapes and dynamic padding. 

I'm not saying I know of such cases or need this, but before we add such verification we should make sure it agrees with the semantics expectation and hopefully document it at the same time in the `pad` op.

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


More information about the Mlir-commits mailing list