Respect forceSystemMemory flag at the end of getAllocationData method

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-05-13 17:42:08 +00:00
committed by Compute-Runtime-Automation
parent e53202e96b
commit a304e609fe
2 changed files with 12 additions and 9 deletions

View File

@@ -51,15 +51,18 @@ TEST_F(MemoryManagerGetAlloctionDataTests, givenNonHostMemoryAllocatoinTypeWhenA
}
TEST_F(MemoryManagerGetAlloctionDataTests, givenForceSystemMemoryFlagWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsSet) {
AllocationData allocData;
AllocationProperties properties(mockRootDeviceIndex, true, 10, GraphicsAllocation::AllocationType::BUFFER, false, mockDeviceBitfield);
properties.flags.forceSystemMemory = true;
MockMemoryManager mockMemoryManager;
mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
auto firstAllocationIdx = static_cast<int>(GraphicsAllocation::AllocationType::UNKNOWN);
auto lastAllocationIdx = static_cast<int>(GraphicsAllocation::AllocationType::COUNT);
EXPECT_TRUE(allocData.flags.useSystemMemory);
EXPECT_EQ(10u, allocData.size);
EXPECT_EQ(nullptr, allocData.hostPtr);
for (int allocationIdx = firstAllocationIdx + 1; allocationIdx != lastAllocationIdx; allocationIdx++) {
AllocationData allocData;
AllocationProperties properties(mockRootDeviceIndex, true, 10, static_cast<GraphicsAllocation::AllocationType>(allocationIdx), false, mockDeviceBitfield);
properties.flags.forceSystemMemory = true;
MockMemoryManager mockMemoryManager;
mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_TRUE(allocData.flags.useSystemMemory);
}
}
TEST_F(MemoryManagerGetAlloctionDataTests, givenMultiRootDeviceIndexAllocationPropertiesWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsSet) {

View File

@@ -436,9 +436,9 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
allocationData.flags.crossRootDeviceAccess = properties.flags.crossRootDeviceAccess;
allocationData.flags.useSystemMemory |= properties.flags.crossRootDeviceAccess;
allocationData.flags.useSystemMemory |= properties.flags.forceSystemMemory;
hwHelper.setExtraAllocationData(allocationData, properties, *hwInfo);
allocationData.flags.useSystemMemory |= properties.flags.forceSystemMemory;
return true;
}