diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index f5aa4facd0..8446a3dbdc 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -83,6 +83,7 @@ DECLARE_DEBUG_VARIABLE(bool, DontDisableZebinIfVmeUsed, false, "When enabled, dr DECLARE_DEBUG_VARIABLE(bool, AppendMemoryPrefetchForKmdMigratedSharedAllocations, true, "Allow prefetching shared memory to the device associated with the specified command list") DECLARE_DEBUG_VARIABLE(bool, ForceMemoryPrefetchForKmdMigratedSharedAllocations, false, "Force prefetch of shared memory in command queue execute command lists") DECLARE_DEBUG_VARIABLE(bool, ClKhrExternalMemoryExtension, true, "Enable cl_khr_external_memory extension") +DECLARE_DEBUG_VARIABLE(bool, OverrideUncachedSharedImages, true, "Overrides uncached PAT index for shared images") DECLARE_DEBUG_VARIABLE(bool, WaitForMemoryRelease, false, "Wait for memory release when out of memory") DECLARE_DEBUG_VARIABLE(bool, RemoveRestrictionsOnNumberOfThreadsInGpgpuThreadGroup, 0, "0 - default disabled, 1- remove restrictions on NumberOfThreadsInGpgpuThreadGroup in INTERFACE_DESCRIPTOR_DATA") DECLARE_DEBUG_VARIABLE(bool, DisableGemCreateExtSetPat, false, "Do not use I915_GEM_CREATE_EXT_SET_PAT extension when gem create ext is called") diff --git a/shared/source/xe2_hpg_core/windows/product_helper_bmg.cpp b/shared/source/xe2_hpg_core/windows/product_helper_bmg.cpp index d1bbaf0bcf..234265f111 100644 --- a/shared/source/xe2_hpg_core/windows/product_helper_bmg.cpp +++ b/shared/source/xe2_hpg_core/windows/product_helper_bmg.cpp @@ -43,8 +43,8 @@ bool ProductHelperHw::isStagingBuffersEnabled() const { template <> uint64_t ProductHelperHw::overridePatIndex(bool isUncachedType, uint64_t patIndex, AllocationType allocationType) const { - if (allocationType == AllocationType::sharedImage && patIndex == 8u) { // L3: UC - return 13; // L3, L4: WB, Non coh + if (allocationType == AllocationType::sharedImage && patIndex == 8u && debugManager.flags.OverrideUncachedSharedImages.get()) { // L3: UC + return 13; // L3, L4: WB, Non coh } return patIndex; diff --git a/shared/source/xe2_hpg_core/windows/product_helper_lnl.cpp b/shared/source/xe2_hpg_core/windows/product_helper_lnl.cpp index c332e8919b..7207ddd48d 100644 --- a/shared/source/xe2_hpg_core/windows/product_helper_lnl.cpp +++ b/shared/source/xe2_hpg_core/windows/product_helper_lnl.cpp @@ -32,6 +32,10 @@ uint64_t ProductHelperHw::overridePatIndex(bool isUncachedType, uint return 2; // L3: WB, L4: UC, 2-Way coh } + if (allocationType == AllocationType::sharedImage && patIndex == 8u && debugManager.flags.OverrideUncachedSharedImages.get()) { // L3: UC + return 13; // L3, L4: WB, Non coh + } + return patIndex; } diff --git a/shared/test/common/test_files/igdrcl.config b/shared/test/common/test_files/igdrcl.config index a653a46ceb..2c18058bc6 100644 --- a/shared/test/common/test_files/igdrcl.config +++ b/shared/test/common/test_files/igdrcl.config @@ -48,6 +48,7 @@ OverrideCsrAllocationSize = -1 ForceL1Caching = -1 UseKmdMigration = -1 CreateKmdMigratedSharedAllocationWithMultipleBOs = -1 +OverrideUncachedSharedImages = 1 UseKmdMigrationForBuffers = -1 OverrideStatelessMocsIndex = -1 OverrideMocsIndexForScratchSpace = -1 diff --git a/shared/test/unit_test/xe2_hpg_core/bmg/windows/product_helper_tests_bmg_windows.cpp b/shared/test/unit_test/xe2_hpg_core/bmg/windows/product_helper_tests_bmg_windows.cpp index 22705df562..ad4e8d07ad 100644 --- a/shared/test/unit_test/xe2_hpg_core/bmg/windows/product_helper_tests_bmg_windows.cpp +++ b/shared/test/unit_test/xe2_hpg_core/bmg/windows/product_helper_tests_bmg_windows.cpp @@ -9,6 +9,7 @@ #include "shared/source/os_interface/product_helper.h" #include "shared/source/xe2_hpg_core/hw_cmds_bmg.h" #include "shared/source/xe2_hpg_core/hw_info_xe2_hpg_core.h" +#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/unit_test/os_interface/product_helper_tests.h" @@ -27,6 +28,8 @@ BMGTEST_F(BmgProductHelperWindows, givenProductHelperWhenIsStagingBuffersEnabled } BMGTEST_F(BmgProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledThenCorrectValueIsReturned) { + DebugManagerStateRestore restorer; + uint64_t expectedPatIndex = 2u; for (int i = 0; i < static_cast(AllocationType::count); ++i) { EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); @@ -40,4 +43,10 @@ BMGTEST_F(BmgProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledT EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); } } + + debugManager.flags.OverrideUncachedSharedImages.set(0); + + for (int i = 0; i < static_cast(AllocationType::count); ++i) { + EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); + } } \ No newline at end of file diff --git a/shared/test/unit_test/xe2_hpg_core/lnl/windows/product_helper_tests_lnl_windows.cpp b/shared/test/unit_test/xe2_hpg_core/lnl/windows/product_helper_tests_lnl_windows.cpp index c8f386a2d6..65160ef323 100644 --- a/shared/test/unit_test/xe2_hpg_core/lnl/windows/product_helper_tests_lnl_windows.cpp +++ b/shared/test/unit_test/xe2_hpg_core/lnl/windows/product_helper_tests_lnl_windows.cpp @@ -26,7 +26,27 @@ LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenCheckDirectSubmissionSu LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledThenCorrectValueIsReturned) { DebugManagerStateRestore restorer; - uint64_t expectedPatIndex = 6u; + uint64_t expectedPatIndex = 2u; + for (int i = 0; i < static_cast(AllocationType::count); ++i) { + EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); + } + + expectedPatIndex = 8u; + for (int i = 0; i < static_cast(AllocationType::count); ++i) { + if (static_cast(i) == AllocationType::sharedImage) { + EXPECT_EQ(13u, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); + } else { + EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); + } + } + + debugManager.flags.OverrideUncachedSharedImages.set(0); + + for (int i = 0; i < static_cast(AllocationType::count); ++i) { + EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast(i))); + } + + expectedPatIndex = 6u; EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, AllocationType::bufferHostMemory)); EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, AllocationType::mapAllocation)); EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, AllocationType::svmCpu)); @@ -49,4 +69,4 @@ LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledT LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenIsStagingBuffersEnabledThenTrueIsReturned) { EXPECT_TRUE(productHelper->isStagingBuffersEnabled()); -} +} \ No newline at end of file