From commits-return-11142-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Sun Apr 12 00:06:07 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 49BE0180181 for ; Sun, 12 Apr 2020 02:06:06 +0200 (CEST) Received: (qmail 61132 invoked by uid 500); 12 Apr 2020 00:06:05 -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 61123 invoked by uid 99); 12 Apr 2020 00:06:05 -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; Sun, 12 Apr 2020 00:06:05 +0000 From: GitBox To: commits@tvm.apache.org Subject: [GitHub] [incubator-tvm] masahi commented on a change in pull request #5310: [BYOC] Enhance partitioning and external codegen Message-ID: <158664996554.25439.18314047084852105319.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Sun, 12 Apr 2020 00:06:05 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit masahi commented on a change in pull request #5310: [BYOC] Enhance partitioning and external codegen URL: https://github.com/apache/incubator-tvm/pull/5310#discussion_r407125302 ########## File path: src/relay/backend/contrib/dnnl/codegen.cc ########## @@ -128,42 +128,50 @@ std::vector Add(const CallNode* call) { // TODO(@zhiics, @comaniac): This is a basic implementation. We should implement // all utilities and make a base class for users to implement. -class CodegenDNNL : public ExprVisitor, public CodegenCBase { +class CodegenDNNL : public relay::ExprFunctor(const Expr&)>, + public CodegenCBase { public: explicit CodegenDNNL(const std::string& id) { this->ext_func_id_ = id; } - void VisitExpr_(const VarNode* node) final { + std::vector VisitExpr(const Expr& expr) final { + if (visited_.count(expr)) return visited_.at(expr); Review comment: I wonder why `ExprFunctor` doesn't have memoization built in? It would be nice if derived classes don't have to take care of this. ---------------------------------------------------------------- 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