Skip to content

Commit 2da6ed1

Browse files
committed
[mlir][vector] Update the internal representation of in_bounds
This PR updates the internal representation of the `in_bounds` attribute for `xfer_read`/`xfer_write` Ops. Currently we use `ArrayAttr` - that's being updated to `DenseBoolArrayAttribute`. Note that this means that the asm format of the `xfer_{read|_write}` will change from: ```mlir vector.transfer_read %arg0[%0, %1], %cst {in_bounds = [true], permutation_map = #map3} : memref<12x16xf32>, vector<8xf32> ``` to: ```mlir vector.transfer_read %arg0[%0, %1], %cst {in_bounds = array<i1: true>, permutation_map = #map3} : memref<12x16xf32>, vector<8xf32> ```
1 parent 98e4413 commit 2da6ed1

File tree

79 files changed

+1083
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1083
-1088
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ def Vector_TransferReadOp :
13621362
AffineMapAttr:$permutation_map,
13631363
AnyType:$padding,
13641364
Optional<VectorOf<[I1]>>:$mask,
1365-
BoolArrayAttr:$in_bounds)>,
1365+
DenseBoolArrayAttr:$in_bounds)>,
13661366
Results<(outs AnyVectorOfAnyRank:$vector)> {
13671367

13681368
let summary = "Reads a supervector from memory into an SSA vector value.";
@@ -1557,7 +1557,7 @@ def Vector_TransferReadOp :
15571557
"Value":$source,
15581558
"ValueRange":$indices,
15591559
"AffineMapAttr":$permutationMapAttr,
1560-
"ArrayAttr":$inBoundsAttr)>,
1560+
"DenseBoolArrayAttr":$inBoundsAttr)>,
15611561
/// 2. Builder that sets padding to zero and an empty mask (variant without attrs).
15621562
OpBuilder<(ins "VectorType":$vectorType,
15631563
"Value":$source,
@@ -1609,7 +1609,7 @@ def Vector_TransferWriteOp :
16091609
Variadic<Index>:$indices,
16101610
AffineMapAttr:$permutation_map,
16111611
Optional<VectorOf<[I1]>>:$mask,
1612-
BoolArrayAttr:$in_bounds)>,
1612+
DenseBoolArrayAttr:$in_bounds)>,
16131613
Results<(outs Optional<AnyRankedTensor>:$result)> {
16141614

16151615
let summary = "The vector.transfer_write op writes a supervector to memory.";
@@ -1720,13 +1720,13 @@ def Vector_TransferWriteOp :
17201720
"ValueRange":$indices,
17211721
"AffineMapAttr":$permutationMapAttr,
17221722
"Value":$mask,
1723-
"ArrayAttr":$inBoundsAttr)>,
1723+
"DenseBoolArrayAttr":$inBoundsAttr)>,
17241724
/// 2. Builder with type inference that sets an empty mask (variant with attrs).
17251725
OpBuilder<(ins "Value":$vector,
17261726
"Value":$dest,
17271727
"ValueRange":$indices,
17281728
"AffineMapAttr":$permutationMapAttr,
1729-
"ArrayAttr":$inBoundsAttr)>,
1729+
"DenseBoolArrayAttr":$inBoundsAttr)>,
17301730
/// 3. Builder with type inference that sets an empty mask (variant without attrs).
17311731
OpBuilder<(ins "Value":$vector,
17321732
"Value":$dest,

mlir/include/mlir/Interfaces/VectorInterfaces.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def VectorTransferOpInterface : OpInterface<"VectorTransferOpInterface"> {
9898
dimension whether it is in-bounds or not. (Broadcast dimensions are
9999
always in-bounds).
100100
}],
101-
/*retTy=*/"::mlir::ArrayAttr",
101+
/*retTy=*/"::mlir::ArrayRef<bool>",
102102
/*methodName=*/"getInBounds",
103103
/*args=*/(ins)
104104
>,
@@ -241,7 +241,7 @@ def VectorTransferOpInterface : OpInterface<"VectorTransferOpInterface"> {
241241
if ($_op.isBroadcastDim(dim))
242242
return true;
243243
auto inBounds = $_op.getInBounds();
244-
return ::llvm::cast<::mlir::BoolAttr>(inBounds[dim]).getValue();
244+
return inBounds[dim];
245245
}
246246

