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



##########
File path: src/relay/transforms/annotate_target.cc
##########
@@ -62,19 +65,22 @@ class AnnotateTargetRewriter : public ExprRewriter {
                                                    const std::string& target = 
"") {
     std::string ref_target = "";
     Array<Expr> compiler_ends;
+    Array<Expr> compiler_begins;
     for (auto arg : args) {
-      std::string arg_target = "default";
+      std::string arg_target = DEFAULT_TARGET_NAME;
       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.
         CHECK_EQ(call->args.size(), 1U);
         const CallNode* end = call->args[0].as<CallNode>();
-        if (end->op == CompilerEndOp()) {
+        if (end && end->op == CompilerEndOp()) {
           arg_target = end->attrs.as<CompilerAttrs>()->compiler;
         }
-        compiler_ends.push_back(call->args[0]);
+        if (arg_target == "" || arg_target == DEFAULT_TARGET_NAME)
+          compiler_ends.push_back(call->args[0]);
+        else
+          compiler_begins.push_back(arg);

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