refactor: Abstract perf factor requests based on KMD and HW.

Related-To: NEO-8881

Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
Bellekallu Rajkiran
2024-01-29 06:14:54 +00:00
committed by Compute-Runtime-Automation
parent a4f7dda98f
commit a6634898c7
18 changed files with 173 additions and 445 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2024 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -8,19 +8,7 @@ if(UNIX)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp.h
)
if(NEO_ENABLE_i915_PRELIM_DETECTION)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp_prelim.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp_prelim.h
)
else()
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_performance_imp.h
)
endif()
endif()

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
#include "level_zero/sysman/source/shared/linux/sysman_kmd_interface.h"
@@ -42,11 +43,6 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) {
double multiplier = 0;
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
if (pSysmanKmdInterface->isSystemPowerBalanceAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The System Power Balance is not available and hence returns UNSUPPORTED_FEATURE \n", __FUNCTION__);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
result = pSysFsAccess->read(systemPowerBalance, sysPwrBalanceReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, systemPowerBalance.c_str(), getErrorCode(result));
@@ -62,7 +58,6 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) {
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
result = pSysFsAccess->read(mediaFreqFactor, mediaFactorReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result));
@@ -82,11 +77,6 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) {
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
if (pSysmanKmdInterface->isBaseFrequencyFactorAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Base Frequency Factor is not available and hence returns UNSUPPORTED_FEATURE \n", __FUNCTION__);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
result = pSysFsAccess->read(baseFreqFactor, baseFactorReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result));
@@ -111,35 +101,25 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) {
return result;
}
ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double pFactor) {
ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double perfFactor) {
double multiplier = 0;
ze_result_t result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
if (pFactor < minPerformanceFactor || pFactor > maxPerformanceFactor) {
if (perfFactor < minPerformanceFactor || perfFactor > maxPerformanceFactor) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
if (pSysmanKmdInterface->isSystemPowerBalanceAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The System Power Balance is not available and hence returns UNSUPPORTED_FEATURE \n", __FUNCTION__);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
if (pFactor <= halfOfMaxPerformanceFactor) {
multiplier = maxSysPowerBalanceReading - std::round(pFactor * (maxSysPowerBalanceReading - defaultSysPowerBalanceReading) / halfOfMaxPerformanceFactor);
if (perfFactor <= halfOfMaxPerformanceFactor) {
multiplier = maxSysPowerBalanceReading - std::round(perfFactor * (maxSysPowerBalanceReading - defaultSysPowerBalanceReading) / halfOfMaxPerformanceFactor);
} else {
multiplier = defaultSysPowerBalanceReading - std::round((pFactor - halfOfMaxPerformanceFactor) * defaultSysPowerBalanceReading / halfOfMaxPerformanceFactor);
multiplier = defaultSysPowerBalanceReading - std::round((perfFactor - halfOfMaxPerformanceFactor) * defaultSysPowerBalanceReading / halfOfMaxPerformanceFactor);
}
result = pSysFsAccess->write(systemPowerBalance, multiplier);
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
if (pFactor > halfOfMaxPerformanceFactor) {
multiplier = 1;
} else {
multiplier = 0.5;
}
pSysmanProductHelper->getMediaPerformanceFactorMultiplier(perfFactor, &multiplier);
multiplier = multiplier / mediaScaleReading;
multiplier = std::round(multiplier);
@@ -147,15 +127,10 @@ ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double pFactor) {
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
if (pSysmanKmdInterface->isBaseFrequencyFactorAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Base Frequency Factor is not available and hence returns UNSUPPORTED_FEATURE \n", __FUNCTION__);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
if (pFactor < halfOfMaxPerformanceFactor) {
multiplier = 2 - (pFactor / halfOfMaxPerformanceFactor);
if (perfFactor < halfOfMaxPerformanceFactor) {
multiplier = 2 - (perfFactor / halfOfMaxPerformanceFactor);
} else {
multiplier = 1 - ((pFactor - halfOfMaxPerformanceFactor) / maxPerformanceFactor);
multiplier = 1 - ((perfFactor - halfOfMaxPerformanceFactor) / maxPerformanceFactor);
}
multiplier = multiplier / baseScaleReading; // Divide by scale factor and then round off to convert from decimal to U format
multiplier = std::round(multiplier);
@@ -179,9 +154,12 @@ ze_result_t LinuxPerformanceImp::getMediaFrequencyScaleFactor() {
}
bool LinuxPerformanceImp::isPerformanceSupported(void) {
if (!pSysmanProductHelper->isPerfFactorSupported()) {
return false;
}
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
if (pSysmanKmdInterface->isSystemPowerBalanceAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false as System Power Balance is not Available\n", __FUNCTION__);
return false;
@@ -191,9 +169,11 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) {
return false;
}
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
if (pSysmanKmdInterface->isMediaFrequencyFactorAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as Media Frequency is not Available\n", __FUNCTION__);
return false;
}
if (pSysFsAccess->canRead(mediaFreqFactor) != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as SysfsAccess->canRead() failed for %s\n", __FUNCTION__, mediaFreqFactor.c_str());
return false;
@@ -202,9 +182,7 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) {
return false;
}
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
if (pSysmanKmdInterface->isBaseFrequencyFactorAvailable() == false) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false as Base Frequency is not Available\n", __FUNCTION__);
return false;
@@ -217,7 +195,6 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) {
return false;
}
break;
default:
return false;
break;
@@ -228,9 +205,9 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) {
LinuxPerformanceImp::LinuxPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
zes_engine_type_flag_t domain) : domain(domain), subdeviceId(subdeviceId), isSubdevice(onSubdevice) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
productFamily = pLinuxSysmanImp->getProductFamily();
pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
pSysFsAccess = pSysmanKmdInterface->getSysFsAccess();
pSysFsAccess = &pLinuxSysmanImp->getSysfsAccess();
if (pSysmanKmdInterface->isBaseFrequencyFactorAvailable() == true) {
baseFreqFactor = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceBaseFrequencyFactor, subdeviceId, true);
@@ -238,11 +215,13 @@ LinuxPerformanceImp::LinuxPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdev
}
if (pSysmanKmdInterface->isSystemPowerBalanceAvailable() == true) {
systemPowerBalance = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceSystemPowerBalance, subdeviceId, true);
systemPowerBalance = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceSystemPowerBalance, subdeviceId, false);
}
mediaFreqFactor = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactor, subdeviceId, true);
mediaFreqFactorScale = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale, subdeviceId, true);
if (pSysmanKmdInterface->isMediaFrequencyFactorAvailable() == true) {
mediaFreqFactor = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactor, subdeviceId, true);
mediaFreqFactorScale = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale, subdeviceId, true);
}
}
OsPerformance *OsPerformance::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId, zes_engine_type_flag_t domain) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,7 @@ class LinuxPerformanceImp : public OsPerformance, NEO::NonCopyableOrMovableClass
ze_result_t getErrorCode(ze_result_t result);
SysmanKmdInterface *pSysmanKmdInterface = nullptr;
SysFsAccessInterface *pSysFsAccess = nullptr;
PRODUCT_FAMILY productFamily{};
SysmanProductHelper *pSysmanProductHelper = nullptr;
zes_engine_type_flag_t domain = ZES_ENGINE_TYPE_FLAG_OTHER;
double baseScaleReading = 0;
double mediaScaleReading = 0;

