[libc-commits] [clang] [llvm] [flang] [libc] [mlir] [libcxx] [compiler-rt] [clang-tools-extra] [mlir][Linalg] Support dynamic tiles in `lower_pack` transform (PR #76003)

via libc-commits libc-commits at lists.llvm.org
Fri Jan 5 10:27:21 PST 2024


srcarroll wrote:

After a very illuminating discussion offline with @chelini, I think we answered some of my questions.  So I will relay here

> * Should the verifier allow such an example?  In other words, should users be required to use static tile sizes in the cases where their static values can be inferred?
It's not up to us to enforce this. @chelini helped me realize that UB is part of the semantics of the op. So we should allow users to have a dynamic tile size even when there's only one possible tile size that yields well defined behavior, which is currently the case.  We did come to the conclusion that maybe a runtime assert should be emitted to enforce well defined behavior.
But that's only for the case where the the output size divides the input size.  In the case where it doesn't divide, there are two cases:
1. The `padding_value` of `tensor.pack` is specified. In this case, we can also allow dynamic tile sizes, even though there is still only one that yields well defined behavior.  Still emit a runtime assert
2. The `padding_value` is not specified.  In this case, non-divisible is always UB (because the input will always be padded and thus a value must be specified), so the verifier should fail this case.

@chelini, did I miss anything here or get anything wrong?



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


More information about the libc-commits mailing list