Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ static llvm::SmallBitVector getDroppedDims(ArrayRef<int64_t> reducedShape,
size_t idx = mixedSizes.size() - size.index() - 1;
// Rank-reduced dims must have a static unit dimension.
bool isStaticUnitSize =
size.value().is<Attribute>() &&
llvm::cast<IntegerAttr>(size.value().get<Attribute>()).getInt() == 1;
isa<Attribute>(size.value()) &&
llvm::cast<IntegerAttr>(cast<Attribute>(size.value())).getInt() == 1;

if (shapePos < 0) {
// There are no more dims in the reduced shape. All remaining sizes must
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ struct PadOpInterface
RankedTensorType srcType = padOp.getSourceType();

auto toValue = [&](OpFoldResult ofr) {
if (ofr.is<Value>())
return ofr.get<Value>();
if (auto value = dyn_cast<Value>(ofr))
return value;
return rewriter
.create<arith::ConstantIndexOp>(loc, *getConstantIntValue(ofr))
.getResult();
Expand Down
10 changes: 5 additions & 5 deletions mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ using namespace mlir::tensor;
static FailureOr<OpFoldResult> makeIndependent(OpBuilder &b, Location loc,
OpFoldResult ofr,
ValueRange independencies) {
if (ofr.is<Attribute>())
if (isa<Attribute>(ofr))
return ofr;
Value value = ofr.get<Value>();
Value value = cast<Value>(ofr);
AffineMap boundMap;
ValueDimList mapOperands;
if (failed(ValueBoundsConstraintSet::computeIndependentBound(
Expand Down Expand Up @@ -80,14 +80,14 @@ FailureOr<Value> tensor::buildIndependentOp(OpBuilder &b, tensor::PadOp padOp,
for (int64_t i = 0, e = padOp.getResultType().getRank(); i < e; ++i) {
// offset = ub(low_padding) - low_padding
OpFoldResult prevLow = padOp.getMixedLowPad()[i];
if (prevLow.is<Attribute>()) {
if (isa<Attribute>(prevLow)) {
offsets.push_back(b.getIndexAttr(0));
} else {
offsets.push_back(
b.create<affine::AffineApplyOp>(
loc, b.getAffineDimExpr(0) - b.getAffineDimExpr(1),
std::initializer_list<Value>{newMixedLow[i].get<Value>(),
prevLow.get<Value>()})
std::initializer_list<Value>{cast<Value>(newMixedLow[i]),
cast<Value>(prevLow)})
.getResult());
}
// size = reified result size
Expand Down
Loading