mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
[4/n] Unified Shared Memory
- Add allocation logic for host allocation. Change-Id: Ic250b2165a050bbff7dea1b33b904d6d66cf8113 Related-To: NEO-3148 Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
22187bc5e8
commit
dd0d81672b
@ -160,6 +160,25 @@ TEST_F(SVMMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredWithPr
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::HOST_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
EXPECT_NE(nullptr, allocation->gpuAllocation);
|
||||
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY, allocation->memoryType);
|
||||
EXPECT_EQ(allocationSize, allocation->size);
|
||||
|
||||
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), allocation->gpuAllocation->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, allocation->gpuAllocation->getAllocationType());
|
||||
EXPECT_NE(allocation->gpuAllocation->getMemoryPool(), MemoryPool::LocalMemory);
|
||||
EXPECT_NE(nullptr, allocation->gpuAllocation->getUnderlyingBuffer());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST(SvmAllocationPropertiesTests, givenDifferentMemFlagsWhenGettingSvmAllocationPropertiesThenPropertiesAreCorrectlySet) {
|
||||
SVMAllocsManager::SvmAllocationProperties allocationProperties = MemObjHelper::getSvmAllocationProperties(0);
|
||||
EXPECT_FALSE(allocationProperties.coherent);
|
||||
|
Reference in New Issue
Block a user