fix: correct path to frequency files in xe path

Related-To: NEO-11111
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2024-04-12 10:50:47 +00:00 committed by Compute-Runtime-Automation
parent de617e4630
commit 8eb17a843b
2 changed files with 10 additions and 6 deletions

View File

@ -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) {

View File

@ -518,9 +518,9 @@ TEST(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturn
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
auto ioctlHelper = std::make_unique<IoctlHelperXe>(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) {