mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Remove 2MB alignment from host part of shared allocation
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
8fb4aff41b
commit
7ea11f9e44
@ -326,8 +326,8 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
|
|||||||
EXPECT_EQ(allocationSize, allocation->size);
|
EXPECT_EQ(allocationSize, allocation->size);
|
||||||
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, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
|
||||||
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize2Mb), allocation->cpuAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), allocation->cpuAllocation->getUnderlyingBufferSize());
|
||||||
|
|
||||||
EXPECT_EQ(AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
|
EXPECT_EQ(AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
|
||||||
EXPECT_EQ(AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
EXPECT_EQ(AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
||||||
@ -355,8 +355,8 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
|
|||||||
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation->memoryType);
|
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation->memoryType);
|
||||||
EXPECT_EQ(allocationSize, allocation->size);
|
EXPECT_EQ(allocationSize, allocation->size);
|
||||||
|
|
||||||
EXPECT_EQ(alignUp(allocationSize, 64 * KB), gpuAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
|
||||||
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize2Mb), allocation->cpuAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), allocation->cpuAllocation->getUnderlyingBufferSize());
|
||||||
|
|
||||||
EXPECT_EQ(AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
|
EXPECT_EQ(AllocationType::SVM_GPU, gpuAllocation->getAllocationType());
|
||||||
EXPECT_EQ(AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
EXPECT_EQ(AllocationType::SVM_CPU, allocation->cpuAllocation->getAllocationType());
|
||||||
|
@ -482,13 +482,12 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
|||||||
: *unifiedMemoryProperties.rootDeviceIndices.begin();
|
: *unifiedMemoryProperties.rootDeviceIndices.begin();
|
||||||
auto externalPtr = reinterpret_cast<void *>(unifiedMemoryProperties.allocationFlags.hostptr);
|
auto externalPtr = reinterpret_cast<void *>(unifiedMemoryProperties.allocationFlags.hostptr);
|
||||||
bool useExternalHostPtrForCpu = externalPtr != nullptr;
|
bool useExternalHostPtrForCpu = externalPtr != nullptr;
|
||||||
size_t alignedSizeCpu = alignUp<size_t>(size, MemoryConstants::pageSize2Mb);
|
constexpr auto pageSizeForAlignment = MemoryConstants::pageSize64k;
|
||||||
size_t pageSizeForAlignment = MemoryConstants::pageSize64k;
|
size_t alignedSize = alignUp<size_t>(size, pageSizeForAlignment);
|
||||||
size_t alignedSizeGpu = alignUp<size_t>(size, pageSizeForAlignment);
|
|
||||||
DeviceBitfield subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
|
DeviceBitfield subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
|
||||||
AllocationProperties cpuProperties{rootDeviceIndex,
|
AllocationProperties cpuProperties{rootDeviceIndex,
|
||||||
!useExternalHostPtrForCpu, // allocateMemory
|
!useExternalHostPtrForCpu, // allocateMemory
|
||||||
alignedSizeCpu, AllocationType::SVM_CPU,
|
alignedSize, AllocationType::SVM_CPU,
|
||||||
false, // isMultiStorageAllocation
|
false, // isMultiStorageAllocation
|
||||||
subDevices};
|
subDevices};
|
||||||
cpuProperties.alignment = MemoryConstants::pageSize2Mb;
|
cpuProperties.alignment = MemoryConstants::pageSize2Mb;
|
||||||
@ -516,7 +515,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
|||||||
|
|
||||||
AllocationProperties gpuProperties{rootDeviceIndex,
|
AllocationProperties gpuProperties{rootDeviceIndex,
|
||||||
false,
|
false,
|
||||||
alignedSizeGpu,
|
alignedSize,
|
||||||
AllocationType::SVM_GPU,
|
AllocationType::SVM_GPU,
|
||||||
false,
|
false,
|
||||||
multiStorageAllocation,
|
multiStorageAllocation,
|
||||||
|
Reference in New Issue
Block a user