mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
Fix alignment for host allocations.
- it is 4k not 64k. Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
15ac453a5f
commit
151aaf7678
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -50,7 +50,7 @@ void executeGpuKernelAndValidate(ze_context_handle_t context, ze_device_handle_t
|
||||
uint32_t typeSize = sizeof(uint32_t);
|
||||
uint32_t srcAdditionalMul = 3u;
|
||||
|
||||
uint32_t expectedMemorySize = arraySize * vectorSize * typeSize;
|
||||
uint32_t expectedMemorySize = arraySize * vectorSize * typeSize * 2;
|
||||
uint32_t srcMemorySize = expectedMemorySize * srcAdditionalMul;
|
||||
uint32_t idxMemorySize = arraySize * sizeof(uint32_t);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -806,6 +806,21 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(UnifiedMemoryManagerPropertiesTest,
|
||||
given1ByteAsAllocationSizeWhenHostMemAllocIsCreatedItIsAlignedTo4k) {
|
||||
std::set<uint32_t> rootDeviceIndices{mockRootDeviceIndex};
|
||||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties);
|
||||
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, allocation->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize());
|
||||
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(UnifiedMemoryManagerPropertiesTest,
|
||||
givenSvmManagerMultiOsContextSupportFlagFalseWhenRootDeviceIsMultiThenMultiStorageFlagFalse) {
|
||||
std::set<uint32_t> rootDeviceIndices{mockRootDeviceIndex};
|
||||
|
||||
@@ -125,7 +125,7 @@ void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationPropertie
|
||||
|
||||
void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties) {
|
||||
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
|
||||
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize);
|
||||
|
||||
bool compressionEnabled = false;
|
||||
GraphicsAllocation::AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled);
|
||||
|
||||
Reference in New Issue
Block a user