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_r407126346
 
 

 ##########
 File path: src/relay/backend/contrib/dnnl/codegen.cc
 ##########
 @@ -128,42 +128,50 @@ std::vector<std::string> 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<std::vector<Output>(const 
Expr&)>,
+                    public CodegenCBase {
  public:
   explicit CodegenDNNL(const std::string& id) { this->ext_func_id_ = id; }
 
-  void VisitExpr_(const VarNode* node) final {
+  std::vector<Output> VisitExpr(const Expr& expr) final {
+    if (visited_.count(expr)) return visited_.at(expr);
 
 Review comment:
   hmm but it does have one dispatching function 
   
https://github.com/apache/incubator-tvm/blob/master/include/tvm/relay/expr_functor.h#L93
   
   Why can't we have memoization there? If a derived class wants a custom 
memoization it can overide this method.

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


With regards,
Apache Git Services

Reply via email to