diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td --- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td +++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td @@ -463,7 +463,7 @@ /*args=*/(ins "unsigned":$index), /*methodBody=*/"", /*defaultImplementation=*/[{ - return mlir::bufferization::detail::defaultIsRepetitiveRegion( + return ::mlir::bufferization::detail::defaultIsRepetitiveRegion( cast($_op.getOperation()), index); }] > @@ -472,8 +472,9 @@ let extraClassDeclaration = [{ /// Resolve out-of-place tensor OpOperands with explicit allocations in the /// form of `bufferization.alloc_tensor` ops. - LogicalResult resolveTensorOpOperandConflicts( - RewriterBase &rewriter, const AnalysisState &state); + ::mlir::LogicalResult resolveTensorOpOperandConflicts( + ::mlir::RewriterBase &rewriter, + const ::mlir::bufferization::AnalysisState &state); /// Return `true` if the given OpOperand creates an alias but does neither /// read nor write. This implies that `bufferizesToMemoryRead` and @@ -481,10 +482,11 @@ /// be called on OpOperands that do not have a tensor type. /// /// Examples of such ops are `tensor.extract_slice` and `tensor.cast`. - bool bufferizesToAliasOnly(OpOperand &opOperand, - const AnalysisState &state) { + bool bufferizesToAliasOnly( + ::mlir::OpOperand &opOperand, + const ::mlir::bufferization::AnalysisState &state) { auto bufferizableOp = - cast(getOperation()); + cast<::mlir::bufferization::BufferizableOpInterface>(getOperation()); return !bufferizableOp.bufferizesToMemoryRead(opOperand, state) && !bufferizableOp.bufferizesToMemoryWrite(opOperand, state) && !bufferizableOp.getAliasingOpResults(opOperand, state).empty(); diff --git a/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td b/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td --- a/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td +++ b/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td @@ -85,14 +85,14 @@ >, InterfaceMethod< /*desc=*/"Return the init operands.", - /*retTy=*/"OpOperandVector", + /*retTy=*/"::mlir::OpOperandVector", /*methodName=*/"getDpsInitOperands", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ auto [start, end] = $_op.getDpsInitsPositionRange(); - OpOperandVector result; + ::mlir::OpOperandVector result; result.reserve(end - start); for (int i = start; i < end; ++i) result.push_back(&$_op->getOpOperand(i)); @@ -101,7 +101,7 @@ >, InterfaceMethod< /*desc=*/"Return the `i`-th init operand.", - /*retTy=*/"OpOperand *", + /*retTy=*/"::mlir::OpOperand *", /*methodName=*/"getDpsInitOperand", /*args=*/(ins "int64_t":$i), /*methodBody=*/"", @@ -115,7 +115,7 @@ /*desc=*/"Set the `i`-th init operand.", /*retTy=*/"void", /*methodName=*/"setDpsInitOperand", - /*args=*/(ins "int64_t":$i, "Value":$value), + /*args=*/(ins "int64_t":$i, "::mlir::Value":$value), /*methodBody=*/"", /*defaultImplementation=*/[{ assert(i >= 0 && i < $_op.getNumDpsInits()); @@ -135,7 +135,7 @@ >, InterfaceMethod< /*desc=*/"Return the input operands.", - /*retTy=*/"OpOperandVector", + /*retTy=*/"::mlir::OpOperandVector", /*methodName=*/"getDpsInputOperands", /*args=*/(ins), /*methodBody=*/"", @@ -144,7 +144,7 @@ int64_t numInits = end - start; int64_t numOperands = $_op.getNumOperands(); - OpOperandVector result; + ::mlir::OpOperandVector result; result.reserve(numOperands - numInits); for (int i = 0; i < start; ++i) result.push_back(&$_op->getOpOperand(i)); @@ -156,7 +156,7 @@ >, InterfaceMethod< /*desc=*/[{ Return the `i`-th input operand. }], - /*retTy=*/"OpOperand *", + /*retTy=*/"::mlir::OpOperand *", /*methodName=*/"getDpsInputOperand", /*args=*/(ins "int64_t":$i), /*methodBody=*/"", @@ -173,7 +173,7 @@ /*desc=*/"Return true if `opOperand` is an input.", /*retTy=*/"bool", /*methodName=*/"isDpsInput", - /*args=*/(ins "OpOperand *":$opOperand), + /*args=*/(ins "::mlir::OpOperand *":$opOperand), /*methodBody=*/"", /*defaultImplementation=*/[{ auto [start, end] = $_op.getDpsInitsPositionRange(); @@ -185,7 +185,7 @@ /*desc=*/"Return true if `opOperand` is an init.", /*retTy=*/"bool", /*methodName=*/"isDpsInit", - /*args=*/(ins "OpOperand *":$opOperand), + /*args=*/(ins "::mlir::OpOperand *":$opOperand), /*methodBody=*/"", /*defaultImplementation=*/[{ auto [start, end] = $_op.getDpsInitsPositionRange(); @@ -197,7 +197,7 @@ /*desc=*/"Return true if the `opOperand` is a scalar value.", /*retTy=*/"bool", /*methodName=*/"isScalar", - /*args=*/(ins "OpOperand *":$opOperand), + /*args=*/(ins "::mlir::OpOperand *":$opOperand), /*methodBody=*/"", /*defaultImplementation=*/[{ assert(opOperand->getOwner() == $_op.getOperation()); @@ -206,9 +206,9 @@ >, InterfaceMethod< /*desc=*/"Return the OpResult that is tied to the given OpOperand.", - /*retTy=*/"OpResult", + /*retTy=*/"::mlir::OpResult", /*methodName=*/"getTiedOpResult", - /*args=*/(ins "OpOperand *":$opOperand), + /*args=*/(ins "::mlir::OpOperand *":$opOperand), /*methodBody=*/"", /*defaultImplementation=*/[{ assert(opOperand->getOwner() == $_op.getOperation()); @@ -222,9 +222,9 @@ >, InterfaceMethod< /*desc=*/"Return the OpOperand that is tied to the given OpResult.", - /*retTy=*/"OpOperand *", + /*retTy=*/"::mlir::OpOperand *", /*methodName=*/"getTiedOpOperand", - /*args=*/(ins "OpResult":$opResult), + /*args=*/(ins "::mlir::OpResult":$opResult), /*methodBody=*/"", /*defaultImplementation=*/[{ assert(opResult.getDefiningOp() == $_op.getOperation()); @@ -242,10 +242,10 @@ /*methodBody=*/"", /*defaultImplementation=*/[{ return $_op->getNumResults() == 0 && - llvm::all_of($_op->getOpOperands(), - [&](OpOperand &opOperand) { + ::llvm::all_of($_op->getOpOperands(), + [&](::mlir::OpOperand &opOperand) { return isScalar(&opOperand) || - opOperand.get().getType().template isa(); + opOperand.get().getType().template isa<::mlir::MemRefType>(); }); }] >, @@ -256,10 +256,10 @@ /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ - return llvm::all_of($_op->getOpOperands(), - [&](OpOperand &opOperand) { + return ::llvm::all_of($_op->getOpOperands(), + [&](::mlir::OpOperand &opOperand) { return isScalar(&opOperand) || - opOperand.get().getType().template isa(); + opOperand.get().getType().template isa<::mlir::RankedTensorType>(); }); }] > diff --git a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td --- a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td +++ b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td @@ -61,35 +61,38 @@ /// Collect all of the effect instances that correspond to the given /// `Effect` and place them in 'effects'. template void getEffects( - SmallVectorImpl<::mlir::SideEffects::EffectInstance< + ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< }] # baseEffect # [{>> &effects) { getEffects(effects); - llvm::erase_if(effects, [&](auto &it) { - return !llvm::isa(it.getEffect()); + ::llvm::erase_if(effects, [&](auto &it) { + return !::llvm::isa(it.getEffect()); }); } /// Returns true if this operation exhibits the given effect. template bool hasEffect() { - SmallVector, 4> effects; + ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< + }] # baseEffect # [{>, 4> effects; getEffects(effects); - return llvm::any_of(effects, [](const auto &it) { - return llvm::isa(it.getEffect()); + return ::llvm::any_of(effects, [](const auto &it) { + return ::llvm::isa(it.getEffect()); }); } /// Returns true if this operation only has the given effect. template bool onlyHasEffect() { - SmallVector, 4> effects; + ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< + }] # baseEffect # [{>, 4> effects; getEffects(effects); - return !effects.empty() && llvm::all_of(effects, [](const auto &it) { + return !effects.empty() && ::llvm::all_of(effects, [](const auto &it) { return isa(it.getEffect()); }); } /// Returns true if this operation has no effects. bool hasNoEffect() { - SmallVector<::mlir::SideEffects::EffectInstance<}] # baseEffect # [{>, 4> effects; + ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< + }] # baseEffect # [{>, 4> effects; getEffects(effects); return effects.empty(); } @@ -97,10 +100,10 @@ /// Collect all of the effect instances that operate on the provided value /// and place them in 'effects'. void getEffectsOnValue(::mlir::Value value, - llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< + ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< }] # baseEffect # [{>> & effects) { getEffects(effects); - llvm::erase_if(effects, [&](auto &it) { return it.getValue() != value; }); + ::llvm::erase_if(effects, [&](auto &it) { return it.getValue() != value; }); } /// Return the effect of the given type `Effect` that is applied to the @@ -108,10 +111,10 @@ template ::std::optional<::mlir::SideEffects::EffectInstance<}] # baseEffect # [{>> getEffectOnValue(::mlir::Value value) { - llvm::SmallVector<::mlir::SideEffects::EffectInstance< + ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< }] # baseEffect # [{>, 4> effects; getEffects(effects); - auto it = llvm::find_if(effects, [&](auto &it) { + auto it = ::llvm::find_if(effects, [&](auto &it) { return isa(it.getEffect()) && it.getValue() == value; }); if (it == effects.end()) @@ -122,10 +125,10 @@ /// Collect all of the effect instances that operate on the provided symbol /// reference and place them in 'effects'. void getEffectsOnSymbol(::mlir::SymbolRefAttr value, - llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< + ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< }] # baseEffect # [{>> & effects) { getEffects(effects); - llvm::erase_if(effects, [&](auto &it) { + ::llvm::erase_if(effects, [&](auto &it) { return it.getSymbolRef() != value; }); } @@ -133,10 +136,10 @@ /// Collect all of the effect instances that operate on the provided /// resource and place them in 'effects'. void getEffectsOnResource(::mlir::SideEffects::Resource *resource, - llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< + ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< }] # baseEffect # [{>> & effects) { getEffects(effects); - llvm::erase_if(effects, [&](auto &it) { + ::llvm::erase_if(effects, [&](auto &it) { return it.getResource() != resource; }); }