Disable shareable allocs with huge size

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2021-07-27 17:02:31 +00:00
committed by Compute-Runtime-Automation
parent 960d468107
commit 74e6c74071
4 changed files with 25 additions and 2 deletions

View File

@ -73,8 +73,14 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
BaseClass::freeGraphicsMemoryImpl(gfxAllocation);
}
GraphicsAllocation *allocateHugeGraphicsMemory(const AllocationData &allocationData, bool sharedVirtualAddress) override {
allocateHugeGraphicsMemoryCalled = true;
return BaseClass::allocateHugeGraphicsMemory(allocationData, sharedVirtualAddress);
}
uint32_t freeGraphicsMemoryImplCalled = 0u;
bool allocationGraphicsMemory64kbCreated = false;
bool allocateGraphicsMemoryInNonDevicePool = false;
bool allocateHugeGraphicsMemoryCalled = false;
};
} // namespace NEO

View File

@ -347,13 +347,27 @@ TEST_F(WddmMemoryManagerTest, givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalle
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, GivenShareableEnabledWhenAskedToCreateGrahicsAllocationThenValidAllocationIsReturned) {
TEST_F(WddmMemoryManagerSimpleTest, GivenShareableEnabledAndSmallSizeWhenAskedToCreateGrahicsAllocationThenValidAllocationIsReturned) {
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
memoryManager->hugeGfxMemoryChunkSize = MemoryConstants::pageSize64k;
AllocationData allocationData;
allocationData.size = 4096u;
allocationData.flags.shareable = true;
auto allocation = memoryManager->allocateShareableMemory(allocationData);
EXPECT_NE(nullptr, allocation);
EXPECT_FALSE(memoryManager->allocateHugeGraphicsMemoryCalled);
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, GivenShareableEnabledAndHugeSizeWhenAskedToCreateGrahicsAllocationThenValidAllocationIsReturned) {
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
memoryManager->hugeGfxMemoryChunkSize = MemoryConstants::pageSize64k;
AllocationData allocationData;
allocationData.size = 2ULL * MemoryConstants::pageSize64k;
allocationData.flags.shareable = true;
auto allocation = memoryManager->allocateShareableMemory(allocationData);
EXPECT_NE(nullptr, allocation);
EXPECT_TRUE(memoryManager->allocateHugeGraphicsMemoryCalled);
memoryManager->freeGraphicsMemory(allocation);
}