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



##########
File path: src/relay/transforms/annotate_target.cc
##########
@@ -146,13 +179,19 @@ class AnnotateTargetRewriter : public ExprRewriter {
       // Bypass compiler begin due to lack of target information. It will be 
processed
       // when the following op handling arguments.
       ICHECK_EQ(pre->args.size(), 1U);
-      return post.as<CallNode>()->args[0];
+      // Preserve annotations
+      return post;
     } else if (op_node && pre->op == CompilerEndOp()) {
       // Override compiler end with the new target.
       ICHECK_EQ(pre->args.size(), 1U);
       auto input_expr = post.as<CallNode>()->args[0];
+      // Already annotated. Recover target
+      if (op_expr_to_target_.find(input_expr) == op_expr_to_target_.end()) {
+        op_expr_to_target_[input_expr] = 
post.as<CallNode>()->attrs.as<CompilerAttrs>()->compiler;
+      }

Review comment:
       Removed IF




----------------------------------------------------------------
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