d-smirnov commented on a change in pull request #6655:
URL: https://github.com/apache/incubator-tvm/pull/6655#discussion_r529015930



##########
File path: src/relay/transforms/annotate_target.cc
##########
@@ -61,20 +67,27 @@ class AnnotateTargetRewriter : public ExprRewriter {
   std::pair<std::string, Array<Expr>> AnnotateArgs(const Array<Expr>& args,
                                                    const std::string& target = 
"") {
     std::string ref_target = "";
+    Array<Expr> compiler_begins;
     Array<Expr> compiler_ends;
     for (auto arg : args) {
-      std::string arg_target = "default";
+      std::string arg_target = default_target;
       const CallNode* call = arg.as<CallNode>();
 
       if (call && call->op == CompilerBeginOp()) {
         // Argument is already compiler begin node meaning that this is not 
the first time
         // running this pass, so we simply remove it and will add a new one 
later.
         ICHECK_EQ(call->args.size(), 1U);
+        // Do not alter existing annotation if not default
+        if (default_target != call->attrs.as<CompilerAttrs>()->compiler) {
+          compiler_begins.push_back(arg);
+        } else {
+          // Remove default
+          compiler_ends.push_back(call->args[0]);
+        }

Review comment:
       The proposal is likely to be more flexible. But I am afraid that 
introducing an externally defined method for doing pruning also means 
introducing a more elaborate checker for IR as it should be clearly stated what 
is the correctly pruned graph and what is not.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to