247247
/// Helper function to account for the fact that `permutationMap` results

mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,11 @@ static void generateInBoundsCheck(
242242
}
243243

244244
/// Given an ArrayAttr, return a copy where the first element is dropped.
245-
static ArrayAttr dropFirstElem(OpBuilder &b, ArrayAttr attr) {
245+
static DenseBoolArrayAttr dropFirstElem(OpBuilder &b, DenseBoolArrayAttr attr) {
246246
if (!attr)
247247
return attr;
248-
return ArrayAttr::get(b.getContext(), attr.getValue().drop_front());
248+
return DenseBoolArrayAttr::get(b.getContext(),
249+
attr.asArrayRef().drop_front());
249250
}
250251

251252
/// Add the pass label to a vector transfer op if its rank is not the target

mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,7 @@ struct LegalizeMultiTileTransferWriteAsStoreLoop
497497
loc, slice, writeOp.getSource(), ValueRange{storeRow, storeCol},
498498
AffineMapAttr::get(writeOp.getPermutationMap().dropResult(0)),
499499
sliceMask,
500-
rewriter.getBoolArrayAttr(
501-
ArrayRef<bool>(writeOp.getInBoundsValues()).drop_front()));
500+
rewriter.getDenseBoolArrayAttr(writeOp.getInBounds().drop_front()));
502501
}
503502

504503
rewriter.eraseOp(writeOp);
@@ -691,13 +690,12 @@ struct LiftIllegalVectorTransposeToMemory
691690
transposeOp.getPermutation(), getContext());
692691
auto transposedSubview = rewriter.create<memref::TransposeOp>(
693692
loc, readSubview, AffineMapAttr::get(transposeMap));
694-
ArrayAttr inBoundsAttr = illegalRead.getInBoundsAttr();
693+
DenseBoolArrayAttr inBoundsAttr = illegalRead.getInBoundsAttr();
695694
// - The `in_bounds` attribute
696695
if (inBoundsAttr) {
697-
SmallVector<Attribute> inBoundsValues(inBoundsAttr.begin(),
698-
inBoundsAttr.end());
696+
SmallVector<bool> inBoundsValues(inBoundsAttr.asArrayRef());
699697
applyPermutationToVector(inBoundsValues, transposeOp.getPermutation());
700-
inBoundsAttr = rewriter.getArrayAttr(inBoundsValues);
698+
inBoundsAttr = rewriter.getDenseBoolArrayAttr(inBoundsValues);
701699
}
702700

703701
VectorType legalReadType = resultType.clone(readType.getElementType());
@@ -990,7 +988,7 @@ struct LowerIllegalTransposeStoreViaZA
990988
rewriter.create<arith::AddIOp>(loc, transposedCol, writeIndices[1]);
991989
auto smeWrite = rewriter.create<vector::TransferWriteOp>(
992990
loc, tile, destTensorOrMemref, ValueRange{destRow, destCol},
993-
transposeMap, subMask, writeOp.getInBounds());
991+
transposeMap, subMask, writeOp.getInBoundsAttr());
994992

