Skip to content

Commit 33d523c

Browse files
committed
Add an onverload that helpes preserve the original API
1 parent a24d857 commit 33d523c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ Value createReadOrMaskedRead(OpBuilder &builder, Location loc, Value source,
230230
std::optional<Value> padValue = std::nullopt,
231231
bool useInBoundsInsteadOfMasking = false);
232232

233+
Value createReadOrMaskedRead(OpBuilder &builder, Location loc, Value source,
234+
ArrayRef<int64_t> inputVectorSizes,
235+
std::optional<Value> padValue = std::nullopt,
236+
bool useInBoundsInsteadOfMasking = false,
237+
ArrayRef<bool> inputScalableVecDims = {});
238+
233239
/// Returns success if `inputVectorSizes` is a valid masking configuraion for
234240
/// given `shape`, i.e., it meets:
235241
/// 1. The numbers of elements in both array are equal.

mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,20 @@ bool vector::isLinearizableVector(VectorType type) {
316316
return (type.getRank() > 1) && (type.getNumScalableDims() <= 1);
317317
}
318318

319+
Value vector::createReadOrMaskedRead(OpBuilder &builder, Location loc,
320+
Value source,
321+
ArrayRef<int64_t> inputVectorSizes,
322+
std::optional<Value> padValue,
323+
bool useInBoundsInsteadOfMasking,
324+
ArrayRef<bool> inputScalableVecDims) {
325+
VectorType vecToReadTy = VectorType::get(
326+
inputVectorSizes, cast<ShapedType>(source.getType()).getElementType(),
327+
inputScalableVecDims);
328+
329+
return createReadOrMaskedRead(builder, loc, source, vecToReadTy, padValue,
330+
useInBoundsInsteadOfMasking);
331+
}
332+
319333
Value vector::createReadOrMaskedRead(OpBuilder &builder, Location loc,
320334
Value source,
321335
const VectorType &vecToReadTy,

0 commit comments

Comments
 (0)