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



##########
File path: src/relay/transforms/annotate_target.cc
##########
@@ -113,18 +118,26 @@ class AnnotateTargetRewriter : public ExprRewriter {
     std::vector<std::string> supported_targets;
 
     auto op_node = pre->op.as<OpNode>();
-
     // This graph has annotations, meaning that this is not the first time 
running this pass.
     if (op_node && pre->op == CompilerBeginOp()) {
       // Bypass compiler begin due to lack of target information. It will be 
processed
       // when the following op handling arguments.
       CHECK_EQ(pre->args.size(), 1U);
-      return post.as<CallNode>()->args[0];
+
+      std::string begin_target = pre->attrs.as<CompilerAttrs>()->compiler;
+      if ("" == begin_target || begin_target == DEFAULT_TARGET_NAME)
+        return post.as<CallNode>()->args[0];
+
+      return post;
     } else if (op_node && pre->op == CompilerEndOp()) {
       // Override compiler end with the new target.
       CHECK_EQ(pre->args.size(), 1U);
       auto input_expr = post.as<CallNode>()->args[0];
       CHECK(op_expr_to_target_.find(input_expr) != op_expr_to_target_.end());
+
+      std::string begin_target = pre->attrs.as<CompilerAttrs>()->compiler;
+      if ("" != begin_target && begin_target != DEFAULT_TARGET_NAME) return 
post;

Review comment:
       Refactored




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to