mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Defer Sysman Standby Module Initialization
With this change, init for sysman Standby API would not be done during zeInit. Rather init and thereby Standby API handle creation would be done only when user explicitly requests to enumerate handles using zesDeviceEnumStandbyDomains. 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
e1748ad436
commit
aadf424476
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -36,6 +36,9 @@ ze_result_t StandbyHandleContext::init(std::vector<ze_device_handle_t> &deviceHa
|
||||
}
|
||||
|
||||
ze_result_t StandbyHandleContext::standbyGet(uint32_t *pCount, zes_standby_handle_t *phStandby) {
|
||||
std::call_once(initStandbyOnce, [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_standby_handle_t {
|
||||
@@ -47,6 +48,7 @@ struct StandbyHandleContext {
|
||||
|
||||
private:
|
||||
void createHandle(ze_device_handle_t deviceHandle);
|
||||
std::once_flag initStandbyOnce;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -106,9 +106,6 @@ ze_result_t SysmanDeviceImp::init() {
|
||||
if (pPci) {
|
||||
pPci->init();
|
||||
}
|
||||
if (pStandbyHandleContext) {
|
||||
pStandbyHandleContext->init(deviceHandles);
|
||||
}
|
||||
if (pEngineHandleContext) {
|
||||
pEngineHandleContext->init();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ class ZesStandbyFixture : public SysmanDeviceFixture {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pStandbyHandleContext->init(deviceHandles);
|
||||
}
|
||||
void TearDown() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
@@ -68,6 +67,13 @@ class ZesStandbyFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ZesStandbyFixture, GivenStandbyModeFilesNotAvailableWhenCallingEnumerateThenSuccessResultAndZeroCountIsReturned) {
|
||||
uint32_t count = 0;
|
||||
ptestSysfsAccess->isStandbyModeFileAvailable = false;
|
||||
ze_result_t result = zesDeviceEnumStandbyDomains(device, &count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
TEST_F(ZesStandbyFixture, GivenComponentCountZeroWhenCallingzesStandbyGetThenNonZeroCountIsReturnedAndVerifyzesStandbyGetCallSucceeds) {
|
||||
std::vector<zes_standby_handle_t> standbyHandle = {};
|
||||
uint32_t count = 0;
|
||||
@@ -326,7 +332,6 @@ class ZesStandbyMultiDeviceFixture : public SysmanMultiDeviceFixture {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pStandbyHandleContext->init(deviceHandles);
|
||||
}
|
||||
void TearDown() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
|
||||
Reference in New Issue
Block a user