From 484684c762d651807a2e2069e1ec8c47909d612a Mon Sep 17 00:00:00 2001 From: shubham kumar Date: Sat, 31 Aug 2024 05:11:12 +0000 Subject: [PATCH] fix: Correct maxBandwidth unit conversation in pmt Related-To: NEO-12297 Signed-off-by: shubham kumar --- .../xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp | 3 +-- level_zero/sysman/source/sysman_const.h | 1 + .../product_helper/sysman_product_helper_memory_tests.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp b/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp index 89ffaa0f69..93f0719397 100644 --- a/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp +++ b/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp @@ -5,7 +5,6 @@ * */ -#include "shared/source/helpers/constants.h" #include "shared/source/helpers/debug_helpers.h" #include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h" @@ -567,7 +566,7 @@ ze_result_t SysmanProductHelperHw::getMemoryBandWidth(zes_mem_bandwi maxBandwidth = maxBandwidth >> 16; // PMT reports maxBandwidth in units of 100 MBps. Need to convert it into Bytes/sec, unit to be returned by sysman. - pBandwidth->maxBandwidth = static_cast(maxBandwidth) * MemoryConstants::megaByte * 100; + pBandwidth->maxBandwidth = static_cast(maxBandwidth) * megaBytesToBytes * 100; // timestamp calcuation uint32_t timeStampL = 0; diff --git a/level_zero/sysman/source/sysman_const.h b/level_zero/sysman/source/sysman_const.h index 769e1facc8..53ffd0776f 100644 --- a/level_zero/sysman/source/sysman_const.h +++ b/level_zero/sysman/source/sysman_const.h @@ -76,6 +76,7 @@ constexpr uint16_t milliSecsToMicroSecs = 1000; constexpr uint32_t milliFactor = 1000u; constexpr uint32_t microFactor = milliFactor * milliFactor; constexpr uint64_t gigaUnitTransferToUnitTransfer = 1000 * 1000 * 1000; +constexpr uint64_t megaBytesToBytes = 1000 * 1000; constexpr int32_t memoryBusWidth = 128; // bus width in bytes constexpr int32_t numMemoryChannels = 8; diff --git a/level_zero/sysman/test/unit_tests/sources/shared/windows/product_helper/sysman_product_helper_memory_tests.cpp b/level_zero/sysman/test/unit_tests/sources/shared/windows/product_helper/sysman_product_helper_memory_tests.cpp index 44420d38bc..300e17158e 100644 --- a/level_zero/sysman/test/unit_tests/sources/shared/windows/product_helper/sysman_product_helper_memory_tests.cpp +++ b/level_zero/sysman/test/unit_tests/sources/shared/windows/product_helper/sysman_product_helper_memory_tests.cpp @@ -143,7 +143,7 @@ HWTEST2_F(SysmanDeviceMemoryHelperFixture, GivenValidMemoryHandleWhenGettingBand ze_result_t result = zesMemoryGetBandwidth(handle, &bandwidth); EXPECT_EQ(result, ZE_RESULT_SUCCESS); - EXPECT_EQ(bandwidth.maxBandwidth, static_cast(mockMemoryMaxBandwidth * MemoryConstants::megaByte * 100)); + EXPECT_EQ(bandwidth.maxBandwidth, static_cast(mockMemoryMaxBandwidth * megaBytesToBytes * 100)); EXPECT_EQ(bandwidth.readCounter, mockMemoryCurrentBandwidthRead); EXPECT_EQ(bandwidth.writeCounter, mockMemoryCurrentBandwidthWrite); EXPECT_EQ(bandwidth.timestamp, mockMemoryBandwidthTimestamp);