mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Defer Sysman Frequency Initialization
With this change, init for sysman Frequency API would not be done during zeInit. Rather init and thereby Frequency API handle creation would be done only when user explicitly requests to enumerate handles using zesDeviceEnumFrequencyDomains. Related-To: LOCI-3127 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f53ae0a50e
commit
97a3368aad
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "level_zero/tools/source/sysman/frequency/frequency_imp.h"
|
||||
#include "level_zero/tools/source/sysman/frequency/os_frequency.h"
|
||||
#include "level_zero/tools/source/sysman/os_sysman.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
@@ -37,6 +38,9 @@ ze_result_t FrequencyHandleContext::init(std::vector<ze_device_handle_t> &device
|
||||
}
|
||||
|
||||
ze_result_t FrequencyHandleContext::frequencyGet(uint32_t *pCount, zes_freq_handle_t *phFrequency) {
|
||||
std::call_once(initFrequencyOnce, [this]() {
|
||||
this->init(pOsSysman->getDeviceHandles());
|
||||
});
|
||||
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
|
||||
uint32_t numToCopy = std::min(*pCount, handleListSize);
|
||||
if (0 == *pCount || *pCount > handleListSize) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
struct _zes_freq_handle_t {
|
||||
@@ -64,6 +65,7 @@ struct FrequencyHandleContext {
|
||||
|
||||
private:
|
||||
void createHandle(ze_device_handle_t deviceHandle, zes_freq_domain_t frequencyDomain);
|
||||
std::once_flag initFrequencyOnce;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -100,9 +100,6 @@ ze_result_t SysmanDeviceImp::init() {
|
||||
if (pPowerHandleContext) {
|
||||
pPowerHandleContext->init(deviceHandles, hCoreDevice);
|
||||
}
|
||||
if (pFrequencyHandleContext) {
|
||||
pFrequencyHandleContext->init(deviceHandles);
|
||||
}
|
||||
if (pFabricPortHandleContext) {
|
||||
pFabricPortHandleContext->init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user