mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Restore 2MB size & alignment for CPU SVM.
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f4acbd9447
commit
06561a06b6
@@ -356,7 +356,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
|
|||||||
EXPECT_EQ(mockContext.getDevice(0u), allocation->device->getSpecializedDevice<ClDevice>());
|
EXPECT_EQ(mockContext.getDevice(0u), allocation->device->getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
EXPECT_EQ(alignUp(allocationSize, 64 * KB), gpuAllocation->getUnderlyingBufferSize());
|
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_GPU, gpuAllocation->getAllocationType());
|
||||||
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_CPU, allocation->cpuAllocation->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(allocationSize, allocation->size);
|
||||||
|
|
||||||
EXPECT_EQ(alignUp(allocationSize, 64 * KB), gpuAllocation->getUnderlyingBufferSize());
|
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_GPU, gpuAllocation->getAllocationType());
|
||||||
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
EXPECT_EQ(GraphicsAllocation::AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
||||||
|
|||||||
@@ -396,14 +396,15 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
|||||||
auto rootDeviceIndex = unifiedMemoryProperties.device
|
auto rootDeviceIndex = unifiedMemoryProperties.device
|
||||||
? unifiedMemoryProperties.device->getRootDeviceIndex()
|
? unifiedMemoryProperties.device->getRootDeviceIndex()
|
||||||
: *unifiedMemoryProperties.rootDeviceIndices.begin();
|
: *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);
|
DeviceBitfield subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
|
||||||
AllocationProperties cpuProperties{rootDeviceIndex,
|
AllocationProperties cpuProperties{rootDeviceIndex,
|
||||||
true, // allocateMemory
|
true, // allocateMemory
|
||||||
alignedSize, GraphicsAllocation::AllocationType::SVM_CPU,
|
alignedSizeCpu, GraphicsAllocation::AllocationType::SVM_CPU,
|
||||||
false, // isMultiStorageAllocation
|
false, // isMultiStorageAllocation
|
||||||
subDevices};
|
subDevices};
|
||||||
cpuProperties.alignment = MemoryConstants::pageSize64k;
|
cpuProperties.alignment = MemoryConstants::pageSize2Mb;
|
||||||
auto cacheRegion = MemoryPropertiesHelper::getCacheRegion(unifiedMemoryProperties.allocationFlags);
|
auto cacheRegion = MemoryPropertiesHelper::getCacheRegion(unifiedMemoryProperties.allocationFlags);
|
||||||
MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false, cacheRegion);
|
MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false, cacheRegion);
|
||||||
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
||||||
@@ -426,7 +427,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
|||||||
|
|
||||||
AllocationProperties gpuProperties{rootDeviceIndex,
|
AllocationProperties gpuProperties{rootDeviceIndex,
|
||||||
false,
|
false,
|
||||||
alignedSize,
|
alignedSizeGpu,
|
||||||
GraphicsAllocation::AllocationType::SVM_GPU,
|
GraphicsAllocation::AllocationType::SVM_GPU,
|
||||||
false,
|
false,
|
||||||
multiStorageAllocation,
|
multiStorageAllocation,
|
||||||
|
|||||||
Reference in New Issue
Block a user