From 4be1a8f615ef3135c420e5eb47e04672c3cfea4b Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Thu, 12 Oct 2023 09:24:02 +0000 Subject: [PATCH] fix: ignore read error when getting bandwidth for DG2 Related-To: NEO-9038 Signed-off-by: Mateusz Jablonski --- .../memory/linux/sysman_os_memory_imp_prelim.cpp | 7 +++++-- .../memory/linux/test_sysman_memory_prelim.cpp | 15 ++------------- .../sysman/memory/linux/os_memory_imp_prelim.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp index 9ffee1bbf4..77c73e4697 100644 --- a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp +++ b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp @@ -188,10 +188,13 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) pBandwidth->maxBandwidth = 0u; const std::string maxBwFile = "prelim_lmem_max_bw_Mbps"; uint64_t maxBw = 0; - pSysfsAccess->read(maxBwFile, maxBw); + result = pSysfsAccess->read(maxBwFile, maxBw); + if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); + } pBandwidth->maxBandwidth = maxBw * MbpsToBytesPerSecond; pBandwidth->timestamp = SysmanDevice::getSysmanTimestamp(); - return result; + return ZE_RESULT_SUCCESS; } ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_bandwidth_t *pBandwidth) { diff --git a/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp b/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp index 96bf382358..c34ba2afa5 100644 --- a/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp +++ b/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp @@ -501,10 +501,8 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo } } -TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiReadFailsTheFailureIsReturned) { +HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiReadFailsTheFailureIsReturned, IsDG2) { setLocalSupportedAndReinit(true); - auto hwInfo = pLinuxSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironment().getMutableHardwareInfo(); - hwInfo->platform.eProductFamily = IGFX_DG2; auto handles = getMemoryHandles(memoryHandleComponentCount); for (auto handle : handles) { @@ -521,13 +519,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformAndReadingMaxBwFailsThenMaxBwIsReturnedAsZero, IsDG2) { setLocalSupportedAndReinit(true); - - // auto hwInfo = *NEO::defaultHwInfo.get(); - // hwInfo.platform.eProductFamily = IGFX_DG2; - // pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo); - - auto hwInfo = pSysmanDeviceImp->getHardwareInfo(); - hwInfo.platform.eProductFamily = IGFX_DG2; auto handles = getMemoryHandles(memoryHandleComponentCount); for (const auto &handle : handles) { @@ -542,11 +533,9 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM } } -TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiWriteFailsTheFailureIsReturned) { +HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiWriteFailsTheFailureIsReturned, IsDG2) { setLocalSupportedAndReinit(true); - auto hwInfo = pLinuxSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironment().getMutableHardwareInfo(); - hwInfo->platform.eProductFamily = IGFX_DG2; auto handles = getMemoryHandles(memoryHandleComponentCount); for (auto handle : handles) { 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 1eb81ba81c..c08e596185 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 @@ -194,10 +194,13 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) pBandwidth->maxBandwidth = 0u; const std::string maxBwFile = "prelim_lmem_max_bw_Mbps"; uint64_t maxBw = 0; - pSysfsAccess->read(maxBwFile, maxBw); + result = pSysfsAccess->read(maxBwFile, maxBw); + if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); + } pBandwidth->maxBandwidth = maxBw * MbpsToBytesPerSecond; pBandwidth->timestamp = SysmanDevice::getSysmanTimestamp(); - return result; + return ZE_RESULT_SUCCESS; } ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_bandwidth_t *pBandwidth) {