areusch commented on a change in pull request #7952:
URL: https://github.com/apache/tvm/pull/7952#discussion_r639957850



##########
File path: src/ir/transform.cc
##########
@@ -162,170 +166,86 @@ void PassContext::RegisterConfigOption(const char* key, 
uint32_t value_type_inde
 
 PassContext PassContext::Create() { return 
PassContext(make_object<PassContextNode>()); }
 
-void PassContext::Trace(const IRModule& module, const PassInfo& info, bool 
is_before) const {
+void PassContext::InstrumentEnterPassContext() {
   auto pass_ctx_node = this->operator->();
-  if (pass_ctx_node->trace_func != nullptr) {
-    pass_ctx_node->trace_func(module, info, is_before);
+  if (pass_ctx_node->instruments.defined()) {
+    try {
+      for (instrument::PassInstrument pi : pass_ctx_node->instruments) {
+        pi->EnterPassContext();
+      }
+    } catch (const Error& e) {
+      LOG(INFO) << "Pass instrumentation entering pass context failed.";
+      LOG(INFO) << "Disable pass instrumentation.";
+      pass_ctx_node->instruments.clear();

Review comment:
       here is where I'm suggesting you should call `pi->ExitPassContext()` for 
all `pi` whose `EnterPassContext` has successfully returned so far.




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


Reply via email to