refactor: add debug flag to not set 2way coherency

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-09-19 09:58:49 +00:00
committed by Compute-Runtime-Automation
parent d8177828ef
commit 4d64ec8aaa
5 changed files with 51 additions and 0 deletions

View File

@@ -3986,6 +3986,28 @@ TEST_F(DrmMemoryManagerBasic, givenUnalignedHostPtrWithFlushL3RequiredWhenAlloca
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(DrmMemoryManagerBasic, givenUnalignedHostPtrWithFlushL3RequiredAndDebugFlagWhenAllocateGraphicsMemoryThenSetCorrectPatIndex) {
DebugManagerStateRestore restorer;
debugManager.flags.Disable2WayCoherencyOverride.set(true);
AllocationData allocationData;
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
memoryManager->forceLimitedRangeAllocator(MemoryConstants::max48BitAddress);
allocationData.size = 13;
allocationData.hostPtr = reinterpret_cast<const void *>(0x5001);
allocationData.rootDeviceIndex = rootDeviceIndex;
allocationData.flags.flushL3 = true;
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(0x5001u, reinterpret_cast<uint64_t>(allocation->getUnderlyingBuffer()));
EXPECT_EQ(13u, allocation->getUnderlyingBufferSize());
EXPECT_EQ(1u, allocation->getAllocationOffset());
EXPECT_EQ(MockGmmClientContextBase::MockPatIndex::cached, allocation->getBO()->peekPatIndex());
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(DrmMemoryManagerBasic, givenUnalignedHostPtrWithFlushL3NotRequiredWhenAllocateGraphicsMemoryThenSetCorrectPatIndex) {
AllocationData allocationData;
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));

View File

@@ -1098,6 +1098,29 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocateGraphicsMemoryForNonSvmHostPtrI
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, givenDebugFlagSetWhenNotAlignedPtrIsPassedAndFlushL3RequiredThenSetCorrectGmmResource) {
DebugManagerStateRestore restorer;
debugManager.flags.Disable2WayCoherencyOverride.set(true);
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
auto size = 13u;
auto hostPtr = reinterpret_cast<const void *>(0x10001);
AllocationData allocationData;
allocationData.size = size;
allocationData.hostPtr = hostPtr;
allocationData.flags.flushL3 = true;
auto allocation = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(hostPtr, allocation->getUnderlyingBuffer());
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
EXPECT_EQ(1u, allocation->getAllocationOffset());
auto expectedUsage = GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER;
EXPECT_EQ(expectedUsage, allocation->getGmm(0)->resourceParams.Usage);
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalledWhenNotAlignedPtrIsPassedAndFlushL3NotRequiredThenSetCorrectGmmResource) {
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
auto size = 13u;