ROCm / roctracer

ROCm Tracer Callback/Activity Library for Performance tracing AMD GPUs
https://rocm.docs.amd.com/projects/roctracer/en/latest/
Other
69 stars 30 forks source link

Is `roctracer_get_timestamp` is device specific? #65

Closed bertwesarg closed 1 year ago

bertwesarg commented 2 years ago

Having multiple devices, does roctracer_get_timestamp provides a device specific timestamp? I.e., does this depends on hipSetDevice?

Additionally, is it allowed to call this from inside the roctracer_properties_t::buffer_callback_fun pool callback?

bertwesarg commented 2 years ago

BTW, I'm not allowed to call roctracer_get_timestamp early on. Not sure, what I need to call to ensure that I'm allowed to call it, but its not roctracer_load. But after hipGetDeviceProperties its ok.

The error I get is:

Error Calling hsa_iterate_agents: HSA_STATUS_ERROR_NOT_INITIALIZED: An API other than hsa_init has been invoked while the reference count of the HSA runtime is zero.
Aborted (core dumped)

Its actually no surprise, as HsaRsrcFactory::Instance() does not initialize HSA, if needed. See

https://github.com/ROCm-Developer-Tools/roctracer/blob/f32619b8f109d48281bc1d684f93951e0589bd2e/src/util/hsa_rsrc_factory.h#L287

bertwesarg commented 2 years ago

Have a work around. Close for now.

lmoriche commented 1 year ago

roctracer_get_timestamp returns a system monotonic clock. All timestamps returned by the tracer are in the same clock domain. You can call roctracer_get_timestamp from API callbacks or memory pool callbacks.