mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 09:30:36 +08:00
refactor: add debug flag to not set 2way coherency
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d8177828ef
commit
4d64ec8aaa
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user