View File

@@ -1,209 +0,0 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp_prelim.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/helpers/hw_info.h"
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
#include "level_zero/sysman/source/sysman_const.h"
#include <cmath>
namespace L0 {
namespace Sysman {
const std::string LinuxPerformanceImp::sysPwrBalance("sys_pwr_balance");
ze_result_t LinuxPerformanceImp::osPerformanceGetProperties(zes_perf_properties_t &pProperties) {
pProperties.onSubdevice = isSubdevice;
pProperties.subdeviceId = subdeviceId;
pProperties.engines = domain;
return ZE_RESULT_SUCCESS;
}
ze_result_t LinuxPerformanceImp::getBaseScaleFactor() {
auto result = pSysfsAccess->read(baseScale, baseScaleReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseScale.c_str(), getErrorCode(result));
return getErrorCode(result);
}
return ZE_RESULT_SUCCESS;
}
ze_result_t LinuxPerformanceImp::getMediaScaleFactor() {
auto result = pSysfsAccess->read(mediaScale, mediaScaleReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaScale.c_str(), getErrorCode(result));
return getErrorCode(result);
}
return ZE_RESULT_SUCCESS;
}
ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) {
ze_result_t result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
double baseFactorReading = 0;
double mediaFactorReading = 0;
double sysPwrBalanceReading = 0;
double multiplier = 0;
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
result = pSysfsAccess->read(sysPwrBalance, sysPwrBalanceReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, sysPwrBalance.c_str(), getErrorCode(result));
return getErrorCode(result);
}
if (sysPwrBalanceReading >= 0 && sysPwrBalanceReading <= 16.0) {
*pFactor = 50.0 + std::round((16.0 - sysPwrBalanceReading) * 50.0 / 16.0);
} else if (sysPwrBalanceReading > 16.0 && sysPwrBalanceReading <= 63.0) {
*pFactor = std::round((63.0 - sysPwrBalanceReading) * 50.0 / (63.0 - 16.0));
} else {
result = ZE_RESULT_ERROR_UNKNOWN;
}
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
result = pSysfsAccess->read(mediaFreqFactor, mediaFactorReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result));
return getErrorCode(result);
}
multiplier = (mediaFactorReading * mediaScaleReading); // Value retrieved from media_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor
if (multiplier == 1) {
*pFactor = maxPerformanceFactor;
} else if (multiplier == 0.5) {
*pFactor = halfOfMaxPerformanceFactor;
} else if (multiplier == 0) {
*pFactor = minPerformanceFactor;
} else {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for MEDIA is not matching with given presets and returning UNKNOWN ERROR \n", __FUNCTION__);
result = ZE_RESULT_ERROR_UNKNOWN;
}
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
result = pSysfsAccess->read(baseFreqFactor, baseFactorReading);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result));
return getErrorCode(result);
}
multiplier = (baseFactorReading * baseScaleReading); // Value retrieved from base_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor
if (multiplier >= 0.5 && multiplier <= 1) {
*pFactor = (1 - multiplier) * 100 + 50;
} else if (multiplier > 1 && multiplier <= 2) {
*pFactor = (2 - multiplier) * 50;
} else {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for COMPUTE is not matching with given presets and returning UNKNOWN ERROR\n", __FUNCTION__);
result = ZE_RESULT_ERROR_UNKNOWN;
}
break;
default:
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__);
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
break;
}
return result;
}
ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double performanceFactor) {
double multiplier = 0;
ze_result_t result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
if (performanceFactor < minPerformanceFactor || performanceFactor > maxPerformanceFactor) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
if (performanceFactor <= halfOfMaxPerformanceFactor) {
multiplier = 63.0 - std::round(performanceFactor * (47.0) / 50.0); // multiplier = 63 - ROUND(performanceFactor * (63.0 - 16.0) / 50.0)
} else {
multiplier = 16.0 - std::round((performanceFactor - 50.0) * 16.0 / 50.0);
}
result = pSysfsAccess->write(sysPwrBalance, multiplier);
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
pSysmanProductHelper->getMediaPerformanceFactorMultiplier(performanceFactor, &multiplier);
multiplier = multiplier / mediaScaleReading; // Divide by scale factor and then round off to convert from decimal to U format
multiplier = std::round(multiplier);
result = pSysfsAccess->write(mediaFreqFactor, multiplier);
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
if (performanceFactor < halfOfMaxPerformanceFactor) {
multiplier = 2 - (performanceFactor / 50.0);
} else {
multiplier = 1 - ((performanceFactor - 50) / 100.0);
}
multiplier = multiplier / baseScaleReading; // Divide by scale factor and then round off to convert from decimal to U format
multiplier = std::round(multiplier);
result = pSysfsAccess->write(baseFreqFactor, multiplier);
break;
default:
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__);
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
break;
}
return result;
}
bool LinuxPerformanceImp::isPerformanceSupported(void) {
switch (domain) {
case ZES_ENGINE_TYPE_FLAG_OTHER:
if (pSysfsAccess->canRead(sysPwrBalance) != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false \n", __FUNCTION__);
return false;
}
break;
case ZES_ENGINE_TYPE_FLAG_MEDIA:
if (pSysfsAccess->canRead(mediaFreqFactor) != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false \n", __FUNCTION__);
return false;
}
if (getMediaScaleFactor() != ZE_RESULT_SUCCESS) {
return false;
}
break;
case ZES_ENGINE_TYPE_FLAG_COMPUTE:
if (pSysfsAccess->canRead(baseFreqFactor) != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false \n", __FUNCTION__);
return false;
}
if (getBaseScaleFactor() != ZE_RESULT_SUCCESS) {
return false;
}
break;
default:
return false;
break;
}
return true;
}
void LinuxPerformanceImp::init() {
const std::string baseDir = "gt/gt" + std::to_string(subdeviceId) + "/";
baseFreqFactor = baseDir + "base_freq_factor";
mediaFreqFactor = baseDir + "media_freq_factor";
baseScale = baseDir + "base_freq_factor.scale";
mediaScale = baseDir + "media_freq_factor.scale";
}
LinuxPerformanceImp::LinuxPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
zes_engine_type_flag_t domain) : domain(domain), subdeviceId(subdeviceId), isSubdevice(onSubdevice) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
init();
}
OsPerformance *OsPerformance::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId, zes_engine_type_flag_t domain) {
LinuxPerformanceImp *pLinuxPerformanceImp = new LinuxPerformanceImp(pOsSysman, onSubdevice, subdeviceId, domain);
return static_cast<OsPerformance *>(pLinuxPerformanceImp);
}
} // namespace Sysman
} // namespace L0

