diff --git a/shared/source/memory_manager/definitions/storage_info.cpp b/shared/source/memory_manager/definitions/storage_info.cpp index 8baebcace6..e1f5d012c4 100644 --- a/shared/source/memory_manager/definitions/storage_info.cpp +++ b/shared/source/memory_manager/definitions/storage_info.cpp @@ -19,8 +19,10 @@ namespace NEO { StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationProperties &properties) { + StorageInfo storageInfo{}; + storageInfo.isLockable = GraphicsAllocation::isLockable(properties.allocationType) || (properties.makeDeviceBufferLockable && properties.allocationType == AllocationType::BUFFER); if (properties.subDevicesBitfield.count() == 0) { - return {}; + return storageInfo; } const auto deviceCount = GfxCoreHelper::getSubDevicesCount(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo()); @@ -38,9 +40,10 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope preferredTile.set(leastOccupiedBank); } - StorageInfo storageInfo{preferredTile, allTilesValue}; + storageInfo.memoryBanks = preferredTile; + storageInfo.pageTablesVisibility = allTilesValue; + storageInfo.subDeviceBitfield = properties.subDevicesBitfield; - storageInfo.isLockable = GraphicsAllocation::isLockable(properties.allocationType) || (properties.makeDeviceBufferLockable && properties.allocationType == AllocationType::BUFFER); storageInfo.cpuVisibleSegment = GraphicsAllocation::isCpuAccessRequired(properties.allocationType); AppResourceHelper::copyResourceTagStr(storageInfo.resourceTag, properties.allocationType, diff --git a/shared/test/unit_test/memory_manager/storage_info_tests.cpp b/shared/test/unit_test/memory_manager/storage_info_tests.cpp index 570a66d9bb..70d08f0d2a 100644 --- a/shared/test/unit_test/memory_manager/storage_info_tests.cpp +++ b/shared/test/unit_test/memory_manager/storage_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -435,10 +435,24 @@ TEST_F(MultiDeviceStorageInfoTest, givenLeastOccupiedBankAndOtherBitsEnabledInSu EXPECT_TRUE(storageInfo.memoryBanks.test(leastOccupiedBank)); } -TEST_F(MultiDeviceStorageInfoTest, givenNoSubdeviceBitfieldWhenCreateStorageInfoThenReturnEmptyStorageInfo) { - AllocationProperties properties{mockRootDeviceIndex, false, 1u, AllocationType::UNKNOWN, false, {}}; +TEST_F(MultiDeviceStorageInfoTest, givenNoSubdeviceBitfieldWhenCreateStorageInfoForNonLockableAllocationThenReturnEmptyStorageInfo) { + AllocationType allocationType = AllocationType::BUFFER; + EXPECT_FALSE(GraphicsAllocation::isLockable(allocationType)); + AllocationProperties properties{mockRootDeviceIndex, false, 1u, allocationType, false, {}}; StorageInfo emptyInfo{}; - EXPECT_EQ(memoryManager->createStorageInfoFromProperties(properties).getMemoryBanks(), emptyInfo.getMemoryBanks()); + auto storageInfo = memoryManager->createStorageInfoFromProperties(properties); + EXPECT_EQ(storageInfo.getMemoryBanks(), emptyInfo.getMemoryBanks()); + EXPECT_FALSE(storageInfo.isLockable); +} + +TEST_F(MultiDeviceStorageInfoTest, givenNoSubdeviceBitfieldWhenCreateStorageInfoForNonLockableAllocationThenReturnEmptyStorageInfoWithLockableFlag) { + AllocationType allocationType = AllocationType::BUFFER_HOST_MEMORY; + EXPECT_TRUE(GraphicsAllocation::isLockable(allocationType)); + AllocationProperties properties{mockRootDeviceIndex, false, 1u, allocationType, false, {}}; + StorageInfo emptyInfo{}; + auto storageInfo = memoryManager->createStorageInfoFromProperties(properties); + EXPECT_EQ(storageInfo.getMemoryBanks(), emptyInfo.getMemoryBanks()); + EXPECT_TRUE(storageInfo.isLockable); } TEST_F(MultiDeviceStorageInfoTest, givenGraphicsAllocationWithCpuAccessRequiredWhenCreatingStorageInfoThenSetCpuVisibleSegmentIsRequiredAndIsLockableFlagIsEnabled) {