[Mlir-commits] [mlir] 6da0184 - [mlir][NFC] Use fully qualified C++ namespaces in .td files.

Vladislav Vinogradov llvmlistbot at llvm.org
Mon Feb 6 04:54:44 PST 2023


Author: Vladislav Vinogradov
Date: 2023-02-06T15:54:21+03:00
New Revision: 6da0184bbc415a1c48995d8b779f476440a094ec

URL: https://github.com/llvm/llvm-project/commit/6da0184bbc415a1c48995d8b779f476440a094ec
DIFF: https://github.com/llvm/llvm-project/commit/6da0184bbc415a1c48995d8b779f476440a094ec.diff

LOG: [mlir][NFC] Use fully qualified C++ namespaces in .td files.

Add missing llvm:: and mlir:: namespaces qualifiers to some auto-generated code.

Reviewed By: ftynse, springerm

Differential Revision: https://reviews.llvm.org/D143381

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
    mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td
    mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
index f588d919cdad1..04d3b4018f7ec 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
@@ -463,7 +463,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
         /*args=*/(ins "unsigned":$index),
         /*methodBody=*/"",
         /*defaultImplementation=*/[{
-          return mlir::bufferization::detail::defaultIsRepetitiveRegion(
+          return ::mlir::bufferization::detail::defaultIsRepetitiveRegion(
               cast<BufferizableOpInterface>($_op.getOperation()), index);
         }]
       >
@@ -472,8 +472,9 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
   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 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
     /// 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<BufferizableOpInterface>(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
index 708040e434de9..a443b49a2f2a1 100644
--- a/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td
+++ b/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td
@@ -85,14 +85,14 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     InterfaceMethod<
       /*desc=*/"Return the input operands.",
-      /*retTy=*/"OpOperandVector",
+      /*retTy=*/"::mlir::OpOperandVector",
       /*methodName=*/"getDpsInputOperands",
       /*args=*/(ins),
       /*methodBody=*/"",
@@ -144,7 +144,7 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
         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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
     >,
     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 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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<MemRefType>();
+                     opOperand.get().getType().template isa<::mlir::MemRefType>();
             });
       }]
     >,
@@ -256,10 +256,10 @@ def DestinationStyleOpInterface : OpInterface<"DestinationStyleOpInterface"> {
       /*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<RankedTensorType>();
+                   opOperand.get().getType().template isa<::mlir::RankedTensorType>();
           });
       }]
     >

diff  --git a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
index bbf2392114626..15c58ab274c45 100644
--- a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
+++ b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
@@ -61,35 +61,38 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     /// Collect all of the effect instances that correspond to the given
     /// `Effect` and place them in 'effects'.
     template <typename Effect> void getEffects(
-      SmallVectorImpl<::mlir::SideEffects::EffectInstance<
+      ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<
                                               }] # baseEffect # [{>> &effects) {
       getEffects(effects);
-      llvm::erase_if(effects, [&](auto &it) {
-        return !llvm::isa<Effect>(it.getEffect());
+      ::llvm::erase_if(effects, [&](auto &it) {
+        return !::llvm::isa<Effect>(it.getEffect());
       });
     }
 
     /// Returns true if this operation exhibits the given effect.
     template <typename Effect> bool hasEffect() {
-      SmallVector<SideEffects::EffectInstance<}] # baseEffect # [{>, 4> effects;
+      ::llvm::SmallVector<::mlir::SideEffects::EffectInstance<
+                                            }] # baseEffect # [{>, 4> effects;
       getEffects(effects);
-      return llvm::any_of(effects, [](const auto &it) {
-        return llvm::isa<Effect>(it.getEffect());
+      return ::llvm::any_of(effects, [](const auto &it) {
+        return ::llvm::isa<Effect>(it.getEffect());
       });
     }
 
     /// Returns true if this operation only has the given effect.
     template <typename Effect> bool onlyHasEffect() {
-      SmallVector<SideEffects::EffectInstance<}] # baseEffect # [{>, 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<Effect>(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 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     /// 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 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     template <typename Effect>
     ::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<Effect>(it.getEffect()) && it.getValue() == value;
       });
       if (it == effects.end())
@@ -122,10 +125,10 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     /// 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 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     /// 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;
       });
     }


        


More information about the Mlir-commits mailing list