From commits-return-10049-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Wed Apr 1 00:11:13 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8913D180181 for ; Wed, 1 Apr 2020 02:11:13 +0200 (CEST) Received: (qmail 48819 invoked by uid 500); 1 Apr 2020 00:11:13 -0000 Mailing-List: contact commits-help@tvm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tvm.apache.org Delivered-To: mailing list commits@tvm.apache.org Received: (qmail 48779 invoked by uid 99); 1 Apr 2020 00:11:12 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Apr 2020 00:11:12 +0000 From: GitBox To: commits@tvm.apache.org Subject: [GitHub] [incubator-tvm] zhiics commented on a change in pull request #5195: [RELAY] Fixes to MergeCompilerRegions Message-ID: <158569987287.27607.8638238658793669501.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Wed, 01 Apr 2020 00:11:12 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit zhiics commented on a change in pull request #5195: [RELAY] Fixes to MergeCompilerRegions URL: https://github.com/apache/incubator-tvm/pull/5195#discussion_r401284934 ########## File path: src/relay/transforms/merge_compiler_regions.cc ########## @@ -86,126 +86,145 @@ class AnnotateRestDefault : public ExprMutator { } /*! \brief This function adds compiler ends to nodes that - * have a region AND they should not be arguments of the - * original function + * don't belong to a region already (default). * \param expr The expression to add a compiler end to. * \return expr The expression with or without a compiler end added. */ - Expr AddCompilerEnd(const Expr& expr) { - auto region = regions_->GetRegion(expr); - auto visited_expr = VisitExpr(expr); - - // The compiler ends are added to nodes that does have a region - // AND they should not be arguments of the original function - if (!region.defined() && - std::find(func_->params.begin(), - func_->params.end(), visited_expr) - == func_->params.end()) { - return AddCompilerEnd_(visited_expr); + Expr InsertEnd(const Expr& expr) { + if (annotated_nodes_.find(expr) == annotated_nodes_.end() && + !expr->IsInstance() && !expr->IsInstance()) { + const auto *end_op = + runtime::Registry::Get("relay.op.annotation._make.compiler_end"); + CHECK(end_op); + Expr end = (*end_op)(expr, target_); + return end; } - return visited_expr; + return expr; } - Expr AddCompilerEnd_(const Expr& expr) { - const auto* end_op = - runtime::Registry::Get("relay.op.annotation._make.compiler_end"); - CHECK(end_op); - Expr end = (*end_op)(expr, target_); - return end; + /*! \brief This function adds compiler begins to nodes that + * don't belong to a region already (default). + * \param expr The expression to add a compiler begin to. + * \return expr The expression with or without a compiler begin added. + */ + Expr InsertBegin(const Expr& expr) { + const auto *begin_op = Review comment: const auto* ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services