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 2022/05/27 21:19:05 UTC

[GitHub] [tvm] gigiblender opened a new pull request, #11498: Add utility that asserts that input IRModule is not mutated in a pass.

gigiblender opened a new pull request, #11498:
URL: https://github.com/apache/tvm/pull/11498

   This PR adds a utility for testing purposes that asserts an IRModule used as input to a pass is not modified in place.
   
   The `testing.immutable_module` option can be set to true in a `PassContext` to enable the assertion.


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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] masahi merged pull request #11498: Add utility that asserts that input IRModule is not mutated in a pass.

Posted by GitBox <gi...@apache.org>.
masahi merged PR #11498:
URL: https://github.com/apache/tvm/pull/11498


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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] areusch commented on a diff in pull request #11498: Add utility that asserts that input IRModule is not mutated in a pass.

Posted by GitBox <gi...@apache.org>.
areusch commented on code in PR #11498:
URL: https://github.com/apache/tvm/pull/11498#discussion_r885933590


##########
src/ir/transform.cc:
##########
@@ -264,11 +267,31 @@ IRModule Pass::operator()(IRModule mod, const PassContext& pass_ctx) const {
                << " with opt level: " << pass_info->opt_level;
     return mod;
   }
-  auto ret = node->operator()(std::move(mod), pass_ctx);
+  IRModule ret;
+  if (pass_ctx->GetConfig<Bool>("testing.immutable_module", Bool(false)).value()) {
+    ret = Pass::AssertImmutableModule(mod, node, pass_ctx);
+  } else {
+    ret = node->operator()(std::move(mod), pass_ctx);
+  }
   pass_ctx.InstrumentAfterPass(ret, pass_info);
   return std::move(ret);
 }
 
+IRModule Pass::AssertImmutableModule(const IRModule& mod, const PassNode* node,

Review Comment:
   suggest not taking `const IRModule&`--instead take `IRModule`. right now this is basically re-implemeting the copy constructor rather than just using it



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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org