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_r407127503
##########
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:
Well it is not necessary, but it would be nice if we could add memo there.
We don't have to add this overide in `CodegenDNN` and we can remove many duped
logic in other derived classes.
But since that would be a big change, I agree that we should proceed with
this impl for now.
----------------------------------------------------------------
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