995993
if (writeOp.hasPureTensorSemantics())
996994
destTensorOrMemref = smeWrite.getResult();

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ static Value buildVectorWrite(RewriterBase &rewriter, Value value,
646646
if (auto maskOp = dyn_cast<vector::MaskingOpInterface>(write)) {
647647
auto maskedWriteOp = cast<vector::TransferWriteOp>(maskOp.getMaskableOp());
648648
SmallVector<bool> inBounds(maskedWriteOp.getVectorType().getRank(), true);
649-
maskedWriteOp.setInBoundsAttr(rewriter.getBoolArrayAttr(inBounds));
649+
maskedWriteOp.setInBoundsAttr(rewriter.getDenseBoolArrayAttr(inBounds));
650650
}
651651

652652
LDBG("vectorized op: " << *write << "\n");
@@ -1373,7 +1373,7 @@ vectorizeAsLinalgGeneric(RewriterBase &rewriter, VectorizationState &state,
13731373
if (auto maskOp = dyn_cast<vector::MaskingOpInterface>(read)) {
13741374
SmallVector<bool> inBounds(readType.getRank(), true);
13751375
cast<vector::TransferReadOp>(maskOp.getMaskableOp())
1376-
.setInBoundsAttr(rewriter.getBoolArrayAttr(inBounds));
1376+
.setInBoundsAttr(rewriter.getDenseBoolArrayAttr(inBounds));
13771377
}
13781378

13791379
// 3.c. Not all ops support 0-d vectors, extract the scalar for now.
@@ -2406,7 +2406,7 @@ struct PadOpVectorizationWithTransferReadPattern
24062406
rewriter.modifyOpInPlace(xferOp, [&]() {
24072407
SmallVector<bool> inBounds(xferOp.getVectorType().getRank(), false);
24082408
xferOp->setAttr(xferOp.getInBoundsAttrName(),
2409-
rewriter.getBoolArrayAttr(inBounds));
2409+
rewriter.getDenseBoolArrayAttr(inBounds));
24102410
xferOp.getSourceMutable().assign(padOp.getSource());
24112411
xferOp.getPaddingMutable().assign(padValue);
24122412
});
@@ -2485,7 +2485,7 @@ struct PadOpVectorizationWithTransferWritePattern
24852485
auto newXferOp = rewriter.replaceOpWithNewOp<vector::TransferWriteOp>(
24862486
xferOp, padOp.getSource().getType(), xferOp.getVector(),
24872487
padOp.getSource(), xferOp.getIndices(), xferOp.getPermutationMapAttr(),
2488-
xferOp.getMask(), rewriter.getBoolArrayAttr(inBounds));
2488+
xferOp.getMask(), rewriter.getDenseBoolArrayAttr(inBounds));
24892489
rewriter.replaceOp(trimPadding, newXferOp->getResult(0));
24902490

