[Mlir-commits] [mlir] Make createReadOrMaskedRead and isValidMaskedInputVector vector utilities (PR #89119)

Lubomir Litchev llvmlistbot at llvm.org
Fri Apr 19 10:23:38 PDT 2024


================
@@ -180,6 +180,23 @@ struct MaskableOpRewritePattern : OpRewritePattern<SourceOp> {
 /// are not linearizable.
 bool isLinearizableVector(VectorType type);
 
+/// Create a TransferReadOp from `source` with static shape `readShape`. If the
+/// vector type for the read is not the same as the type of `source`, then a
+/// mask is created on the read.
+/// enableMasking if false, the inBoundsVal values are set properly, based on
+///     the rank dimensions of the source and destination tensors.
----------------
LLITCHEV wrote:

@banach-space To me this is just a potential optimization (maybe I'm wrong). It looks like the code is setting up for a later optimization to turn read_transfer into a simple load. But if we do masking or the bounds of a dimension is different, the optimization can't be done. It alsocan't be done if masking is done. So, it looked to me that if no masking and bounds the same, set it up for later pass to do load instead of a transfer (with skipping the masking op). Or just maybe just removing an unnecessary op - masking. Maybe I misunderstood the purpose of it too. That's what I thought... :)
The rest is fixed, I hope... :)
Thanks!

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


More information about the Mlir-commits mailing list