feature(sysman): Implement/Update Frequency APIs at each Product Level

Related-To: NEO-8745

Signed-off-by: Bakwad, Anvesh <anvesh.bakwad@intel.com>
This commit is contained in:
Bakwad, Anvesh
2023-12-08 10:23:24 +00:00
committed by Compute-Runtime-Automation
parent a93b26a55d
commit 4a59406f83
13 changed files with 71 additions and 7 deletions

View File

@@ -11,6 +11,7 @@
#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/shared/linux/sysman_kmd_interface.h"
#include "level_zero/sysman/source/shared/linux/zes_os_sysman_imp.h"
@@ -45,11 +46,7 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p
double LinuxFrequencyImp::osFrequencyGetStepSize() {
double stepSize;
if (productFamily >= IGFX_XE_HP_SDV) {
stepSize = 50.0;
} else {
stepSize = 50.0 / 3; // Step of 16.6666667 Mhz (GEN9 Hardcode)
}
pSysmanProductHelper->getFrequencyStepSize(&stepSize);
return stepSize;
}
@@ -437,7 +434,7 @@ void LinuxFrequencyImp::init() {
LinuxFrequencyImp::LinuxFrequencyImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId, zes_freq_domain_t frequencyDomainNumber) : isSubdevice(onSubdevice), subdeviceId(subdeviceId), frequencyDomainNumber(frequencyDomainNumber) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
productFamily = pLinuxSysmanImp->getProductFamily();
pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
init();
}

View File

@@ -16,6 +16,7 @@ namespace L0 {
namespace Sysman {
class SysmanKmdInterface;
class SysmanProductHelper;
class SysFsAccessInterface;
class LinuxFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass {
@@ -77,7 +78,7 @@ class LinuxFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass {
bool isSubdevice = false;
uint32_t subdeviceId = 0;
zes_freq_domain_t frequencyDomainNumber = ZES_FREQ_DOMAIN_GPU;
PRODUCT_FAMILY productFamily;
SysmanProductHelper *pSysmanProductHelper = nullptr;
void init();
};

View File

@@ -11,6 +11,7 @@ target_sources(${L0_STATIC_LIB_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_hw.h
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_hw.inl
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_xe_hp_and_later.inl
)
add_subdirectories()

View File

@@ -36,6 +36,9 @@ class SysmanProductHelper {
return productHelper;
}
// Frequency
virtual void getFrequencyStepSize(double *pStepSize) = 0;
// Memory
virtual ze_result_t getMemoryProperties(zes_mem_properties_t *pProperties, const LinuxSysmanImp *pLinuxSysmanImp) = 0;
virtual ze_result_t getMemoryBandwidth(zes_mem_bandwidth_t *pBandwidth, const LinuxSysmanImp *pLinuxSysmanImp) = 0;

View File

@@ -22,6 +22,9 @@ class SysmanProductHelperHw : public SysmanProductHelper {
return pSysmanProductHelper;
}
// Frequency
void getFrequencyStepSize(double *pStepSize) override;
// Memory
ze_result_t getMemoryProperties(zes_mem_properties_t *pProperties, const LinuxSysmanImp *pLinuxSysmanImp) override;
ze_result_t getMemoryBandwidth(zes_mem_bandwidth_t *pBandwidth, const LinuxSysmanImp *pLinuxSysmanImp) override;

View File

@@ -16,6 +16,11 @@
namespace L0 {
namespace Sysman {
template <PRODUCT_FAMILY gfxProduct>
void SysmanProductHelperHw<gfxProduct>::getFrequencyStepSize(double *pStepSize) {
*pStepSize = (50.0 / 3); // Step of 16.6666667 Mhz
}
template <PRODUCT_FAMILY gfxProduct>
ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryProperties(zes_mem_properties_t *pProperties, const LinuxSysmanImp *pLinuxSysmanImp) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
void SysmanProductHelperHw<gfxProduct>::getFrequencyStepSize(double *pStepSize) {
*pStepSize = 50.0;
}

View File

@@ -16,6 +16,8 @@ namespace L0 {
namespace Sysman {
constexpr static auto gfxProduct = IGFX_PVC;
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_xe_hp_and_later.inl"
template <>
void SysmanProductHelperHw<gfxProduct>::getMediaPerformanceFactorMultiplier(const double performanceFactor, double *pMultiplier) {
if (performanceFactor > halfOfMaxPerformanceFactor) {

View File

@@ -13,6 +13,8 @@ namespace Sysman {
constexpr static auto gfxProduct = IGFX_ARROWLAKE;
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_xe_hp_and_later.inl"
template class SysmanProductHelperHw<gfxProduct>;
} // namespace Sysman

View File

@@ -18,6 +18,8 @@ RasInterfaceType SysmanProductHelperHw<gfxProduct>::getGtRasUtilInterface() {
return RasInterfaceType::pmu;
}
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_xe_hp_and_later.inl"
template class SysmanProductHelperHw<gfxProduct>;
} // namespace Sysman

View File

@@ -13,6 +13,8 @@ namespace Sysman {
constexpr static auto gfxProduct = IGFX_METEORLAKE;
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_xe_hp_and_later.inl"
template class SysmanProductHelperHw<gfxProduct>;
} // namespace Sysman

View File

@@ -11,6 +11,7 @@ if(UNIX)
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_memory_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_temperature_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_globalops_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_frequency_tests.cpp
)
endif()

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h"
namespace L0 {
namespace Sysman {
namespace ult {
using SysmanProductHelperFrequencyTest = ::testing::Test;
using IsProductXeHpSdvPlus = IsAtLeastProduct<IGFX_XE_HP_SDV>;
HWTEST2_F(SysmanProductHelperFrequencyTest, GivenFrequencyModuleWhenGettingStepSizeThenValidStepSizeIsReturned, IsProductXeHpSdvPlus) {
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
double stepSize = 0;
pSysmanProductHelper->getFrequencyStepSize(&stepSize);
EXPECT_EQ(50.0, stepSize);
}
HWTEST2_F(SysmanProductHelperFrequencyTest, GivenFrequencyModuleWhenGettingStepSizeThenValidStepSizeIsReturned, IsGen9) {
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
double stepSize = 0;
pSysmanProductHelper->getFrequencyStepSize(&stepSize);
EXPECT_EQ((50.0 / 3), stepSize);
}
} // namespace ult
} // namespace Sysman
} // namespace L0