Fix alignment for host allocations.

- it is 4k not 64k.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2022-01-20 13:06:07 +00:00
committed by Compute-Runtime-Automation
parent 15ac453a5f
commit 151aaf7678
3 changed files with 19 additions and 4 deletions

View File

@ -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};