View File

@@ -1,64 +0,0 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "level_zero/sysman/source/api/performance/sysman_os_performance.h"
#include "level_zero/sysman/source/api/performance/sysman_performance_imp.h"
#include "level_zero/sysman/source/shared/linux/zes_os_sysman_imp.h"
namespace L0 {
namespace Sysman {
class SysFsAccessInterface;
class SysmanProductHelper;
class LinuxPerformanceImp : public OsPerformance, NEO::NonCopyableOrMovableClass {
public:
ze_result_t osPerformanceGetProperties(zes_perf_properties_t &pProperties) override;
ze_result_t osPerformanceGetConfig(double *pFactor) override;
ze_result_t osPerformanceSetConfig(double performanceFactor) override;
bool isPerformanceSupported(void) override;
LinuxPerformanceImp() = delete;
LinuxPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
zes_engine_type_flag_t domain);
~LinuxPerformanceImp() override = default;
protected:
L0::Sysman::SysFsAccessInterface *pSysfsAccess = nullptr;
zes_engine_type_flag_t domain = ZES_ENGINE_TYPE_FLAG_OTHER;
private:
std::string mediaFreqFactor;
std::string baseFreqFactor;
static const std::string sysPwrBalance;
std::string baseScale;
std::string mediaScale;
uint32_t subdeviceId = 0;
ze_bool_t isSubdevice = 0;
double baseScaleReading = 0;
double mediaScaleReading = 0;
SysmanProductHelper *pSysmanProductHelper = nullptr;
ze_result_t getMediaFreqFactor();
ze_result_t getMediaScaleFactor();
ze_result_t getBaseFreqFactor();
ze_result_t getBaseScaleFactor();
void init();
void getMultiplierVal(double rp0Reading, double rpnReading, double pFactor, double &multiplier);
void getPerformanceFactor(double rp0Reading, double rpnReading, double multiplierReading, double *pFactor);
ze_result_t getErrorCode(ze_result_t result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
};
} // namespace Sysman
} // namespace L0

View File

