Correct timestamp skew adjustments for kernel and async copy tracing (#827)

This commit is contained in:
Jonathan R. Madsen
2024-04-25 14:36:11 -05:00
zatwierdzone przez GitHub
rodzic 733aa8e438
commit e2bce49655
2 zmienionych plików z 25 dodań i 9 usunięć
@@ -340,6 +340,14 @@ operator+=(hsa_amd_profiling_async_copy_time_t& lhs, uint64_t rhs)
return lhs;
}
hsa_amd_profiling_async_copy_time_t&
operator-=(hsa_amd_profiling_async_copy_time_t& lhs, uint64_t rhs)
{
lhs.start -= rhs;
lhs.end -= rhs;
return lhs;
}
hsa_amd_profiling_async_copy_time_t&
operator*=(hsa_amd_profiling_async_copy_time_t& lhs, uint64_t rhs)
{
@@ -377,15 +385,15 @@ async_copy_handler(hsa_signal_value_t signal_value, void* arg)
// normalize
copy_time *= sysclock_period;
// below is a hack for clock skew issues:
// the timestamp of this handler for the copy will always be after when the copy ended
if(ts < copy_time.end) copy_time -= (copy_time.end - ts);
// below is a hack for clock skew issues:
// the timestamp of the function call triggering the copy will always be before when the copy
// started
if(copy_time.start < _data->start_ts) copy_time += (_data->start_ts - copy_time.start);
// below is a hack for clock skew issues:
// the timestamp of this handler for the copy will always be after when the copy ended
if(copy_time.end < ts) copy_time += (ts - copy_time.end);
// if we encounter this in CI, it will cause test to fail
ROCP_CI_LOG_IF(ERROR, copy_time_status == HSA_STATUS_SUCCESS && copy_time.end < copy_time.start)
<< "hsa_amd_profiling_get_async_copy_time for returned async times where the end time ("