I was using it with a LocalSession, but removed the RPC context entirely to check, if something changes and am now getting an error message instead of just the execution time:
Traceback (most recent call last):
File "/home/max/collector/model_loader_mxnet_vision.py", line 321, in <module>
test_data = debug_g_mod.profile(collectors=[tvm.runtime.profiling.PAPIMetricCollector({dev: metrics})])
File "/home/max/papi_tvm/tvm/python/tvm/contrib/debugger/debug_executor.py", line 292, in profile
return self._profile(collectors)
File "/home/max/papi_tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
4: TVMFuncCall
3: std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::runtime::TypedPackedFunc<tvm::runtime::profiling::Report (tvm::runtime::Array<tvm::runtime::profiling::MetricCollector, void>)>::AssignTypedLambda<tvm::runtime::GraphExecutorDebug::GetFunction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::Array<tvm::runtime::profiling::MetricCollector, void>)#5}>(tvm::runtime::GraphExecutorDebug::GetFunction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::Array<tvm::runtime::profiling::MetricCollector, void>)#5})::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)
2: tvm::runtime::GraphExecutorDebug::Profile(tvm::runtime::Array<tvm::runtime::profiling::MetricCollector, void>)
1: tvm::runtime::profiling::Profiler::Profiler(std::vector<DLDevice, std::allocator<DLDevice> >, std::vector<tvm::runtime::profiling::MetricCollector, std::allocator<tvm::runtime::profiling::MetricCollector> >)
0: tvm::runtime::profiling::PAPIMetricCollectorNode::Init(tvm::runtime::Array<tvm::runtime::profiling::DeviceWrapper, void>)
File "/home/max/papi_tvm/tvm/src/runtime/contrib/papi/papi.cc", line 199
PAPIError: -7 Event does not exist: cuda::event::elapsed_cycles_sm:device=0.
I suspect that I made a mistake while compiling TVM for PAPI as these events are listed when executing./papi_native_avail
To compile your PR, I added USE_PAPI to the config.cmake and set it to the path of the installation directory of PAPI. In addition I included the include directory of PAPI to access its header files as it would not compile otherwise.