24912491
return success();
@@ -2789,7 +2789,7 @@ LogicalResult LinalgCopyVTRForwardingPattern::matchAndRewrite(
27892789
Value res = rewriter.create<vector::TransferReadOp>(
27902790
xferOp.getLoc(), vectorType, in, xferOp.getIndices(),
27912791
xferOp.getPermutationMapAttr(), xferOp.getPadding(), xferOp.getMask(),
2792-
rewriter.getBoolArrayAttr(
2792+
rewriter.getDenseBoolArrayAttr(
27932793
SmallVector<bool>(vectorType.getRank(), false)));
27942794

27952795
if (maybeFillOp)
@@ -2848,7 +2848,7 @@ LogicalResult LinalgCopyVTWForwardingPattern::matchAndRewrite(
28482848
rewriter.create<vector::TransferWriteOp>(
28492849
xferOp.getLoc(), vector, out, xferOp.getIndices(),
28502850
xferOp.getPermutationMapAttr(), xferOp.getMask(),
2851-
rewriter.getBoolArrayAttr(
2851+
rewriter.getDenseBoolArrayAttr(
28522852
SmallVector<bool>(vector.getType().getRank(), false)));
28532853

28542854
rewriter.eraseOp(copyOp);
@@ -3348,7 +3348,7 @@ struct Conv1DGenerator
33483348
SmallVector<bool> inBounds(maskShape.size(), true);
33493349
auto xferOp = cast<VectorTransferOpInterface>(opToMask);
33503350
xferOp->setAttr(xferOp.getInBoundsAttrName(),
3351-
rewriter.getBoolArrayAttr(inBounds));
3351+
rewriter.getDenseBoolArrayAttr(inBounds));
33523352

33533353
SmallVector<OpFoldResult> mixedDims = vector::getMixedSizesXfer(
33543354
cast<LinalgOp>(op).hasPureTensorSemantics(), opToMask, rewriter);

mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3792,7 +3792,7 @@ void ExtractStridedSliceOp::getCanonicalizationPatterns(
37923792
void TransferReadOp::build(OpBuilder &builder, OperationState &result,
37933793
VectorType vectorType, Value source,
37943794
ValueRange indices, AffineMapAttr permutationMapAttr,
3795-
/*optional*/ ArrayAttr inBoundsAttr) {
3795+
/*optional*/ DenseBoolArrayAttr inBoundsAttr) {
37963796
Type elemType = llvm::cast<ShapedType>(source.getType()).getElementType();
37973797
Value padding = builder.create<arith::ConstantOp>(
37983798
result.location, elemType, builder.getZeroAttr(elemType));
@@ -3807,8 +3807,8 @@ void TransferReadOp::build(OpBuilder &builder, OperationState &result,
38073807
std::optional<ArrayRef<bool>> inBounds) {
38083808
auto permutationMapAttr = AffineMapAttr::get(permutationMap);
38093809
auto inBoundsAttr = (inBounds && !inBounds.value().empty())
3810-
? builder.getBoolArrayAttr(inBounds.value())
3811-
: builder.getBoolArrayAttr(
3810+
? builder.getDenseBoolArrayAttr(inBounds.value())
3811+
: builder.getDenseBoolArrayAttr(
38123812
SmallVector<bool>(vectorType.getRank(), false));
38133813
build(builder, result, vectorType, source, indices, permutationMapAttr,
38143814
inBoundsAttr);
@@ -3823,8 +3823,8 @@ void TransferReadOp::build(OpBuilder &builder, OperationState &result,
38233823
llvm::cast<ShapedType>(source.getType()), vectorType);
38243824
auto permutationMapAttr = AffineMapAttr::get(permutationMap);
38253825
auto inBoundsAttr = (inBounds && !inBounds.value().empty())
3826-
? builder.getBoolArrayAttr(inBounds.value())
3827-
: builder.getBoolArrayAttr(
3826+
? builder.getDenseBoolArrayAttr(inBounds.value())
3827+
: builder.getDenseBoolArrayAttr(
38283828
SmallVector<bool>(vectorType.getRank(), false));
38293829
build(builder, result, vectorType, source, indices, permutationMapAttr,
38303830
padding,
@@ -3876,7 +3876,7 @@ static LogicalResult
38763876
verifyTransferOp(VectorTransferOpInterface op, ShapedType shapedType,
38773877
VectorType vectorType, VectorType maskType,
38783878
VectorType inferredMaskType, AffineMap permutationMap,
3879-
ArrayAttr inBounds) {
3879+
ArrayRef<bool> inBounds) {
38803880
if (op->hasAttr("masked")) {
38813881
return op->emitOpError("masked attribute has been removed. "
38823882
"Use in_bounds instead.");
@@ -3949,8 +3949,7 @@ verifyTransferOp(VectorTransferOpInterface op, ShapedType shapedType,
39493949
<< AffineMapAttr::get(permutationMap)
39503950
<< " vs inBounds of size: " << inBounds.size();
39513951
for (unsigned int i = 0, e = permutationMap.getNumResults(); i < e; ++i)
3952-
if (isa<AffineConstantExpr>(permutationMap.getResult(i)) &&
3953-
!llvm::cast<BoolAttr>(inBounds.getValue()[i]).getValue())
3952+
if (isa<AffineConstantExpr>(permutationMap.getResult(i)) && !inBounds[i])
39543953
return op->emitOpError("requires broadcast dimensions to be in-bounds");
39553954

39563955
return success();
@@ -4031,7 +4030,7 @@ ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) {
40314030
Attribute inBoundsAttr = result.attributes.get(inBoundsAttrName);
40324031
if (!inBoundsAttr) {
40334032
result.addAttribute(inBoundsAttrName,
4034-
builder.getBoolArrayAttr(
4033+
builder.getDenseBoolArrayAttr(
40354034
SmallVector<bool>(permMap.getNumResults(), false)));
40364035
}
40374036
if (parser.resolveOperand(sourceInfo, shapedType, result.operands) ||
@@ -4159,7 +4158,7 @@ static LogicalResult foldTransferInBoundsAttribute(TransferOp op) {
41594158
return failure();
41604159
// OpBuilder is only used as a helper to build an I64ArrayAttr.
41614160
OpBuilder b(op.getContext());
4162-
op.setInBoundsAttr(b.getBoolArrayAttr(newInBounds));
4161+
op.setInBoundsAttr(b.getDenseBoolArrayAttr(newInBounds));
41634162
return success();
41644163
}
41654164

@@ -4329,7 +4328,7 @@ void TransferWriteOp::build(OpBuilder &builder, OperationState &result,
43294328
Value vector, Value dest, ValueRange indices,
43304329
AffineMapAttr permutationMapAttr,
43314330
/*optional*/ Value mask,
4332-
/*optional*/ ArrayAttr inBoundsAttr) {
4331+
/*optional*/ DenseBoolArrayAttr inBoundsAttr) {
43334332
Type resultType = llvm::dyn_cast<RankedTensorType>(dest.getType());
43344333
build(builder, result, resultType, vector, dest, indices, permutationMapAttr,
43354334
mask, inBoundsAttr);
@@ -4339,7 +4338,7 @@ void TransferWriteOp::build(OpBuilder &builder, OperationState &result,
43394338
void TransferWriteOp::build(OpBuilder &builder, OperationState &result,
43404339
Value vector, Value dest, ValueRange indices,
43414340
AffineMapAttr permutationMapAttr,
4342-
/*optional*/ ArrayAttr inBoundsAttr) {
4341+
/*optional*/ DenseBoolArrayAttr inBoundsAttr) {
43434342
build(builder, result, vector, dest, indices, permutationMapAttr,
43444343
/*mask=*/Value(), inBoundsAttr);
43454344
}
@@ -4353,8 +4352,8 @@ void TransferWriteOp::build(OpBuilder &builder, OperationState &result,
43534352
auto permutationMapAttr = AffineMapAttr::get(permutationMap);
43544353
auto inBoundsAttr =
43554354
(inBounds && !inBounds.value().empty())
4356-
? builder.getBoolArrayAttr(inBounds.value())
4357-
: builder.getBoolArrayAttr(SmallVector<bool>(
4355+
? builder.getDenseBoolArrayAttr(inBounds.value())
4356+
: builder.getDenseBoolArrayAttr(SmallVector<bool>(
43584357
llvm::cast<VectorType>(vector.getType()).getRank(), false));
43594358
build(builder, result, vector, dest, indices, permutationMapAttr,
43604359
/*mask=*/Value(), inBoundsAttr);
@@ -4412,7 +4411,7 @@ ParseResult TransferWriteOp::parse(OpAsmParser &parser,
44124411
Attribute inBoundsAttr = result.attributes.get(inBoundsAttrName);
44134412
if (!inBoundsAttr) {
44144413
result.addAttribute(inBoundsAttrName,
4415-
builder.getBoolArrayAttr(
4414+
builder.getDenseBoolArrayAttr(
44164415
SmallVector<bool>(permMap.getNumResults(), false)));
44174416
}
44184417
if (parser.resolveOperand(vectorInfo, vectorType, result.operands) ||
@@ -4765,7 +4764,7 @@ struct SwapExtractSliceOfTransferWrite
47654764
auto newTransferWriteOp = rewriter.create<TransferWriteOp>(
47664765
transferOp.getLoc(), transferOp.getVector(), newExtractOp.getResult(),
47674766
transferOp.getIndices(), transferOp.getPermutationMapAttr(),
4768-
rewriter.getBoolArrayAttr(newInBounds));
4767+
rewriter.getDenseBoolArrayAttr(newInBounds));
47694768
rewriter.modifyOpInPlace(insertOp, [&]() {
47704769
insertOp.getSourceMutable().assign(newTransferWriteOp.getResult());
47714770
});

mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ using namespace mlir::vector;
2222

2323
/// Transpose a vector transfer op's `in_bounds` attribute by applying reverse
2424
/// permutation based on the given indices.
25-
static ArrayAttr
26-
inverseTransposeInBoundsAttr(OpBuilder &builder, ArrayAttr attr,
25+
static DenseBoolArrayAttr
26+
inverseTransposeInBoundsAttr(OpBuilder &builder, ArrayRef<bool> inBounds,
2727
const SmallVector<unsigned> &permutation) {
2828
SmallVector<bool> newInBoundsValues(permutation.size());
2929
size_t index = 0;
3030
for (unsigned pos : permutation)
31-
newInBoundsValues[pos] =
32-
cast<BoolAttr>(attr.getValue()[index++]).getValue();
33-
return builder.getBoolArrayAttr(newInBoundsValues);
31+
newInBoundsValues[pos] = inBounds[index++];
32+
return builder.getDenseBoolArrayAttr(newInBoundsValues);
3433
}
3534

3635
/// Extend the rank of a vector Value by `addedRanks` by adding outer unit
@@ -132,7 +131,7 @@ struct TransferReadPermutationLowering
132131
}
133132

134133
// Transpose in_bounds attribute.
135-
ArrayAttr newInBoundsAttr =
134+
DenseBoolArrayAttr newInBoundsAttr =
136135
inverseTransposeInBoundsAttr(rewriter, op.getInBounds(), permutation);
137136

138137
// Generate new transfer_read operation.
@@ -205,7 +204,7 @@ struct TransferWritePermutationLowering
205204
});
206205

207206
// Transpose in_bounds attribute.
208-
ArrayAttr newInBoundsAttr =
207+
DenseBoolArrayAttr newInBoundsAttr =
209208
inverseTransposeInBoundsAttr(rewriter, op.getInBounds(), permutation);
210209

211210
// Generate new transfer_write operation.
@@ -298,7 +297,8 @@ struct TransferWriteNonPermutationLowering
298297
for (int64_t i = 0, e = op.getVectorType().getRank(); i < e; ++i) {
299298
newInBoundsValues.push_back(op.isDimInBounds(i));
300299
}
301-
ArrayAttr newInBoundsAttr = rewriter.getBoolArrayAttr(newInBoundsValues);
300+
DenseBoolArrayAttr newInBoundsAttr =
301+
rewriter.getDenseBoolArrayAttr(newInBoundsValues);
302302
auto newWrite = rewriter.create<vector::TransferWriteOp>(
303303
op.getLoc(), newVec, op.getSource(), op.getIndices(),
304304
AffineMapAttr::get(newMap), newMask, newInBoundsAttr);
@@ -386,11 +386,8 @@ struct TransferOpReduceRank
386386

387387
VectorType newReadType = VectorType::get(
388388
newShape, originalVecType.getElementType(), newScalableDims);
389-
ArrayAttr newInBoundsAttr =
390-
op.getInBounds()
391-
? rewriter.getArrayAttr(
392-
op.getInBoundsAttr().getValue().take_back(reducedShapeRank))
393-
: ArrayAttr();
389+
DenseBoolArrayAttr newInBoundsAttr = rewriter.getDenseBoolArrayAttr(
390+
op.getInBounds().take_back(reducedShapeRank));
394391
Value newRead = rewriter.create<vector::TransferReadOp>(
395392
op.getLoc(), newReadType, op.getSource(), op.getIndices(),
396393
AffineMapAttr::get(newMap), op.getPadding(), op.getMask(),

mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,9 @@ struct CastAwayTransferReadLeadingOneDim
248248
AffineMap::get(oldMap.getNumDims(), oldMap.getNumSymbols(), newResults,
249249
rewriter.getContext());
250250

251-
ArrayAttr inBoundsAttr;
252-
if (read.getInBounds())
253-
inBoundsAttr = rewriter.getArrayAttr(
254-
read.getInBoundsAttr().getValue().take_back(newType.getRank()));
251+
DenseBoolArrayAttr inBoundsAttr;
252+
inBoundsAttr = rewriter.getDenseBoolArrayAttr(
253+
read.getInBoundsAttr().asArrayRef().take_back(newType.getRank()));
255254

256255
Value mask = Value();
257256
if (read.getMask()) {
@@ -302,10 +301,9 @@ struct CastAwayTransferWriteLeadingOneDim
302301
AffineMap::get(oldMap.getNumDims(), oldMap.getNumSymbols(), newResults,
303302
rewriter.getContext());
304303

305-
ArrayAttr inBoundsAttr;
306-
if (write.getInBounds())
307-
inBoundsAttr = rewriter.getArrayAttr(
308-
write.getInBoundsAttr().getValue().take_back(newType.getRank()));
304+
DenseBoolArrayAttr inBoundsAttr;
305+
inBoundsAttr = rewriter.getDenseBoolArrayAttr(
306+
write.getInBoundsAttr().asArrayRef().take_back(newType.getRank()));
309307

310308
auto newVector = rewriter.create<vector::ExtractOp>(
311309
write.getLoc(), write.getVector(), splatZero(dropDim));

0 commit comments

Comments
 (0)