Improve private memory allocation.

-allocate from single bank when only one sub device passed

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2021-08-20 09:46:20 +00:00
committed by Compute-Runtime-Automation
parent d71c68ef0a
commit bf1180753d
2 changed files with 23 additions and 11 deletions

View File

@@ -108,22 +108,24 @@ TEST_F(MultiDeviceStorageInfoTest, givenDisabledFlagForMultiTileIsaPlacementWhen
}
}
TEST_F(MultiDeviceStorageInfoTest, whenCreatingStorageInfoForPrivateSurfaceThenAllMemoryBanksAreOnAndPageTableClonningIsNotRequired) {
TEST_F(MultiDeviceStorageInfoTest, whenCreatingStorageInfoForPrivateSurfaceWithOneTileThenOnlySingleBankIsUsed) {
AllocationProperties properties{mockRootDeviceIndex, false, 0u, GraphicsAllocation::AllocationType::PRIVATE_SURFACE, false, false, singleTileMask};
auto storageInfo = memoryManager->createStorageInfoFromProperties(properties);
EXPECT_FALSE(storageInfo.cloningOfPageTables);
EXPECT_EQ(singleTileMask, storageInfo.memoryBanks);
EXPECT_EQ(singleTileMask, storageInfo.pageTablesVisibility);
EXPECT_FALSE(storageInfo.tileInstanced);
EXPECT_EQ(1u, storageInfo.getNumBanks());
}
TEST_F(MultiDeviceStorageInfoTest, whenCreatingStorageInfoForPrivateSurfaceThenAllMemoryBanksAreOnAndPageTableClonningIsNotRequired) {
AllocationProperties properties{mockRootDeviceIndex, false, 0u, GraphicsAllocation::AllocationType::PRIVATE_SURFACE, false, false, allTilesMask};
auto storageInfo = memoryManager->createStorageInfoFromProperties(properties);
EXPECT_FALSE(storageInfo.cloningOfPageTables);
EXPECT_EQ(allTilesMask, storageInfo.memoryBanks);
EXPECT_EQ(allTilesMask, storageInfo.pageTablesVisibility);
EXPECT_TRUE(storageInfo.tileInstanced);
EXPECT_EQ(numDevices, storageInfo.getNumBanks());
properties.flags.multiOsContextCapable = true;
auto storageInfo2 = memoryManager->createStorageInfoFromProperties(properties);
EXPECT_FALSE(storageInfo2.cloningOfPageTables);
EXPECT_EQ(allTilesMask, storageInfo2.memoryBanks);
EXPECT_EQ(allTilesMask, storageInfo.pageTablesVisibility);
EXPECT_TRUE(storageInfo2.tileInstanced);
EXPECT_EQ(numDevices, storageInfo2.getNumBanks());
EXPECT_EQ(4u, storageInfo.getNumBanks());
}
TEST_F(MultiDeviceStorageInfoTest, givenMultiTileCsrWhenCreatingStorageInfoForInternalHeapThenSingleMemoryBankIsOnAndPageTableClonningIsRequired) {

View File

@@ -66,12 +66,22 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
}
} break;
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
storageInfo.cloningOfPageTables = false;
storageInfo.memoryBanks = allTilesValue;
storageInfo.tileInstanced = true;
break;
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
storageInfo.cloningOfPageTables = false;
if (properties.subDevicesBitfield.count() == 1) {
storageInfo.memoryBanks = preferredTile;
storageInfo.pageTablesVisibility = preferredTile;
} else {
storageInfo.memoryBanks = allTilesValue;
storageInfo.tileInstanced = true;
}
break;
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case GraphicsAllocation::AllocationType::LINEAR_STREAM: