[Mlir-commits] [mlir] [mlir][vector] Determine vector sizes from the result shape for tensor.pad operation (PR #97248)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jul 10 18:28:30 PDT 2024
BRUCE11111 wrote:
> This is lacking motivation.
This PR is about the method in [here](https://github.com/llvm/llvm-project/blob/14fb6162a97e60a8aefcb0702a713f7a50205fce/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L1975C5-L1983C9) and [here](https://github.com/llvm/llvm-project/blob/14fb6162a97e60a8aefcb0702a713f7a50205fce/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2071C11-L2082C13).
After [PR](https://github.com/llvm/llvm-project/pull/88249) merged, these three functions should also be unified for the empty input vector size. Otherwise when users call [vectorize()](https://github.com/llvm/llvm-project/blob/14fb6162a97e60a8aefcb0702a713f7a50205fce/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2008) function, `pad` operation can't do similar things like other operations in here.(Although I rarely use the pad in this place for vectorize.)
This PR is just a fix for that. No other motivation.
> Why not use GenericPadOpVectorizationPattern and lower to linalg.fill instead?
Maybe it should be `linalg::populatePadOpVectorizationPatterns(patterns)`? Definitely I use it in downstream project.
>How do you infer sizes when the input shapes are dynamic?
In the empty input size case, it must be static shape : https://github.com/BRUCE11111/llvm-project/blob/0653099322a7e96a693c6739cf9b640a4c1fca19/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L1926C3-L1931C4
> There's a lot of discussion about the semantics in_bounds ATM. I am trying to clarify some of it here:
> https://github.com/llvm/llvm-project/pull/97049
Great work. I will read it carefully.
> I do believe that masks and in_bounds model slightly different things
I think so. But I still can't understand in current method `vectorize` (which mentioned above), why we prefer `in_bounds` than `mask` default. Or seems like mask can't support some things even in static shape? Or it just the coding style in this function?(Coding style here means that we use `in_bounds` default when we implement this vectorize function.) I think later one is the reason. I will follow the style to fix the code.
https://github.com/llvm/llvm-project/pull/97248
More information about the Mlir-commits
mailing list