Code cleanup for reduced GPU address space

Change-Id: Ibce79ddbe1f03dac1813b5dc2356a9db86b60200
Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
Pawel Wilma
2018-09-10 12:50:45 +02:00
committed by sys_ocldev
parent 7ec0989eea
commit 8c1db4fb2f
7 changed files with 39 additions and 14 deletions

View File

@@ -1319,6 +1319,28 @@ TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWhenAllocateGraphicsMe
memoryManager.freeGraphicsMemory(allocation);
}
TEST(OsAgnosticMemoryManager, givenReducedGpuAddressSpaceWhenAllocateGraphicsMemoryForHostPtrIsCalledThenAllocationWithoutFragmentsIsCreated) {
OsAgnosticMemoryManager memoryManager;
auto hostPtr = reinterpret_cast<void *>(0x5001);
auto allocation = memoryManager.allocateGraphicsMemoryForHostPtr(13, hostPtr, false);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(0u, allocation->fragmentsStorage.fragmentCount);
memoryManager.freeGraphicsMemory(allocation);
}
TEST(OsAgnosticMemoryManager, givenFullGpuAddressSpaceWhenAllocateGraphicsMemoryForHostPtrIsCalledThenAllocationWithFragmentsIsCreated) {
OsAgnosticMemoryManager memoryManager;
auto hostPtr = reinterpret_cast<void *>(0x5001);
auto allocation = memoryManager.allocateGraphicsMemoryForHostPtr(13, hostPtr, true);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(1u, allocation->fragmentsStorage.fragmentCount);
memoryManager.freeGraphicsMemory(allocation);
}
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenSuccess) {
Gmm *gmm = new Gmm(nullptr, 65536, false);
EXPECT_NE(nullptr, gmm);