mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 12:42:54 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user