Restore 2MB size & alignment for CPU SVM.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2021-10-11 10:27:04 +00:00
committed by Compute-Runtime-Automation
parent f4acbd9447
commit 06561a06b6
2 changed files with 7 additions and 6 deletions

View File

@@ -356,7 +356,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
EXPECT_EQ(mockContext.getDevice(0u), allocation->device->getSpecializedDevice<ClDevice>());
EXPECT_EQ(alignUp(allocationSize, 64 * KB), gpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(alignUp(allocationSize, 64 * KB), allocation->cpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize2Mb), allocation->cpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
@@ -385,7 +385,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, 64 * KB), gpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(alignUp(allocationSize, 64 * KB), allocation->cpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize2Mb), allocation->cpuAllocation->getUnderlyingBufferSize());
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());

View File

@@ -396,14 +396,15 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
auto rootDeviceIndex = unifiedMemoryProperties.device
? unifiedMemoryProperties.device->getRootDeviceIndex()
: *unifiedMemoryProperties.rootDeviceIndices.begin();
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
size_t alignedSizeCpu = alignUp<size_t>(size, MemoryConstants::pageSize2Mb);
size_t alignedSizeGpu = alignUp<size_t>(size, MemoryConstants::pageSize64k);
DeviceBitfield subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
AllocationProperties cpuProperties{rootDeviceIndex,
true, // allocateMemory
alignedSize, GraphicsAllocation::AllocationType::SVM_CPU,
alignedSizeCpu, GraphicsAllocation::AllocationType::SVM_CPU,
false, // isMultiStorageAllocation
subDevices};
cpuProperties.alignment = MemoryConstants::pageSize64k;
cpuProperties.alignment = MemoryConstants::pageSize2Mb;
auto cacheRegion = MemoryPropertiesHelper::getCacheRegion(unifiedMemoryProperties.allocationFlags);
MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false, cacheRegion);
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
@@ -426,7 +427,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
AllocationProperties gpuProperties{rootDeviceIndex,
false,
alignedSize,
alignedSizeGpu,
GraphicsAllocation::AllocationType::SVM_GPU,
false,
multiStorageAllocation,