[Mlir-commits] [mlir] [mlir][linalg] Vectorize unpack op without masking (PR #89067)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Apr 19 09:28:29 PDT 2024
================
@@ -1597,6 +1597,16 @@ vectorizeAsTensorUnpackOp(RewriterBase &rewriter, tensor::UnPackOp unpackOp,
RankedTensorType unpackTensorType = unpackOp.getSourceType();
+ // If the input vector sizes are not provided, then the vector sizes are
+ // determined by the result tensor shape. In case the vector sizes aren't
+ // provided, we update the inBounds attribute instead of masking.
+ bool doMasking = true;
+ if (inputVectorSizes.empty()) {
+ ArrayRef<int64_t> resultTensorShape = unpackOp.getDestType().getShape();
+ inputVectorSizes = resultTensorShape.take_front(unpackOp.getSourceRank());
+ doMasking = false;
+ }
----------------
banach-space wrote:
Similar comment as for https://github.com/llvm/llvm-project/pull/89119 ...
IMHO it would make more sense to introduce `useInBoundsInsteadOfMasking` in place of `doMasking`.
The longer name better captures the underlying logic ("replace masks with in_bounds attr"). Indeed, the actual meaning of the bool is much narrower than `doMasking`.
Naming is hard and I am being a bit pedantic. And also a bit mindful of our future selves when reading this in 6 months :)
https://github.com/llvm/llvm-project/pull/89067
More information about the Mlir-commits
mailing list