From 4832f76396f8acac124c92523e896c4dd6cf1bd8 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 15 May 2020 21:40:25 -0500 Subject: [PATCH] Relocate initial system clock setup. This has nothing to do with registering agents. Moved to Runtime::Load. Change-Id: I0f84c9d8f5a68d458717111113f02af56c92f4f6 [ROCm/ROCR-Runtime commit: 40d1931209e2e7560b41c8ed694843f70189f23a] --- .../hsa-runtime/core/runtime/runtime.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp index 53b6e00917..74f13ba6ec 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -189,14 +189,6 @@ void Runtime::RegisterAgent(Agent* agent) { BaseShared::SetAllocateAndFree(system_allocator_, system_deallocator_); } - - // 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; - } } else if (agent->device_type() == Agent::DeviceType::kAmdGpuDevice) { gpu_agents_.push_back(agent); @@ -1289,6 +1281,15 @@ hsa_status_t Runtime::Load() { if (!amd::Load()) { return HSA_STATUS_ERROR_OUT_OF_RESOURCES; } + + // 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; + } + BindVmFaultHandler(); loader_ = amd::hsa::loader::Loader::Create(&loader_context_);