Use 64KB pages for SVM allocations when 64KB pages are enabled

- clSVMAlloc allocates 64KB pages as memory storage for both
fine grain and coarse grain allocation

Change-Id: I2068ffb9f5577761f739df47b54bc382e971949c
This commit is contained in:
Hoppe, Mateusz
2017-12-28 11:25:43 +01:00
parent 2b91ea85c6
commit e8fb931ef1
5 changed files with 34 additions and 8 deletions

View File

@@ -735,15 +735,35 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemor
memoryManager.freeGraphicsMemory(imageAllocation);
}
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemoryForSVMIsCalledThenGraphicsAllocationIsReturned) {
OsAgnosticMemoryManager memoryManager;
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesDisabledWhenAllocateGraphicsMemoryForSVMIsCalledThen4KBGraphicsAllocationIsReturned) {
OsAgnosticMemoryManager memoryManager(false);
auto size = 4096u;
auto allignment = 4096u;
auto isCoherent = true;
auto svmAllocation = memoryManager.allocateGraphicsMemoryForSVM(size, allignment, isCoherent);
auto svmAllocation = memoryManager.allocateGraphicsMemoryForSVM(size, isCoherent);
EXPECT_NE(nullptr, svmAllocation);
EXPECT_TRUE(svmAllocation->isCoherent());
EXPECT_EQ(size, svmAllocation->getUnderlyingBufferSize());
uintptr_t address = reinterpret_cast<uintptr_t>(svmAllocation->getUnderlyingBuffer());
EXPECT_EQ(0u, (address & MemoryConstants::pageMask));
memoryManager.freeGraphicsMemory(svmAllocation);
}
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocateGraphicsMemoryForSVMIsCalledThen64KBGraphicsAllocationIsReturned) {
OsAgnosticMemoryManager memoryManager(true);
auto size = 4096u;
auto isCoherent = true;
auto svmAllocation = memoryManager.allocateGraphicsMemoryForSVM(size, isCoherent);
EXPECT_NE(nullptr, svmAllocation);
EXPECT_TRUE(svmAllocation->isCoherent());
EXPECT_EQ(MemoryConstants::pageSize64k, svmAllocation->getUnderlyingBufferSize());
uintptr_t address = reinterpret_cast<uintptr_t>(svmAllocation->getUnderlyingBuffer());
EXPECT_EQ(0u, (address & MemoryConstants::page64kMask));
memoryManager.freeGraphicsMemory(svmAllocation);
}