@@ -53,6 +53,7 @@ class SysmanProductHelper {
// Performance
virtual void getMediaPerformanceFactorMultiplier(const double performanceFactor, double *pMultiplier) = 0;
virtual bool isPerfFactorSupported() = 0;
// temperature
virtual ze_result_t getGlobalMaxTemperature(PlatformMonitoringTech *pPmt, double *pTemperature) = 0;

View File

@@ -32,6 +32,7 @@ class SysmanProductHelperHw : public SysmanProductHelper {
// Performance
void getMediaPerformanceFactorMultiplier(const double performanceFactor, double *pMultiplier) override;
bool isPerfFactorSupported() override;
// temperature
ze_result_t getGlobalMaxTemperature(PlatformMonitoringTech *pPmt, double *pTemperature) override;

View File

@@ -102,6 +102,11 @@ void SysmanProductHelperHw<gfxProduct>::getMediaPerformanceFactorMultiplier(cons
}
}
template <PRODUCT_FAMILY gfxProduct>
bool SysmanProductHelperHw<gfxProduct>::isPerfFactorSupported() {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
bool SysmanProductHelperHw<gfxProduct>::isMemoryMaxTemperatureSupported() {
return false;

View File

@@ -115,6 +115,7 @@ class SysmanKmdInterface {
virtual bool isGroupEngineInterfaceAvailable() const = 0;
ze_result_t initFsAccessInterface(const NEO::Drm &drm);
virtual bool isBaseFrequencyFactorAvailable() const = 0;
virtual bool isMediaFrequencyFactorAvailable() const = 0;
virtual bool isSystemPowerBalanceAvailable() const = 0;
FsAccessInterface *getFsAccess();
ProcFsAccessInterface *getProcFsAccess();
@@ -181,6 +182,7 @@ class SysmanKmdInterfaceI915Upstream : public SysmanKmdInterface, SysmanKmdInter
std::optional<std::string> getEngineClassString(uint16_t engineClass) override;
uint32_t getEventType(const bool isIntegratedDevice) override;
bool isBaseFrequencyFactorAvailable() const override { return false; }
bool isMediaFrequencyFactorAvailable() const override { return true; }
bool isSystemPowerBalanceAvailable() const override { return false; }
bool isDefaultFrequencyAvailable() const override { return true; }
bool isBoostFrequencyAvailable() const override { return true; }
@@ -226,8 +228,9 @@ class SysmanKmdInterfaceI915Prelim : public SysmanKmdInterface, SysmanKmdInterfa
uint32_t subdeviceId) override;
std::optional<std::string> getEngineClassString(uint16_t engineClass) override;
uint32_t getEventType(const bool isIntegratedDevice) override;
bool isBaseFrequencyFactorAvailable() const override { return false; }
bool isSystemPowerBalanceAvailable() const override { return false; }
bool isBaseFrequencyFactorAvailable() const override { return true; }
bool isMediaFrequencyFactorAvailable() const override { return true; }
bool isSystemPowerBalanceAvailable() const override { return true; }
bool isDefaultFrequencyAvailable() const override { return true; }
bool isBoostFrequencyAvailable() const override { return true; }
bool isTdpFrequencyAvailable() const override { return true; }
@@ -272,8 +275,9 @@ class SysmanKmdInterfaceXe : public SysmanKmdInterface {
uint32_t subdeviceId) override;
std::optional<std::string> getEngineClassString(uint16_t engineClass) override;
uint32_t getEventType(const bool isIntegratedDevice) override;
bool isBaseFrequencyFactorAvailable() const override { return true; }
bool isSystemPowerBalanceAvailable() const override { return true; }
bool isBaseFrequencyFactorAvailable() const override { return false; }
bool isMediaFrequencyFactorAvailable() const override { return false; }
bool isSystemPowerBalanceAvailable() const override { return false; }
bool isDefaultFrequencyAvailable() const override { return false; }
bool isBoostFrequencyAvailable() const override { return false; }
bool isTdpFrequencyAvailable() const override { return false; }

View File

@@ -44,6 +44,11 @@ void SysmanKmdInterfaceI915Prelim::initSysfsNameToFileMap(const PRODUCT_FAMILY p
sysfsNameToFileMap[SysfsName::sysfsNameMemoryAddressRange] = std::make_pair("addr_range", "");
sysfsNameToFileMap[SysfsName::sysfsNameMaxMemoryFrequency] = std::make_pair("mem_RP0_freq_mhz", "");
sysfsNameToFileMap[SysfsName::sysfsNameMinMemoryFrequency] = std::make_pair("mem_RPn_freq_mhz", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceBaseFrequencyFactor] = std::make_pair("base_freq_factor", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceBaseFrequencyFactorScale] = std::make_pair("base_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactor] = std::make_pair("media_freq_factor", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale] = std::make_pair("media_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceSystemPowerBalance] = std::make_pair("", "sys_pwr_balance");
}
std::string SysmanKmdInterfaceI915Prelim::getBasePath(uint32_t subDeviceId) const {

View File

@@ -56,8 +56,11 @@ void SysmanKmdInterfaceI915Upstream::initSysfsNameToFileMap(const PRODUCT_FAMILY
sysfsNameToFileMap[SysfsName::sysfsNameSchedulerTimeout] = std::make_pair("", "preempt_timeout_ms");
sysfsNameToFileMap[SysfsName::sysfsNameSchedulerTimeslice] = std::make_pair("", "timeslice_duration_ms");
sysfsNameToFileMap[SysfsName::sysfsNameSchedulerWatchDogTimeout] = std::make_pair("", "heartbeat_interval_ms");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceBaseFrequencyFactor] = std::make_pair("base_freq_factor", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceBaseFrequencyFactorScale] = std::make_pair("base_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactor] = std::make_pair("media_freq_factor", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale] = std::make_pair("media_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceSystemPowerBalance] = std::make_pair("", "sys_pwr_balance");
}
std::string SysmanKmdInterfaceI915Upstream::getSysfsFilePath(SysfsName sysfsName, uint32_t subDeviceId, bool prefixBaseDirectory) {

View File

@@ -104,7 +104,7 @@ void SysmanKmdInterfaceXe::initSysfsNameToFileMap(const PRODUCT_FAMILY productFa
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceBaseFrequencyFactorScale] = std::make_pair("base_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactor] = std::make_pair("media_freq_factor", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale] = std::make_pair("media_freq_factor.scale", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceSystemPowerBalance] = std::make_pair("sys_pwr_balance", "");
sysfsNameToFileMap[SysfsName::sysfsNamePerformanceSystemPowerBalance] = std::make_pair("", "sys_pwr_balance");
}
std::string SysmanKmdInterfaceXe::getSysfsFilePath(SysfsName sysfsName, uint32_t subDeviceId, bool prefixBaseDirectory) {

View File

@@ -1,25 +1,17 @@
#
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2024 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(L0_TESTS_SYSMAN_PERFORMANCE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_performance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_sysfs_performance.h
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_performance_prelim.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_sysfs_performance_prelim.h
)
if(NEO_ENABLE_i915_PRELIM_DETECTION)
list(APPEND L0_TESTS_SYSMAN_PERFORMANCE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_performance_prelim.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_sysfs_performance_prelim.h
)
else()
list(APPEND L0_TESTS_SYSMAN_PERFORMANCE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_performance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_sysfs_performance.h
)
endif()
if(UNIX)
target_sources(${TARGET_NAME}
PRIVATE

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,7 +7,7 @@
#pragma once
#include "level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp_prelim.h"
#include "level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.h"
#include "level_zero/sysman/source/api/performance/sysman_performance.h"
#include "level_zero/sysman/source/api/performance/sysman_performance_imp.h"
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
@@ -160,7 +160,7 @@ class PublicLinuxPerformanceImp : public L0::Sysman::LinuxPerformanceImp {
public:
PublicLinuxPerformanceImp(L0::Sysman::OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId, zes_engine_type_flag_t domain) : L0::Sysman::LinuxPerformanceImp(pOsSysman, onSubdevice, subdeviceId, domain) {}
using L0::Sysman::LinuxPerformanceImp::domain;
using L0::Sysman::LinuxPerformanceImp::pSysfsAccess;
using L0::Sysman::LinuxPerformanceImp::pSysmanKmdInterface;
};
} // namespace ult

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.h"
#include "level_zero/sysman/source/api/performance/sysman_performance.h"
#include "level_zero/sysman/source/api/performance/sysman_performance_imp.h"
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h"
#include "level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h"
#include "level_zero/sysman/test/unit_tests/sources/performance/linux/mock_sysfs_performance.h"
@@ -31,12 +32,10 @@ static constexpr std::string_view xeMediaFreqFactorFileName0("device/tile0/gt0/m
static constexpr std::string_view xeMediaFreqFactorScaleFileName0("device/tile0/gt0/media_freq_factor.scale");
static constexpr std::string_view xeBaseFreqFactorFileName0("device/tile0/gt0/base_freq_factor");
static constexpr std::string_view xeBaseFreqFactorScaleFileName0("device/tile0/gt0/base_freq_factor.scale");
static constexpr std::string_view xeSysPwrBalanceFileName0("device/tile0/gt0/sys_pwr_balance");
static constexpr std::string_view xeMediaFreqFactorFileName1("device/tile1/gt1/media_freq_factor");
static constexpr std::string_view xeMediaFreqFactorScaleFileName1("device/tile1/gt1/media_freq_factor.scale");
static constexpr std::string_view xeBaseFreqFactorFileName1("device/tile1/gt1/base_freq_factor");
static constexpr std::string_view xeBaseFreqFactorScaleFileName1("device/tile1/gt1/base_freq_factor.scale");
static constexpr std::string_view xeSysPwrBalanceFileName1("device/tile1/gt1/sys_pwr_balance");
static double mockBaseFreq = 128.0;
static double mockMediaFreq = 256.0;
@@ -58,7 +57,7 @@ static int mockOpenSuccess(const char *pathname, int flags) {
returnValue = 3;
} else if (strPathName == i915BaseFreqFactorScaleFileName0 || strPathName == i915BaseFreqFactorScaleFileName1 || strPathName == xeBaseFreqFactorScaleFileName0 || strPathName == xeBaseFreqFactorScaleFileName1) {
returnValue = 4;
} else if (strPathName == sysPwrBalanceFileName || strPathName == xeSysPwrBalanceFileName0 || strPathName == xeSysPwrBalanceFileName1) {
} else if (strPathName == sysPwrBalanceFileName) {
returnValue = 5;
} else {
returnValue = 0;
@@ -143,7 +142,7 @@ TEST_F(ZesPerformanceFixtureI915, GivenKmdInterfaceWhenGettingSysFsFilenamesForP
EXPECT_STREQ(std::string(i915MediaFreqFactorScaleFileName0).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale, 0, true).c_str());
}
TEST_F(ZesPerformanceFixtureI915, GivenValidSysmanHandleWhenRetrievingPerfThenValidHandlesAreReturned) {
HWTEST2_F(ZesPerformanceFixtureI915, GivenValidSysmanHandleWhenRetrievingPerfThenValidHandlesAreReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
@@ -165,7 +164,7 @@ TEST_F(ZesPerformanceFixtureI915, GivenValidSysmanHandleWhenRetrievingPerfThenVa
EXPECT_EQ(count, mockI915HandleCount);
}
TEST_F(ZesPerformanceFixtureI915, GivenValidPerfHandleWhenGettingPerformancePropertiesThenValidPropertiesReturned) {
HWTEST2_F(ZesPerformanceFixtureI915, GivenValidPerfHandleWhenGettingPerformancePropertiesThenValidPropertiesReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
@@ -193,7 +192,7 @@ TEST_F(ZesPerformanceFixtureI915, GivenBaseAndOtherDomainTypeWhenGettingPerfHand
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixtureI915, GivenMediaDomainTypeWhenGettingPerfHandlesThenValidHandleIsRetrieved) {
HWTEST2_F(ZesPerformanceFixtureI915, GivenMediaDomainTypeWhenGettingPerfHandlesThenValidHandleIsRetrieved, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> mockOpen(&NEO::SysCalls::sysCallsOpen, &mockOpenSuccess);
@@ -230,28 +229,6 @@ TEST_F(ZesPerformanceFixtureI915, GivenComputeDomainTypeWhenGettingPerfHandlesTh
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixtureI915, GivenComputeDomainTypeWhenCallingPerformanceSetAndGetConfigThenNotSupportedIsReturned) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
auto pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceI915Upstream>(pLinuxSysmanImp->getProductFamily());
auto pSysFsAccess = std::make_unique<MockSysFsAccessInterface>();
double pFactor = 0.0;
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_COMPUTE);
pLinuxPerformanceImp->pSysmanKmdInterface = pSysmanKmdInterface.get();
pLinuxPerformanceImp->pSysFsAccess = pSysFsAccess.get();
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pLinuxPerformanceImp->osPerformanceSetConfig(pFactor));
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pLinuxPerformanceImp->osPerformanceGetConfig(&pFactor));
delete pLinuxPerformanceImp;
pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_OTHER);
pLinuxPerformanceImp->pSysmanKmdInterface = pSysmanKmdInterface.get();
pLinuxPerformanceImp->pSysFsAccess = pSysFsAccess.get();
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pLinuxPerformanceImp->osPerformanceSetConfig(pFactor));
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pLinuxPerformanceImp->osPerformanceGetConfig(&pFactor));
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixtureI915, GivenValidPerfHandleAndPreadFailsWhenGettingPerformanceHandlesThenNoHandlesAreReturned) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
@@ -338,36 +315,68 @@ TEST_F(ZesPerformanceFixtureXe, GivenKmdInterfaceWhenGettingSysFsFilenamesForPer
EXPECT_STREQ(std::string(xeMediaFreqFactorScaleFileName0).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceMediaFrequencyFactorScale, 0, true).c_str());
EXPECT_STREQ(std::string(xeBaseFreqFactorFileName0).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceBaseFrequencyFactor, 0, true).c_str());
EXPECT_STREQ(std::string(xeBaseFreqFactorScaleFileName0).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceBaseFrequencyFactorScale, 0, true).c_str());
EXPECT_STREQ(std::string(xeSysPwrBalanceFileName0).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceSystemPowerBalance, 0, true).c_str());
EXPECT_STREQ(std::string(sysPwrBalanceFileName).c_str(), pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNamePerformanceSystemPowerBalance, 0, false).c_str());
}
TEST_F(ZesPerformanceFixtureXe, GivenComputeDomainTypeWhenGettingPerfHandlesThenCorrespondingHandlesAreRetrieved) {
HWTEST2_F(ZesPerformanceFixtureXe, GivenPerfFactorDomainsWhenGettingPerfHandlesThenVerifyPerfFactorIsNotSupported, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> mockOpen(&NEO::SysCalls::sysCallsOpen, &mockOpenSuccess);
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, &mockReadSuccess);
auto pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceXe>(pLinuxSysmanImp->getProductFamily());
std::unique_ptr<SysmanKmdInterface> pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceXe>(pLinuxSysmanImp->getProductFamily());
auto pSysFsAccess = std::make_unique<MockSysFsAccessInterface>();
std::swap(pLinuxSysmanImp->pSysmanKmdInterface, pSysmanKmdInterface);
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysFsAccess.get());
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_COMPUTE);
pLinuxPerformanceImp->pSysmanKmdInterface = pSysmanKmdInterface.get();
pLinuxPerformanceImp->pSysFsAccess = pSysFsAccess.get();
EXPECT_TRUE(pLinuxPerformanceImp->isPerformanceSupported());
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
pLinuxPerformanceImp = nullptr;
pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_MEDIA);
pLinuxPerformanceImp->pSysmanKmdInterface = pSysmanKmdInterface.get();
pLinuxPerformanceImp->pSysFsAccess = pSysFsAccess.get();
EXPECT_TRUE(pLinuxPerformanceImp->isPerformanceSupported());
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
pLinuxPerformanceImp = nullptr;
pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_OTHER);
pLinuxPerformanceImp->pSysmanKmdInterface = pSysmanKmdInterface.get();
pLinuxPerformanceImp->pSysFsAccess = pSysFsAccess.get();
EXPECT_TRUE(pLinuxPerformanceImp->isPerformanceSupported());
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixtureXe, GivenPerfFactorDomainsWhenGettingPerfHandlesThenVerifyPerfFactorIsNotSupported) {
VariableBackup<decltype(NEO::SysCalls::sysCallsStat)> mockStat(&NEO::SysCalls::sysCallsStat, &mockStatSuccess);
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> mockOpen(&NEO::SysCalls::sysCallsOpen, &mockOpenSuccess);
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, &mockReadSuccess);
struct MockSysmanProductHelperPerf : L0::Sysman::SysmanProductHelperHw<IGFX_UNKNOWN> {
MockSysmanProductHelperPerf() = default;
bool isPerfFactorSupported() override {
return false;
}
};
std::unique_ptr<SysmanProductHelper> pSysmanProductHelper = std::make_unique<MockSysmanProductHelperPerf>();
std::swap(pLinuxSysmanImp->pSysmanProductHelper, pSysmanProductHelper);
std::unique_ptr<SysmanKmdInterface> pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceXe>(pLinuxSysmanImp->getProductFamily());
auto pSysFsAccess = std::make_unique<MockSysFsAccessInterface>();
std::swap(pLinuxSysmanImp->pSysmanKmdInterface, pSysmanKmdInterface);
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysFsAccess.get());
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_COMPUTE);
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
pLinuxPerformanceImp = nullptr;
pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_MEDIA);
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
pLinuxPerformanceImp = nullptr;
pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_OTHER);
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
delete pLinuxPerformanceImp;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,54 +20,49 @@ constexpr uint32_t mockHandleCount = 5;
constexpr double maxPerformanceFactor = 100;
constexpr double halfOfMaxPerformanceFactor = 50;
constexpr double minPerformanceFactor = 0;
class ZesPerformanceFixture : public SysmanMultiDeviceFixture {
class ZesPerformanceFixtureI915Prelim : public SysmanMultiDeviceFixture {
protected:
std::unique_ptr<MockPerformanceSysfsAccess> ptestSysfsAccess;
L0::Sysman::SysFsAccessInterface *pOriginalSysfsAccess = nullptr;
L0::Sysman::SysmanDevice *device = nullptr;
std::unique_ptr<MockPerformanceSysfsAccess> pSysfsAccess;
void SetUp() override {
SysmanMultiDeviceFixture::SetUp();
device = pSysmanDevice;
ptestSysfsAccess = std::make_unique<MockPerformanceSysfsAccess>();
pOriginalSysfsAccess = pLinuxSysmanImp->pSysfsAccess;
pLinuxSysmanImp->pSysfsAccess = ptestSysfsAccess.get();
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
getPerfHandles(0);
std::unique_ptr<SysmanKmdInterface> pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceI915Prelim>(pLinuxSysmanImp->getProductFamily());
std::swap(pLinuxSysmanImp->pSysmanKmdInterface, pSysmanKmdInterface);
pSysfsAccess = std::make_unique<MockPerformanceSysfsAccess>();
}
void TearDown() override {
SysmanMultiDeviceFixture::TearDown();
pLinuxSysmanImp->pSysfsAccess = pOriginalSysfsAccess;
}
std::vector<zes_perf_handle_t> getPerfHandles(uint32_t count) {
std::vector<zes_perf_handle_t> handles(count, nullptr);
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
return handles;
}
};
TEST_F(ZesPerformanceFixture, GivenValidSysmanHandleWhenRetrievingPerfThenValidHandlesReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidSysmanHandleWhenRetrievingPerfThenValidHandlesReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
uint32_t count = 0;
ze_result_t result = zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &count, NULL);
ze_result_t result = zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, NULL);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(count, mockHandleCount);
uint32_t testcount = count + 1;
result = zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &testcount, NULL);
result = zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &testcount, NULL);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(testcount, mockHandleCount);
count = 0;
std::vector<zes_perf_handle_t> handles(count, nullptr);
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
EXPECT_EQ(count, mockHandleCount);
}
TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfcanReadFailsWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
ptestSysfsAccess->mockCanReadResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
TEST_F(ZesPerformanceFixtureI915Prelim, GivenInAnyDomainTypeIfcanReadFailsWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
pSysfsAccess->mockCanReadResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
@@ -88,8 +83,9 @@ TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfcanReadFailsWhenGettingPerfH
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfSysfsReadForMediaAndComputeScaleFailsWhileGettingPerfHandlesThenZeroHandlesAreRetrieved) {
ptestSysfsAccess->mockReadResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
TEST_F(ZesPerformanceFixtureI915Prelim, GivenInAnyDomainTypeIfSysfsReadForMediaAndComputeScaleFailsWhileGettingPerfHandlesThenZeroHandlesAreRetrieved) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
pSysfsAccess->mockReadResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
@@ -106,12 +102,13 @@ TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfSysfsReadForMediaAndComputeS
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfMediaAndBaseFreqFactorSysfsNodesAreAbsentWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
TEST_F(ZesPerformanceFixtureI915Prelim, GivenInAnyDomainTypeIfMediaAndBaseFreqFactorSysfsNodesAreAbsentWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
ptestSysfsAccess->mockReadResult = ZE_RESULT_ERROR_NOT_AVAILABLE;
pSysfsAccess->mockReadResult = ZE_RESULT_ERROR_NOT_AVAILABLE;
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_MEDIA);
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
@@ -124,7 +121,8 @@ TEST_F(ZesPerformanceFixture, GivenInAnyDomainTypeIfMediaAndBaseFreqFactorSysfsN
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenIncorrectConditionsWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
TEST_F(ZesPerformanceFixtureI915Prelim, GivenIncorrectConditionsWhenGettingPerfHandlesThenZeroHandlesAreRetrieved) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
// Check perf handle with incorrect domain type
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_DMA);
EXPECT_FALSE(pLinuxPerformanceImp->isPerformanceSupported());
@@ -132,8 +130,8 @@ TEST_F(ZesPerformanceFixture, GivenIncorrectConditionsWhenGettingPerfHandlesThen
pLinuxPerformanceImp = nullptr;
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenGettingPerformancePropertiesThenValidPropertiesReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenGettingPerformancePropertiesThenValidPropertiesReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto subDeviceCount = pLinuxSysmanImp->getSubDeviceCount();
ze_bool_t onSubdevice = (subDeviceCount == 0) ? false : true;
uint32_t subdeviceId = 0;
@@ -147,7 +145,8 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenGettingPerformanceProperti
EXPECT_EQ(properties.subdeviceId, subdeviceId);
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenGettingConfigThenSuccessIsReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenGettingConfigThenSuccessIsReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
ASSERT_NE(nullptr, handle);
@@ -157,12 +156,13 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenGettingConfigThenSuccessIs
}
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesWhenInvalidMultiplierValuesAreReturnedBySysfsInterfaceThenUnknownErrorIsReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandlesWhenInvalidMultiplierValuesAreReturnedBySysfsInterfaceThenUnknownErrorIsReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
ptestSysfsAccess->isReturnUnknownFailure = true;
pSysfsAccess->isReturnUnknownFailure = true;
pSysmanDeviceImp->pPerformanceHandleContext->init(pLinuxSysmanImp->getSubDeviceCount());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
@@ -172,12 +172,13 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesWhenInvalidMultiplierValuesAr
}
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesWhenBaseAndMediaFreqFactorNodesAreAbsentThenUnsupportedFeatureIsReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandlesWhenBaseAndMediaFreqFactorNodesAreAbsentThenUnsupportedFeatureIsReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
delete handle;
}
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
ptestSysfsAccess->isMediaBaseFailure = true;
pSysfsAccess->isMediaBaseFailure = true;
pSysmanDeviceImp->pPerformanceHandleContext->init(pLinuxSysmanImp->getSubDeviceCount());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
@@ -187,7 +188,8 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesWhenBaseAndMediaFreqFactorNod
}
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingConfigThenSuccessIsReturned) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenSettingConfigThenSuccessIsReturned, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
ASSERT_NE(nullptr, handle);
@@ -204,7 +206,8 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingConfigThenSuccessIs
}
}
HWTEST2_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingMediaConfigAndGettingMediaConfigForProductOtherThanPVCThenValidConfigIsReturned, IsNotPVC) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenSettingMediaConfigAndGettingMediaConfigForProductOtherThanPVCThenValidConfigIsReturned, IsAtMostDg2) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
ASSERT_NE(nullptr, handle);
@@ -241,7 +244,8 @@ HWTEST2_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingMediaConfigAndGe
}
}
HWTEST2_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingMediaConfigAndGettingMediaConfigWhenProductFamilyIsPVCThenValidConfigIsReturned, IsPVC) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenSettingMediaConfigAndGettingMediaConfigWhenProductFamilyIsPVCThenValidConfigIsReturned, IsPVC) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
ASSERT_NE(nullptr, handle);
@@ -272,11 +276,12 @@ HWTEST2_F(ZesPerformanceFixture, GivenValidPerfHandleWhenSettingMediaConfigAndGe
}
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesButSysfsReadsFailAtDifferentBrancesWhenSettingPerfConfigThenPerfGetConfigFails) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandlesButSysfsReadsFailAtDifferentBrancesWhenSettingPerfConfigThenPerfGetConfigFails, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
double factor = 0;
ptestSysfsAccess->isComputeInvalid = true;
pSysfsAccess->isComputeInvalid = true;
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 1, 0u, ZES_ENGINE_TYPE_FLAG_COMPUTE);
EXPECT_TRUE(pLinuxPerformanceImp->isPerformanceSupported());
@@ -288,18 +293,20 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesButSysfsReadsFailAtDifferentB
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandleWhenGettingPerfConfigForOtherDomainAndSysfsReadReturnsInvalidValueThenPerfGetConfigFails) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandleWhenGettingPerfConfigForOtherDomainAndSysfsReadReturnsInvalidValueThenPerfGetConfigFails, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
double factor = 0;
ptestSysfsAccess->returnNegativeFactor = true;
pSysfsAccess->returnNegativeFactor = true;
PublicLinuxPerformanceImp *pLinuxPerformanceImp = new PublicLinuxPerformanceImp(pOsSysman, 0, 0u, ZES_ENGINE_TYPE_FLAG_OTHER);
EXPECT_TRUE(pLinuxPerformanceImp->isPerformanceSupported());
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pLinuxPerformanceImp->osPerformanceGetConfig(&factor));
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesButSysfsReadsFailAtDifferentBrancesWhenSettingPerfConfigThenPerfSetConfigFails) {
HWTEST2_F(ZesPerformanceFixtureI915Prelim, GivenValidPerfHandlesButSysfsReadsFailAtDifferentBrancesWhenSettingPerfConfigThenPerfSetConfigFails, IsXeHpOrXeHpcOrXeHpgCore) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
auto handles = getPerfHandles(mockHandleCount);
for (const auto &handle : handles) {
ASSERT_NE(nullptr, handle);
@@ -317,7 +324,8 @@ TEST_F(ZesPerformanceFixture, GivenValidPerfHandlesButSysfsReadsFailAtDifferentB
delete pLinuxPerformanceImp;
}
TEST_F(ZesPerformanceFixture, GivenValidOfjectsOfClassPerformanceImpAndPerformanceHandleContextThenDuringObjectReleaseCheckDestructorBranches) {
TEST_F(ZesPerformanceFixtureI915Prelim, GivenValidOfjectsOfClassPerformanceImpAndPerformanceHandleContextThenDuringObjectReleaseCheckDestructorBranches) {
VariableBackup<L0::Sysman::SysFsAccessInterface *> sysfsBackup(&pLinuxSysmanImp->pSysfsAccess, pSysfsAccess.get());
for (auto &handle : pSysmanDeviceImp->pPerformanceHandleContext->handleList) {
auto pPerformanceImp = static_cast<L0::Sysman::PerformanceImp *>(handle);
delete pPerformanceImp->pOsPerformance;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -53,6 +53,11 @@ HWTEST2_F(SysmanProductHelperPerformanceTest, GivenMediaPerformanceFactorWhenGet
EXPECT_EQ(1, multiplier);
}
HWTEST2_F(SysmanProductHelperPerformanceTest, GivenPerformanceModuleWhenQueryingPerfFactorSupportedThenPerfFactorIsSupported, IsXeHpOrXeHpcOrXeHpgCore) {
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(true, pSysmanProductHelper->isPerfFactorSupported());
}
} // namespace ult
} // namespace Sysman
} // namespace L0

View File

@@ -123,8 +123,9 @@ TEST_F(SysmanFixtureDeviceXe, GivenSysmanKmdInterfaceInstanceWhenIsGroupEngineIn
TEST_F(SysmanFixtureDeviceXe, GivenSysmanKmdInterfaceInstanceWhenCheckingAvailabilityOfBaseFrequencyFactorAndSystemPowerBalanceThenTrueValueIsReturned) {
auto pSysmanKmdInterface = pLinuxSysmanImp->pSysmanKmdInterface.get();
EXPECT_TRUE(pSysmanKmdInterface->isBaseFrequencyFactorAvailable());
EXPECT_TRUE(pSysmanKmdInterface->isSystemPowerBalanceAvailable());
EXPECT_FALSE(pSysmanKmdInterface->isBaseFrequencyFactorAvailable());
EXPECT_FALSE(pSysmanKmdInterface->isSystemPowerBalanceAvailable());
EXPECT_FALSE(pSysmanKmdInterface->isMediaFrequencyFactorAvailable());
}
TEST_F(SysmanFixtureDeviceXe, GivenSysmanKmdInterfaceInstanceWhenCheckingAvailabilityOfFrequencyFilesThenFalseValueIsReturned) {