areusch commented on a change in pull request #7472:
URL: https://github.com/apache/tvm/pull/7472#discussion_r580609241
##########
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:
I guess chatting further--I think we already generally are not timing
right inside the kernel functions. at a later time if we start doing that, i'd
like us to consider things at this level, but we don't need to alter the whole
approach. we may be able to help though by moving the std::function
instantiation to the Start() call
----------------------------------------------------------------
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]