areusch commented on a change in pull request #7472:
URL: https://github.com/apache/tvm/pull/7472#discussion_r580561767
##########
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:
it matters a lot when the allocator is called relative to the timing
calls, and being able to understand that just from reading the code is quite
valuable
----------------------------------------------------------------
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]