You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/03 15:07:36 UTC

[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null

tqchen commented on a change in pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717#discussion_r434639667



##########
File path: src/relay/backend/compile_engine.cc
##########
@@ -689,7 +689,7 @@ class CompileEngineImpl : public CompileEngineNode {
       cache_node->funcs = (*f)(cfunc->schedule, all_args, cache_node->func_name, key->source_func);
     } else {
       using tvm::transform::PassContext;
-      With<PassContext> fresh_pass_ctx_scope(PassContext::Create());
+      With<PassContext> fresh_pass_ctx_scope(static_cast<PassContext>(PassContext()));

Review comment:
       I don't think static cast would be necessary here, With<PassContext> fresh_pass_ctx_scope(PassContext()); should suffice once we defined the copy constructor

##########
File path: include/tvm/ir/transform.h
##########
@@ -161,7 +161,7 @@ class PassContextNode : public Object {
  */
 class PassContext : public ObjectRef {
  public:
-  PassContext() {}
+  PassContext() : PassContext(make_object<PassContextNode>()) {}

Review comment:
       use https://github.com/apache/incubator-tvm/blob/master/include/tvm/runtime/object.h#L712 and add  `PassContextNode* operator->()`; you will need copy constructor and other things now that default constructor is defined in a different way.




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