From 47e064a6865ab1ed0610d7970b2d01745c740178 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Mon, 8 Jul 2024 08:49:54 +0000 Subject: [PATCH] fix: update slm size in capability table based on gt system info Signed-off-by: Mateusz Jablonski --- shared/source/os_interface/linux/drm_neo.cpp | 4 ++++ shared/source/os_interface/windows/wddm/wddm.cpp | 1 + .../unit_test/os_interface/linux/drm_system_info_tests.cpp | 7 ++++++- .../test/unit_test/os_interface/windows/wddm20_tests.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 03e71a9b6d..88192428f1 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -930,6 +930,10 @@ void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) { gtSysInfo->MaxDualSubSlicesSupported = sysInfo->getMaxDualSubSlicesSupported(); gtSysInfo->CsrSizeInMb = sysInfo->getCsrSizeInMb(); gtSysInfo->SLMSizeInKb = sysInfo->getSlmSizePerDss(); + + if (gtSysInfo->SLMSizeInKb) { + hwInfo->capabilityTable.slmSize = gtSysInfo->SLMSizeInKb; + } } void Drm::setupCacheInfo(const HardwareInfo &hwInfo) { diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index d36652ed7a..7d635c486a 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -110,6 +110,7 @@ bool Wddm::init() { hardwareInfo->capabilityTable.instrumentationEnabled = (hardwareInfo->capabilityTable.instrumentationEnabled && instrumentationEnabled); + hardwareInfo->capabilityTable.slmSize = gtSystemInfo->SLMSizeInKb; rootDeviceEnvironment.initProductHelper(); rootDeviceEnvironment.initCompilerProductHelper(); auto &productHelper = rootDeviceEnvironment.getHelper(); diff --git a/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp index b862210b1f..c566ae8fb2 100644 --- a/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp @@ -245,13 +245,16 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoSucceedsThenSys HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.capabilityTable.slmSize = 0x1234678u; + auto setupHardwareInfo = [](HardwareInfo *, bool, const ReleaseHelper *) {}; DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo}; int ret = drm.setupHardwareInfo(&device, false); EXPECT_EQ(ret, 0); EXPECT_NE(nullptr, drm.getSystemInfo()); - const auto >SystemInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo; + const auto &newHwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); + const auto >SystemInfo = newHwInfo.gtSystemInfo; EXPECT_GT(gtSystemInfo.MaxEuPerSubSlice, 0u); EXPECT_GT(gtSystemInfo.MaxSlicesSupported, 0u); @@ -260,6 +263,8 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoSucceedsThenSys EXPECT_GT(gtSystemInfo.MemoryType, 0u); EXPECT_EQ(gtSystemInfo.CsrSizeInMb, drm.getSystemInfo()->getCsrSizeInMb()); EXPECT_EQ(gtSystemInfo.SLMSizeInKb, drm.getSystemInfo()->getSlmSizePerDss()); + EXPECT_NE(newHwInfo.capabilityTable.slmSize, hwInfo.capabilityTable.slmSize); + EXPECT_EQ(newHwInfo.capabilityTable.slmSize, drm.getSystemInfo()->getSlmSizePerDss()); } TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoSucceedsThenSystemInfoIsCreatedAndHardwareInfoSetProperlyBasedOnBlobData) { diff --git a/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp index 4a8c349048..88584710eb 100644 --- a/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp @@ -72,6 +72,12 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe EXPECT_EQ(1u, wddm->createContextResult.called); } +TEST_F(Wddm20Tests, whenInitializingWddmThenSlmSizeInCapabilityTableIsSameAsInGtSystemInfo) { + wddm->init(); + auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); + EXPECT_EQ(hwInfo->gtSystemInfo.SLMSizeInKb, hwInfo->capabilityTable.slmSize); +} + TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) { GmmRequirements gmmRequirements{}; gmmRequirements.allowLargePages = true;