From ed20069d4706affde8159691cc7caf394d0308c3 Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Tue, 19 Nov 2024 13:56:27 +0000 Subject: [PATCH] feature: debug flag to override region count Related-To: HSD-18040537404 Signed-off-by: Bartosz Dunajski --- .../debug_settings/debug_variables_base.inl | 1 + shared/source/os_interface/device_factory.cpp | 6 ++++++ shared/test/common/test_files/igdrcl.config | 1 + .../os_interface/device_factory_tests.cpp | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index c631578d72..904848b74e 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -112,6 +112,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideMocsIndexForScratchSpace, -1, "Program p DECLARE_DEBUG_VARIABLE(int32_t, CFEFusedEUDispatch, -1, "Set Fused EU dispatch in FrontEnd State command; values = -1: default, 0: enabled, 1: disabled") DECLARE_DEBUG_VARIABLE(int32_t, ForceAuxTranslationMode, -1, "Override AUX Translation mode; values = -1: default, 0: none, 1: builtin, 2: blit") DECLARE_DEBUG_VARIABLE(int32_t, OverrideGpuAddressSpace, -1, "Set GPU address space range in bits; ignore when -1") +DECLARE_DEBUG_VARIABLE(int32_t, OverrideRegionCount, -1, "-1: default, >=1 override region count to given value") DECLARE_DEBUG_VARIABLE(int32_t, OverrideMaxWorkgroupSize, -1, "Set max workgroup size; ignore when -1") DECLARE_DEBUG_VARIABLE(int32_t, DoCpuCopyOnReadBuffer, -1, "Override CPU copy behavior for buffer reads; values = -1: default, 0: do not use CPU copy, 1: triggers CPU copy path for Read Buffer calls, only supported for some basic use cases (no blocked user events in dependencies tree)") DECLARE_DEBUG_VARIABLE(int32_t, DoCpuCopyOnWriteBuffer, -1, "Override CPU copy behavior for buffer writes; values = -1: default, 0: do not use CPU copy, 1: triggers CPU copy path for Write Buffer calls, only supported for some basic use cases (no blocked user events in dependencies tree)") diff --git a/shared/source/os_interface/device_factory.cpp b/shared/source/os_interface/device_factory.cpp index 8ad6b43dd2..cbf390ba74 100644 --- a/shared/source/os_interface/device_factory.cpp +++ b/shared/source/os_interface/device_factory.cpp @@ -118,6 +118,9 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE hardwareInfo->capabilityTable.slmSize = debugManager.flags.OverrideSlmSize.get(); hardwareInfo->gtSystemInfo.SLMSizeInKb = debugManager.flags.OverrideSlmSize.get(); } + if (debugManager.flags.OverrideRegionCount.get() != -1) { + hardwareInfo->featureTable.regionCount = static_cast(debugManager.flags.OverrideRegionCount.get()); + } [[maybe_unused]] bool result = rootDeviceEnvironment.initAilConfiguration(); DEBUG_BREAK_IF(!result); @@ -174,6 +177,9 @@ static bool initHwDeviceIdResources(ExecutionEnvironment &executionEnvironment, hardwareInfo->capabilityTable.slmSize = debugManager.flags.OverrideSlmSize.get(); hardwareInfo->gtSystemInfo.SLMSizeInKb = debugManager.flags.OverrideSlmSize.get(); } + if (debugManager.flags.OverrideRegionCount.get() != -1) { + executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo()->featureTable.regionCount = static_cast(debugManager.flags.OverrideRegionCount.get()); + } executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initGmm(); diff --git a/shared/test/common/test_files/igdrcl.config b/shared/test/common/test_files/igdrcl.config index 732982f528..f0a11388f9 100644 --- a/shared/test/common/test_files/igdrcl.config +++ b/shared/test/common/test_files/igdrcl.config @@ -645,4 +645,5 @@ DebugUmdMaxReadWriteRetry = -1 DirectSubmissionControllerBcsTimeoutDivisor = -1 ForceZeroCopyForUseHostPtr = 0 Enable10ThreadsPerEu = -1 +OverrideRegionCount = -1 # Please don't edit below this line diff --git a/shared/test/unit_test/os_interface/device_factory_tests.cpp b/shared/test/unit_test/os_interface/device_factory_tests.cpp index 840cf9e35b..06102bf3bc 100644 --- a/shared/test/unit_test/os_interface/device_factory_tests.cpp +++ b/shared/test/unit_test/os_interface/device_factory_tests.cpp @@ -270,3 +270,21 @@ TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironments EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.slmSize); EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo.SLMSizeInKb); } + +TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideRegionCount) { + DebugManagerStateRestore restore; + debugManager.flags.OverrideRegionCount.set(123); + + EXPECT_TRUE(DeviceFactory::prepareDeviceEnvironments(executionEnvironment)); + + EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.regionCount); +} + +TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideRegionCount) { + DebugManagerStateRestore restore; + debugManager.flags.OverrideRegionCount.set(123); + + EXPECT_TRUE(DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment)); + + EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.regionCount); +} \ No newline at end of file