From d2628babbc21a29562af1c0008530cde38fa7bd5 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 30 Jan 2023 00:58:59 +0000 Subject: [PATCH] refactor: don't use global ProductHelper getter 20/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- .../linux/os_metric_ip_sampling_imp_linux.cpp | 2 +- .../sysman/memory/linux/os_memory_imp_prelim.cpp | 3 ++- .../memory/linux/test_sysman_memory_prelim.cpp | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp index cdd73aae63..0ae116d40e 100644 --- a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp +++ b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp @@ -188,7 +188,7 @@ bool MetricIpSamplingLinuxImp::isNReportsAvailable() { bool MetricIpSamplingLinuxImp::isDependencyAvailable() { const auto &hardwareInfo = device.getNEODevice()->getHardwareInfo(); - const auto &productHelper = *NEO::ProductHelper::get(hardwareInfo.platform.eProductFamily); + const auto &productHelper = device.getNEODevice()->getProductHelper(); if (!productHelper.isIpSamplingSupported(hardwareInfo)) { return false; diff --git a/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp b/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp index 43b0c38109..314db6b409 100644 --- a/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp @@ -215,7 +215,8 @@ ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_band } auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo(); auto productFamily = hwInfo.platform.eProductFamily; - auto stepping = NEO::ProductHelper::get(productFamily)->getSteppingFromHwRevId(hwInfo); + auto &productHelper = pDevice->getNEODevice()->getProductHelper(); + auto stepping = productHelper.getSteppingFromHwRevId(hwInfo); for (auto hbmModuleIndex = 0u; hbmModuleIndex < numHbmModules; hbmModuleIndex++) { uint32_t counterValue = 0; // To read counters from VFID 0 and HBM module 0, key would be: VF0_HBM0_READ diff --git a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp index a48fa70791..0234f05608 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp @@ -84,7 +84,8 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture { } auto &hwInfo = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getHardwareInfo(); productFamily = hwInfo.platform.eProductFamily; - stepping = NEO::ProductHelper::get(productFamily)->getSteppingFromHwRevId(hwInfo); + auto &productHelper = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getProductHelper(); + stepping = productHelper.getSteppingFromHwRevId(hwInfo); getMemoryHandles(0); } @@ -406,7 +407,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM zesMemoryGetProperties(handle, &properties); auto hwInfo = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - hwInfo->platform.usRevId = NEO::ProductHelper::get(productFamily)->getHwRevIdFromStepping(REVISION_B, *hwInfo); + auto &productHelper = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getProductHelper(); + hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); auto pPmt = static_cast(pLinuxSysmanImp->getPlatformMonitoringTechAccess(properties.subdeviceId)); pPmt->mockVfid0Status = true; @@ -440,7 +442,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM zesMemoryGetProperties(handle, &properties); auto hwInfo = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - hwInfo->platform.usRevId = NEO::ProductHelper::get(productFamily)->getHwRevIdFromStepping(REVISION_B, *hwInfo); + auto &productHelper = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getProductHelper(); + hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); auto pPmt = static_cast(pLinuxSysmanImp->getPlatformMonitoringTechAccess(properties.subdeviceId)); pPmt->mockVfid1Status = true; @@ -471,7 +474,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidUsRevIdForRevisionBWhenCallingzes zesMemoryGetProperties(handle, &properties); auto hwInfo = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - hwInfo->platform.usRevId = NEO::ProductHelper::get(productFamily)->getHwRevIdFromStepping(REVISION_B, *hwInfo); + auto &productHelper = pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getProductHelper(); + hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); auto pPmt = static_cast(pLinuxSysmanImp->getPlatformMonitoringTechAccess(properties.subdeviceId)); pPmt->mockVfid1Status = true; pSysfsAccess->mockReadUInt64Value.push_back(hbmRP0Frequency);