fix: Override UC PAT to cacheable for shared images on LNL

Temporary WA for UC PAT index in GMM from shared image
Add flag to control WA

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-07-18 08:05:04 +00:00
committed by Compute-Runtime-Automation
parent 46f9133bf2
commit c0a92c87b7
6 changed files with 39 additions and 4 deletions

View File

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

View File

@@ -43,8 +43,8 @@ bool ProductHelperHw<gfxProduct>::isStagingBuffersEnabled() const {
template <>
uint64_t ProductHelperHw<gfxProduct>::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;

View File

@@ -32,6 +32,10 @@ uint64_t ProductHelperHw<gfxProduct>::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;
}

View File

@@ -48,6 +48,7 @@ OverrideCsrAllocationSize = -1
ForceL1Caching = -1
UseKmdMigration = -1
CreateKmdMigratedSharedAllocationWithMultipleBOs = -1
OverrideUncachedSharedImages = 1
UseKmdMigrationForBuffers = -1
OverrideStatelessMocsIndex = -1
OverrideMocsIndexForScratchSpace = -1

View File

@@ -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<int>(AllocationType::count); ++i) {
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
@@ -40,4 +43,10 @@ BMGTEST_F(BmgProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledT
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
}
}
debugManager.flags.OverrideUncachedSharedImages.set(0);
for (int i = 0; i < static_cast<int>(AllocationType::count); ++i) {
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
}
}

View File

@@ -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<int>(AllocationType::count); ++i) {
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
}
expectedPatIndex = 8u;
for (int i = 0; i < static_cast<int>(AllocationType::count); ++i) {
if (static_cast<AllocationType>(i) == AllocationType::sharedImage) {
EXPECT_EQ(13u, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
} else {
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(i)));
}
}
debugManager.flags.OverrideUncachedSharedImages.set(0);
for (int i = 0; i < static_cast<int>(AllocationType::count); ++i) {
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, static_cast<AllocationType>(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());
}
}