tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] comaniac commented on a change in pull request #5310: [BYOC] Enhance partitioning and external codegen
Date Sun, 12 Apr 2020 00:16:15 GMT
comaniac commented on a change in pull request #5310: [BYOC] Enhance partitioning and external
codegen
URL: https://github.com/apache/incubator-tvm/pull/5310#discussion_r407125692
 
 

 ##########
 File path: src/relay/backend/contrib/codegen_c/codegen.cc
 ##########
 @@ -40,35 +40,44 @@ 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 relay::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;
+    if (expr.as<ConstantNode>()) {
+      output = VisitExpr_(expr.as<ConstantNode>());
+    } else if (expr.as<VarNode>()) {
+     output = VisitExpr_(expr.as<VarNode>());
+    } else if (expr.as<CallNode>()) {
+     output = VisitExpr_(expr.as<CallNode>());
+    } else {
+     LOG(FATAL) << "DNNL codegen doesn't support: " << expr->GetTypeKey();
 
 Review comment:
   s/DNNL/C (or something more proper)/

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

Mime
View raw message