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/02 18:59:41 UTC
[GitHub] [incubator-tvm] ANSHUMAN87 opened a new pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
ANSHUMAN87 opened a new pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717
Refer #5318
@tqchen, @jroesch : Please help review, Thanks!
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] tqchen closed pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
tqchen closed pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
tqchen commented on a change in pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717#discussion_r436047427
##########
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:
Would be interesting to see what error message you got. As copy constructor is clearly defined in there.
We can also use `With<PassContext> fresh_pass_ctx_scope();`, which invokes the default constructor(in this case the new pass context.
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] ANSHUMAN87 commented on a change in pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
ANSHUMAN87 commented on a change in pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717#discussion_r434657083
##########
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:
@tqchen : Thanks! I tried with copy constructor [using](https://github.com/apache/incubator-tvm/blob/9151a519b9495483a3d2bf552c8d6cf02e2302a3/include/tvm/runtime/object.h#L686), but it did not work out.
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] tqchen commented on pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717#issuecomment-676852215
close for now and let us revisit later. Thanks @ANSHUMAN87
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] ANSHUMAN87 commented on a change in pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
ANSHUMAN87 commented on a change in pull request #5717:
URL: https://github.com/apache/incubator-tvm/pull/5717#discussion_r436801796
##########
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:
@tqchen : Sorry for late reply! If i dont use static_cast [the testcase fails with additional assert](https://github.com/apache/incubator-tvm/blob/6ae439c8c58dd0118d2f2c5d1c4bcb650df47104/tests/python/relay/test_pass_manager.py#L555) count.
##########
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:
@tqchen : I have changed it to default constructor now, please check. Thanks!
##########
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:
> @tqchen : I have changed it to default constructor now, please check. Thanks!
@tqchen : Sorry! This change does not work. I made a mistake in code build, cause of that it got passed last time! So i have to use static_cast for the test case to pass.
##########
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:
@tqchen : Any thoughts on this comment?
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5717: [REFACTOR][IR] Migrate Pass/PassContext ObjectRef to not-null
Posted by GitBox <gi...@apache.org>.
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