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_r407125271
##########
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>());
Review comment:
indent (and rest bodies in else if).
----------------------------------------------------------------
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