From 8eb17a843bc9c8b94cf21fe26dbb86caf334eeae Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Fri, 12 Apr 2024 10:50:47 +0000 Subject: [PATCH] fix: correct path to frequency files in xe path Related-To: NEO-11111 Signed-off-by: Mateusz Jablonski --- .../source/os_interface/linux/xe/ioctl_helper_xe.cpp | 10 +++++++--- .../os_interface/linux/xe/ioctl_helper_xe_tests.cpp | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index 2f534b5009..545ffa9341 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -1344,16 +1344,20 @@ std::string IoctlHelperXe::getDrmParamString(DrmParam drmParam) const { } } +inline std::string getDirectoryWithFrequencyFiles(int tileId, int gtId) { + return "/device/tile" + std::to_string(tileId) + "/gt" + std::to_string(gtId) + "/freq0"; +} + std::string IoctlHelperXe::getFileForMaxGpuFrequency() const { - return "/device/gt0/freq_max"; + return getDirectoryWithFrequencyFiles(0 /*tileId */, 0 /*gtId*/) + "/max_freq"; } std::string IoctlHelperXe::getFileForMaxGpuFrequencyOfSubDevice(int subDeviceId) const { - return "/device/gt" + std::to_string(subDeviceId) + "/freq_max"; + return getDirectoryWithFrequencyFiles(subDeviceId /*tileId */, subDeviceId /*gtId*/) + "/max_freq"; } std::string IoctlHelperXe::getFileForMaxMemoryFrequencyOfSubDevice(int subDeviceId) const { - return "/device/gt" + std::to_string(subDeviceId) + "/freq_rp0"; + return getDirectoryWithFrequencyFiles(subDeviceId /*tileId */, subDeviceId /*gtId*/) + "/rp0_freq"; } bool IoctlHelperXe::getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) { diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index fbc23143be..62cb4defd1 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -518,9 +518,9 @@ TEST(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturn auto executionEnvironment = std::make_unique(); DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; auto ioctlHelper = std::make_unique(drm); - EXPECT_STREQ("/device/gt0/freq_max", ioctlHelper->getFileForMaxGpuFrequency().c_str()); - EXPECT_STREQ("/device/gt2/freq_max", ioctlHelper->getFileForMaxGpuFrequencyOfSubDevice(2).c_str()); - EXPECT_STREQ("/device/gt1/freq_rp0", ioctlHelper->getFileForMaxMemoryFrequencyOfSubDevice(1).c_str()); + EXPECT_STREQ("/device/tile0/gt0/freq0/max_freq", ioctlHelper->getFileForMaxGpuFrequency().c_str()); + EXPECT_STREQ("/device/tile2/gt2/freq0/max_freq", ioctlHelper->getFileForMaxGpuFrequencyOfSubDevice(2).c_str()); + EXPECT_STREQ("/device/tile1/gt1/freq0/rp0_freq", ioctlHelper->getFileForMaxMemoryFrequencyOfSubDevice(1).c_str()); } TEST(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {