Switch to CLOCK_BOOTTIME for HSA system clock.

This is consistent with KFD and has significantly better latency.
KFD is taking this as the definition of the SystemClockCounter.

Change-Id: I4c1b3bc58c738206265c55ebefd41356c013bfe5
This commit is contained in:
Sean Keely
2022-04-27 20:16:54 -05:00
parent cd0788938c
commit 0ee82742a7
4 changed files with 40 additions and 7 deletions
+3 -7
View File
@@ -580,9 +580,7 @@ hsa_status_t Runtime::GetSystemInfo(hsa_system_info_t attribute, void* value) {
*((uint16_t*)value) = HSA_VERSION_MINOR;
break;
case HSA_SYSTEM_INFO_TIMESTAMP: {
HsaClockCounters clocks;
hsaKmtGetClockCounters(0, &clocks);
*((uint64_t*)value) = clocks.SystemClockCounter;
*((uint64_t*)value) = os::ReadSystemClock();
break;
}
case HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY: {
@@ -1349,10 +1347,8 @@ hsa_status_t Runtime::Load() {
// Setup system clock frequency for the first time.
if (sys_clock_freq_ == 0) {
// Cache system clock frequency
HsaClockCounters clocks;
hsaKmtGetClockCounters(0, &clocks);
sys_clock_freq_ = clocks.SystemClockFrequencyHz;
sys_clock_freq_ = os::SystemClockFrequency();
if (sys_clock_freq_ < 100000) debug_warning("System clock resolution is low.");
}
BindVmFaultHandler();