mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
feature: Boilerplate for retrieving current voltage
Related-To: NEO-9471 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
16713184b1
commit
d0ac63b74e
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
#include "level_zero/sysman/source/shared/linux/pmt/sysman_pmt.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"
|
||||
@@ -160,7 +161,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) {
|
||||
}
|
||||
|
||||
pState->pNext = nullptr;
|
||||
pState->currentVoltage = -1.0;
|
||||
getCurrentVoltage(pState->currentVoltage);
|
||||
|
||||
pState->throttleReasons = 0u;
|
||||
if (getThrottleReasonStatus()) {
|
||||
uint32_t val = 0;
|
||||
@@ -395,6 +397,10 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void LinuxFrequencyImp::getCurrentVoltage(double &voltage) {
|
||||
pSysmanProductHelper->getCurrentVoltage(pPmt, voltage);
|
||||
}
|
||||
|
||||
void LinuxFrequencyImp::init() {
|
||||
|
||||
const std::string baseDir = pSysmanKmdInterface->getBasePath(subdeviceId);
|
||||
@@ -436,6 +442,7 @@ LinuxFrequencyImp::LinuxFrequencyImp(OsSysman *pOsSysman, ze_bool_t onSubdevice,
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
|
||||
pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
pPmt = pLinuxSysmanImp->getPlatformMonitoringTechAccess(subdeviceId);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Sysman {
|
||||
class SysmanKmdInterface;
|
||||
class SysmanProductHelper;
|
||||
class SysFsAccessInterface;
|
||||
class PlatformMonitoringTech;
|
||||
|
||||
class LinuxFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
@@ -56,6 +57,7 @@ class LinuxFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t getMaxVal(double &maxVal);
|
||||
ze_result_t getMinVal(double &minVal);
|
||||
bool getThrottleReasonStatus(void);
|
||||
void getCurrentVoltage(double &voltage);
|
||||
|
||||
private:
|
||||
std::string minFreqFile;
|
||||
@@ -79,6 +81,7 @@ class LinuxFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass {
|
||||
uint32_t subdeviceId = 0;
|
||||
zes_freq_domain_t frequencyDomainNumber = ZES_FREQ_DOMAIN_GPU;
|
||||
SysmanProductHelper *pSysmanProductHelper = nullptr;
|
||||
PlatformMonitoringTech *pPmt = nullptr;
|
||||
void init();
|
||||
};
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ class SysmanProductHelper {
|
||||
// Global Operations
|
||||
virtual bool isRepairStatusSupported() = 0;
|
||||
|
||||
// Voltage
|
||||
virtual void getCurrentVoltage(PlatformMonitoringTech *pPmt, double &voltage) = 0;
|
||||
|
||||
virtual ~SysmanProductHelper() = default;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -45,6 +45,9 @@ class SysmanProductHelperHw : public SysmanProductHelper {
|
||||
// global ops
|
||||
bool isRepairStatusSupported() override;
|
||||
|
||||
// Voltage
|
||||
void getCurrentVoltage(PlatformMonitoringTech *pPmt, double &voltage) override;
|
||||
|
||||
~SysmanProductHelperHw() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -126,5 +126,10 @@ bool SysmanProductHelperHw<gfxProduct>::isRepairStatusSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void SysmanProductHelperHw<gfxProduct>::getCurrentVoltage(PlatformMonitoringTech *pPmt, double &voltage) {
|
||||
voltage = -1.0;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
|
||||
@@ -12,6 +12,7 @@ if(UNIX)
|
||||
${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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_ras_tests.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/shared/linux/pmt/sysman_pmt.h"
|
||||
#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"
|
||||
|
||||
@@ -29,6 +30,15 @@ HWTEST2_F(SysmanProductHelperFrequencyTest, GivenFrequencyModuleWhenGettingStepS
|
||||
EXPECT_EQ((50.0 / 3), stepSize);
|
||||
}
|
||||
|
||||
TEST_F(SysmanProductHelperFrequencyTest, GivenSysmanProductHelperInstanceWhenGettingCurrentVoltageThenVerifyCurrentVoltageIsNegative) {
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
|
||||
std::unique_ptr<PublicFsAccess> pFsAccess = std::make_unique<PublicFsAccess>();
|
||||
auto pPmt = std::make_unique<PlatformMonitoringTech>(pFsAccess.get(), 1, 0);
|
||||
double voltage = 0;
|
||||
pSysmanProductHelper->getCurrentVoltage(pPmt.get(), voltage);
|
||||
EXPECT_EQ(voltage, -1.0);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/sysman/source/api/ras/linux/ras_util/sysman_ras_util.h"
|
||||
@@ -19,21 +20,21 @@ namespace ult {
|
||||
using SysmanProductHelperRasTest = ::testing::Test;
|
||||
|
||||
HWTEST2_F(SysmanProductHelperRasTest, GivenSysmanProductHelperInstanceWhenQueryingRasInterfaceThenVerifyProperInterfacesAreReturned, IsPVC) {
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfacePmu, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceGsc, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(NEO::defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfaceType::pmu, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceType::gsc, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
}
|
||||
|
||||
HWTEST2_F(SysmanProductHelperRasTest, GivenSysmanProductHelperInstanceWhenQueryingRasInterfaceThenVerifyProperInterfacesAreReturned, IsDg2) {
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfacePmu, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceNone, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
HWTEST2_F(SysmanProductHelperRasTest, GivenSysmanProductHelperInstanceWhenQueryingRasInterfaceThenVerifyProperInterfacesAreReturned, IsDG2) {
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(NEO::defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfaceType::pmu, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceType::none, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
}
|
||||
|
||||
HWTEST2_F(SysmanProductHelperRasTest, GivenSysmanProductHelperInstanceWhenQueryingRasInterfaceThenVerifyProperInterfacesAreReturned, IsAtMostGen11) {
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfaceNone, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceNone, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(NEO::defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(RasInterfaceType::none, pSysmanProductHelper->getGtRasUtilInterface());
|
||||
EXPECT_EQ(RasInterfaceType::none, pSysmanProductHelper->getHbmRasUtilInterface());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
|
||||
Reference in New Issue
Block a user