[Mlir-commits] [mlir] d989ae9 - [mlir][SIdeEffectInterface][NFC] Move several InterfaceMethods to the extraClassDeclarations instead

River Riddle llvmlistbot at llvm.org
Tue Oct 27 16:21:25 PDT 2020


Author: River Riddle
Date: 2020-10-27T16:16:51-07:00
New Revision: d989ae90693ec2d1b7e048a7b48cbab3cfa8123b

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

LOG: [mlir][SIdeEffectInterface][NFC] Move several InterfaceMethods to the extraClassDeclarations instead

All InterfaceMethods will have a corresponding entry in the interface model, and by extension have an implementation generated for every operation type. This can result in large binary size increases when a large amount of operations use an interface, such as the side effect interface.

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

Added: 
    

Modified: 
    mlir/include/mlir/Interfaces/SideEffectInterfaces.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Interfaces/SideEffectInterfaces.td b/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
index f1498fbe10f3..4f26cb98a41b 100644
--- a/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
+++ b/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
@@ -54,33 +54,6 @@ class EffectOpInterfaceBase<string name, string baseEffect>
          (ins "SmallVectorImpl<::mlir::SideEffects::EffectInstance<"
               # baseEffect # ">> &":$effects)
     >,
-    InterfaceMethod<[{
-        Collects all of the operation's effects into `effects`.
-      }],
-      "void", "getEffectsOnValue",
-         (ins "Value":$value,
-              "SmallVectorImpl<::mlir::SideEffects::EffectInstance<"
-              # baseEffect # ">> &":$effects), [{
-          $_op.getEffects(effects);
-          llvm::erase_if(effects, [&](auto &it) {
-            return it.getValue() != value;
-          });
-       }]
-    >,
-    InterfaceMethod<[{
-        Collects all of the effects that are exhibited by this operation on the
-        given resource and place them in 'effects'.
-      }],
-      "void", "getEffectsOnResource",
-         (ins "SideEffects::Resource *":$resource,
-              "SmallVectorImpl<::mlir::SideEffects::EffectInstance<"
-              # baseEffect # ">> &":$effects), [{
-          $_op.getEffects(effects);
-          llvm::erase_if(effects, [&](auto &it) {
-            return it.getResource() != resource;
-          });
-       }]
-    >
   ];
 
   let extraClassDeclaration = [{
@@ -126,6 +99,26 @@ class EffectOpInterfaceBase<string name, string baseEffect>
         return interface.hasNoEffect();
       return op->hasTrait<::mlir::OpTrait::HasRecursiveSideEffects>();
     }
+
+    /// 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<
+              }] # baseEffect # [{>> & effects) {
+      getEffects(effects);
+      llvm::erase_if(effects, [&](auto &it) { return it.getValue() != value; });
+    }
+
+    /// Collect all of the effect instances that operate on the provided
+    /// resource and place them in 'effects'.
+    void getEffectsOnValue(::mlir::SideEffects::Resource *resource,
+              llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<
+              }] # baseEffect # [{>> & effects) {
+      getEffects(effects);
+      llvm::erase_if(effects, [&](auto &it) {
+        return it.getResource() != resource;
+      });
+    }
   }];
 
   // The base effect name of this interface.


        


More information about the Mlir-commits mailing list