[Mlir-commits] [mlir] [mlir][linalg] Add `insert_slice` vectorization tests for leading/trailing dropped dims (PR #221966)
Federico Bruzzone
llvmlistbot at llvm.org
Tue Sep 8 04:57:55 PDT 2026
FedericoBruzzone wrote:
@banach-space thank you for your https://github.com/llvm/llvm-project/pull/219192#pullrequestreview-5139503717!
> All in all LGTM, but I don't see any other tests for vectorizing tensor.insert_slice when the source and destination ranks differ. It would good to test those scenarios as well (i.e. leading + trailing unit dims being skipped). WOuld you be able to extend this? Thank you!
I hope this PR meets the expectations you had in mind. Let me know :D
> [ultra nit] Unify the naming scheme (%empty -> %init, %init -> %source_slice).
The names are consistent with the rest of the file. Would you prefer them to be different for these tests? I've kept them the same for now. Let me know what you think, I'm happy to follow your suggestions.
> Is this operation required for testing? From https://github.com/llvm/llvm-project/pull/219192#discussion_r3956100998
Thank for this good question! The answer is: **yes**.
`getStaticPadVal` (note that it's recursive) only knows how to recover a pad value from ops like `linalg.fill` and `vector.broadcast`, not from a bare `tensor.empty()`.
https://github.com/llvm/llvm-project/blob/7f8ea63f3428c9e0d205961abe31eceeb7eae979/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2973-L2977
Essentially, without the fill, vectorization pre-conditions fail.
Does that sound good to you?
https://github.com/llvm/llvm-project/pull/221966
More information about the Mlir-commits
mailing list