Skip to content

Commit b6150be

Browse files
committed
Hack in the parser
This is down to `array<i1: false, true>` (dense array) vs `[true, false]` (regular array).
1 parent ed601d6 commit b6150be

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3959,7 +3959,7 @@ verifyTransferOp(VectorTransferOpInterface op, ShapedType shapedType,
39593959
<< AffineMapAttr::get(permutationMap)
39603960
<< " vs inBounds of size: " << inBounds.size();
39613961
for (unsigned int i = 0, e = permutationMap.getNumResults(); i < e; ++i)
3962-
if (isa<AffineConstantExpr>(permutationMap.getResult(i)) && inBounds[i])
3962+
if (isa<AffineConstantExpr>(permutationMap.getResult(i)) && !inBounds[i])
39633963
return op->emitOpError("requires broadcast dimensions to be in-bounds");
39643964

39653965
return success();
@@ -4042,6 +4042,14 @@ ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) {
40424042
result.addAttribute(inBoundsAttrName,
40434043
builder.getDenseBoolArrayAttr(
40444044
SmallVector<bool>(permMap.getNumResults(), false)));
4045+
} else {
4046+
SmallVector<bool> inBoundsVec;
4047+
for (auto el : llvm::cast<ArrayAttr>(inBoundsAttr).getValue()) {
4048+
inBoundsVec.emplace_back(llvm::cast<BoolAttr>(el).getValue());
4049+
}
4050+
result.attributes.erase(inBoundsAttrName);
4051+
result.addAttribute(inBoundsAttrName,
4052+
builder.getDenseBoolArrayAttr(inBoundsVec));
40454053
}
40464054
if (parser.resolveOperand(sourceInfo, shapedType, result.operands) ||
40474055
parser.resolveOperands(indexInfo, indexType, result.operands) ||
@@ -4423,7 +4431,16 @@ ParseResult TransferWriteOp::parse(OpAsmParser &parser,
44234431
result.addAttribute(inBoundsAttrName,
44244432
builder.getDenseBoolArrayAttr(
44254433
SmallVector<bool>(permMap.getNumResults(), false)));
4434+
} else {
4435+
SmallVector<bool> inBoundsVec;
4436+
for (auto el : llvm::cast<ArrayAttr>(inBoundsAttr).getValue()) {
4437+
inBoundsVec.emplace_back(llvm::cast<BoolAttr>(el).getValue());
4438+
}
4439+
result.attributes.erase(inBoundsAttrName);
4440+
result.addAttribute(inBoundsAttrName,
4441+
builder.getDenseBoolArrayAttr(inBoundsVec));
44264442
}
4443+
44274444
if (parser.resolveOperand(vectorInfo, vectorType, result.operands) ||
44284445
parser.resolveOperand(sourceInfo, shapedType, result.operands) ||
44294446
parser.resolveOperands(indexInfo, indexType, result.operands))

0 commit comments

Comments
 (0)