refactor: optimize sysman windows power module

Related-To: NEO-13612

Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
shubham kumar
2025-01-08 10:15:16 +00:00
committed by Compute-Runtime-Automation
parent 5218923b6d
commit a8a9b1b92b
7 changed files with 180 additions and 304 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -224,7 +224,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
}
}
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesAndDefaultPowerIsNotAvailableThenCallSucceedsAndDefaultLimitIsInvalid) {
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesAndDefaultPowerIsNotAvailableThenCallFailsAndDefaultLimitIsInvalid) {
// Setting allow set calls or not
init(true);
@@ -241,8 +241,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
pKmdSysManager->mockPowerFailure[KmdSysman::Requests::Power::TdpDefault] = 1;
ze_result_t result = zesPowerGetProperties(handle, &properties);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(defaultLimit.limit, -1);
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result);
EXPECT_EQ(defaultLimit.limit, 0);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -254,13 +254,20 @@ HWTEST2_F(SysmanProductHelperPowerTest, GivenValidPowerHandleWhenGettingPowerPro
}
}
HWTEST2_F(SysmanProductHelperPowerTest, GivenValidEnergyCounterOnlyPowerDomainWhenGettingPowerGetPropertiesAndPmtIsNullThenUnsupportedIsReturned, IsBMG) {
HWTEST2_F(SysmanProductHelperPowerTest, GivenValidEnergyCounterOnlyPowerDomainWhenGettingPowerGetPropertiesThenUnsupportedIsReturned, IsAtMostDg2) {
// Setting allow set calls or not
init(true);
pWddmSysmanImp->pPmt.reset(nullptr);
std::unique_ptr<WddmPowerImp> pWddmPowerImp = std::make_unique<WddmPowerImp>(pOsSysman, false, 0, ZES_POWER_DOMAIN_MEMORY);
zes_power_properties_t powerProperties = {};
ASSERT_EQ(ZE_RESULT_ERROR_UNKNOWN, pWddmPowerImp->getProperties(&powerProperties));
ASSERT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pWddmPowerImp->getProperties(&powerProperties));
}
HWTEST2_F(SysmanProductHelperPowerTest, GivenValidEnergyCounterOnlyPowerDomainWhenGettingPowerGetPropertiesExtThenUnsupportedIsReturned, IsAtMostDg2) {
// Setting allow set calls or not
init(true);
std::unique_ptr<WddmPowerImp> pWddmPowerImp = std::make_unique<WddmPowerImp>(pOsSysman, false, 0, ZES_POWER_DOMAIN_MEMORY);
zes_power_ext_properties_t powerProperties = {};
ASSERT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pWddmPowerImp->getPropertiesExt(&powerProperties));
}
HWTEST2_F(SysmanProductHelperPowerTest, GivenInValidPowerDomainWhenGettingPowerGetPropertiesThenUnsupportedIsReturned, IsBMG) {