tkonolige commented on a change in pull request #7472:
URL: https://github.com/apache/tvm/pull/7472#discussion_r580557454



##########
File path: src/runtime/cuda/cuda_device_api.cc
##########
@@ -241,5 +242,28 @@ 
TVM_REGISTER_GLOBAL("device_api.cpu_pinned").set_body([](TVMArgs args, TVMRetVal
   *rv = static_cast<void*>(ptr);
 });
 
+TVM_REGISTER_GLOBAL("profiling.timer.gpu").set_body_typed([](TVMContext ctx) {
+  cudaEvent_t start;
+  cudaEvent_t stop;
+  cudaEventCreate(&start);
+  cudaEventCreate(&stop);
+  cudaEventRecord(start, CUDAThreadEntry::ThreadLocal()->stream);
+  return TypedPackedFunc<TypedPackedFunc<int64_t()>()>(
+      [=]() {
+        cudaEventRecord(stop, CUDAThreadEntry::ThreadLocal()->stream);
+        return TypedPackedFunc<int64_t()>(
+            [=]() -> int64_t {
+              cudaEventSynchronize(stop);
+              float milliseconds = 0;

Review comment:
       `stop` is an opaque type copied from above. I am unsure if the allocator 
will be called. If so, it will be for allocating the closure.




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