diff --git a/core/command_container/cmdcontainer.cpp b/core/command_container/cmdcontainer.cpp index aa89f923ed..92632ecab9 100644 --- a/core/command_container/cmdcontainer.cpp +++ b/core/command_container/cmdcontainer.cpp @@ -47,11 +47,13 @@ bool CommandContainer::initialize(Device *device) { heapHelper = std::unique_ptr(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumAvailableDevices() > 1u)); size_t alignedSize = alignUp(totalCmdBufferSize, MemoryConstants::pageSize64k); - NEO::AllocationProperties properties{0u, true /* allocateMemory*/, alignedSize, + NEO::AllocationProperties properties{0u, + true /* allocateMemory*/, + alignedSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, (device->getNumAvailableDevices() > 1u) /* multiOsContextCapable */, false, - NEO::SubDevice::unspecifiedSubDeviceIndex}; + {}}; cmdBufferAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); diff --git a/core/helpers/heap_helper.cpp b/core/helpers/heap_helper.cpp index f083a562f2..06e3e86f5b 100644 --- a/core/helpers/heap_helper.cpp +++ b/core/helpers/heap_helper.cpp @@ -17,15 +17,17 @@ GraphicsAllocation *HeapHelper::getHeapAllocation(size_t heapSize, size_t alignm if (allocation) { return allocation.release(); } - NEO::AllocationProperties properties{rootDeviceIndex, true /* allocateMemory*/, alignment, + NEO::AllocationProperties properties{rootDeviceIndex, + true /* allocateMemory*/, + alignment, GraphicsAllocation::AllocationType::INTERNAL_HEAP, - isMultiOsContextCapable /* multiOsContextCapable */, - false, - NEO::SubDevice::unspecifiedSubDeviceIndex}; + isMultiOsContextCapable, + false /* isMultiStorageAllocation */, + {}}; return this->memManager->allocateGraphicsMemoryWithProperties(properties); } void HeapHelper::storeHeapAllocation(GraphicsAllocation *heapAllocation) { this->storageForReuse->storeAllocation(std::unique_ptr(heapAllocation), NEO::AllocationUsage::REUSABLE_ALLOCATION); } -} // namespace NEO \ No newline at end of file +} // namespace NEO diff --git a/core/program/sync_buffer_handler.cpp b/core/program/sync_buffer_handler.cpp index 433068ad2c..c18a205c96 100644 --- a/core/program/sync_buffer_handler.cpp +++ b/core/program/sync_buffer_handler.cpp @@ -43,7 +43,7 @@ void SyncBufferHandler::prepareForEnqueue(size_t workGroupsCount, Kernel &kernel void SyncBufferHandler::allocateNewBuffer() { AllocationProperties allocationProperties{device.getRootDeviceIndex(), true, bufferSize, GraphicsAllocation::AllocationType::LINEAR_STREAM, - false, false, static_cast(device.getDeviceBitfield().to_ulong())}; + false, false, device.getDeviceBitfield()}; graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties); UNRECOVERABLE_IF(graphicsAllocation == nullptr); diff --git a/runtime/command_stream/command_stream_receiver.cpp b/runtime/command_stream/command_stream_receiver.cpp index 274c2488d4..84b985f3fb 100644 --- a/runtime/command_stream/command_stream_receiver.cpp +++ b/runtime/command_stream/command_stream_receiver.cpp @@ -126,7 +126,7 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS auto allocation = this->getInternalAllocationStorage()->obtainReusableAllocation(allocationSize, allocationType).release(); if (allocation == nullptr) { const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, allocationSize, allocationType, - isMultiOsContextCapable(), false, getDeviceIndex()}; + isMultiOsContextCapable(), false, osContext->getDeviceBitfield()}; allocation = this->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties); } DEBUG_BREAK_IF(allocation == nullptr); @@ -327,7 +327,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType, if (!heapMemory) { heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, true, finalHeapSize, allocationType, - isMultiOsContextCapable(), false, getDeviceIndex()}); + isMultiOsContextCapable(), false, osContext->getDeviceBitfield()}); } else { finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize); } diff --git a/runtime/memory_manager/allocation_properties.h b/runtime/memory_manager/allocation_properties.h index 5895fbeef4..965cd44245 100644 --- a/runtime/memory_manager/allocation_properties.h +++ b/runtime/memory_manager/allocation_properties.h @@ -32,7 +32,7 @@ struct AllocationProperties { GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN; ImageInfo *imgInfo = nullptr; bool multiStorageResource = false; - uint32_t subDeviceIndex = SubDevice::unspecifiedSubDeviceIndex; + DeviceBitfield subDevicesBitfield{}; AllocationProperties(uint32_t rootDeviceIndex, size_t size, GraphicsAllocation::AllocationType allocationType) @@ -50,7 +50,7 @@ struct AllocationProperties { size_t size, GraphicsAllocation::AllocationType allocationType, bool isMultiStorageAllocation) - : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, isMultiStorageAllocation, SubDevice::unspecifiedSubDeviceIndex) {} + : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, isMultiStorageAllocation, {}) {} AllocationProperties(uint32_t rootDeviceIndexParam, bool allocateMemoryParam, @@ -58,8 +58,12 @@ struct AllocationProperties { GraphicsAllocation::AllocationType allocationTypeParam, bool multiOsContextCapableParam, bool isMultiStorageAllocationParam, - uint32_t subDeviceIndexParam) - : rootDeviceIndex(rootDeviceIndexParam), size(sizeParam), allocationType(allocationTypeParam), multiStorageResource(isMultiStorageAllocationParam), subDeviceIndex(subDeviceIndexParam) { + DeviceBitfield subDevicesBitfieldParam) + : rootDeviceIndex(rootDeviceIndexParam), + size(sizeParam), + allocationType(allocationTypeParam), + multiStorageResource(isMultiStorageAllocationParam), + subDevicesBitfield(subDevicesBitfieldParam) { allFlags = 0; flags.flushL3RequiredForRead = 1; flags.flushL3RequiredForWrite = 1; diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 3420a05b25..dc3d6d473a 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -878,7 +878,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat osHandle handle = 1; auto size = 4096u; AllocationProperties properties(0u, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u); - EXPECT_EQ(properties.subDeviceIndex, 0u); + EXPECT_TRUE(properties.subDevicesBitfield.none()); EXPECT_EQ(properties.rootDeviceIndex, 0u); auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false); diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index c8426aa81c..27a014b0b2 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -1557,7 +1557,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledA this->mock->outputHandle = 2u; size_t size = 4096u; AllocationProperties properties(0u, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u); - ASSERT_EQ(properties.subDeviceIndex, 0u); + ASSERT_TRUE(properties.subDevicesBitfield.none()); ASSERT_EQ(properties.rootDeviceIndex, 0u); auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);