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



##########
File path: src/runtime/profiling.cc
##########
@@ -431,7 +442,29 @@ Report Profiler::Report(bool aggregate, bool sort) {
     rows.push_back(row);
   }
 
-  return profiling::Report(rows, device_metrics);
+  // the last couple of call frames are the overall times
+  double overall_time = 0;

Review comment:
       still suggest this

##########
File path: src/runtime/profiling.cc
##########
@@ -118,14 +141,21 @@ void Profiler::StopCall(std::unordered_map<std::string, 
ObjectRef> extra_metrics
   for (auto& p : extra_metrics) {
     cf.extra_metrics[p.first] = p.second;
   }
+  // collect the extra metrics from user defined collectors
+  for (const auto& obj : cf.extra_collectors) {
+    auto collector_metrics = obj.first->Stop(obj.second);
+    for (auto& p : collector_metrics) {
+      cf.extra_metrics[p.first] = p.second;
+    }
+  }
   in_flight_.pop();
   calls_.push_back(cf);
 }
 
 void Profiler::Stop() {
-  // Stop all global timers. We wait to synchronize until we are making the 
report.
-  for (auto p : global_timers_) {
-    p.second->Stop();
+  is_running_ = false;

Review comment:
       any thoughts on how errors should get handled here?

##########
File path: python/tvm/contrib/debugger/debug_executor.py
##########
@@ -268,14 +268,18 @@ def run_individual(self, number, repeat=1, 
min_repeat_ms=0):
         ret = self._run_individual(number, repeat, min_repeat_ms)
         return ret.strip(",").split(",") if ret else []
 
-    def profile(self, **input_dict):
+    def profile(self, collectors=[], **input_dict):  # pylint: 
disable=dangerous-default-value

Review comment:
       yeah don't use a list as a kwarg default. Instead, use None, and say 
`collectors = collectors if collectors is not None else []` in function body




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to