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_r407264492
 
 

 ##########
 File path: src/relay/backend/contrib/codegen_c/codegen.cc
 ##########
 @@ -40,35 +40,40 @@ using namespace backend;
  * purpose. Only several binary options are covered. Users
  * may need to extend them to cover more operators.
  */
-class CodegenC : public ExprVisitor, public CodegenCBase {
+class CodegenC : public ExprFunctor<std::vector<Output>(const Expr&)>,
+                 public CodegenCBase {
  public:
   explicit CodegenC(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);
+    std::vector<Output> output =
+        ExprFunctor<std::vector<Output>(const Expr&)>::VisitExpr(expr);
 
 Review comment:
   You can drop the type qualification in the base class call and simplify this 
to
   ```
   auto output = ExprFunctor::VisitExpr(expr);
   ```

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