From 5a29cf8508532461eecc0ccf34e0d8ec6de1cfb8 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Fri, 16 Dec 2022 02:39:48 +0100 Subject: [PATCH] Revert "Check for context in appendMemoryCopy" This reverts commit afd0784c1664d55acbe44e6a0d2c96cccd28227a. Signed-off-by: Compute-Runtime-Validation --- level_zero/core/source/cmdlist/cmdlist.h | 4 +- level_zero/core/source/cmdlist/cmdlist_hw.h | 2 - level_zero/core/source/cmdlist/cmdlist_hw.inl | 9 +- .../core/source/context/context_imp.cpp | 20 ++--- level_zero/core/source/device/bcs_split.h | 2 +- level_zero/core/source/device/device_imp.cpp | 1 - .../test/aub_tests/aub_hello_world_test.cpp | 4 +- .../bindless/bindless_kernel_aub_tests.cpp | 4 +- .../append_kernel_indirect_aub_tests.cpp | 12 +-- .../aub_tests/debugger/debugger_aub_tests.cpp | 2 +- .../unit_tests/mocks/mock_driver_handle.cpp | 2 +- .../sources/cmdlist/test_cmdlist_1.cpp | 26 +----- .../sources/cmdlist/test_cmdlist_6.cpp | 61 -------------- .../sources/cmdlist/test_cmdlist_7.cpp | 15 +--- .../sources/context/test_context.cpp | 6 +- .../unit_tests/sources/memory/test_memory.cpp | 25 ++---- .../xe_hpc_core/test_cmdlist_xe_hpc_core.cpp | 4 - .../xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp | 22 ++--- opencl/source/api/api.cpp | 6 +- .../command_queue/enqueue_svm_tests.cpp | 8 +- .../kernel/kernel_arg_buffer_tests.cpp | 4 +- opencl/test/unit_test/kernel/kernel_tests.cpp | 34 ++++---- .../mem_obj/mem_obj_destruction_tests.cpp | 4 +- .../unified_memory_manager_tests.cpp | 83 ++++++++----------- .../memory_manager/unified_memory_manager.cpp | 28 +++---- .../memory_manager/unified_memory_manager.h | 16 ++-- .../source/program/program_initialization.cpp | 2 +- .../aub_command_stream_receiver_3_tests.cpp | 2 +- .../memory_manager/prefetch_manager_tests.cpp | 2 +- .../unified_memory_manager_cache_tests.cpp | 30 +++---- .../unified_memory_manager_tests.cpp | 4 +- ...m_memory_manager_localmem_prelim_tests.cpp | 44 +++------- .../cpu_page_fault_manager_tests.cpp | 2 +- 33 files changed, 154 insertions(+), 336 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 3302e5bf8c..162a24b82a 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -12,7 +12,6 @@ #include "shared/source/memory_manager/prefetch_manager.h" #include "shared/source/unified_memory/unified_memory.h" -#include "level_zero/core/source/context/context.h" #include #include @@ -27,7 +26,6 @@ struct EventPool; struct Event; struct Kernel; struct CommandQueue; -struct Context; struct CmdListKernelLaunchParams { bool isIndirect = false; @@ -297,7 +295,7 @@ struct CommandList : _ze_command_list_handle_t { return this->isTbxMode && !this->isSyncModeQueue; } - Context *context = nullptr; + ze_context_handle_t hContext = nullptr; std::vector printfKernelContainer; CommandQueue *cmdQImmediate = nullptr; NEO::CommandStreamReceiver *csr = nullptr; diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.h b/level_zero/core/source/cmdlist/cmdlist_hw.h index 2ff960f137..be17e7797c 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.h +++ b/level_zero/core/source/cmdlist/cmdlist_hw.h @@ -12,7 +12,6 @@ #include "shared/source/helpers/vec.h" #include "shared/source/kernel/kernel_arg_descriptor.h" #include "shared/source/memory_manager/memory_pool.h" -#include "shared/source/memory_manager/unified_memory_manager.h" #include "level_zero/core/source/builtin/builtin_functions_lib.h" #include "level_zero/core/source/cmdlist/cmdlist_imp.h" @@ -41,7 +40,6 @@ struct AlignedAllocationData { size_t offset = 0u; NEO::GraphicsAllocation *alloc = nullptr; bool needsFlush = false; - NEO::SvmAllocationData *allocData = nullptr; }; struct CmdListFillKernelArguments { diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 90b308d9d8..26621b4743 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1198,13 +1198,6 @@ ze_result_t CommandListCoreFamily::appendMemoryCopy(void *dstptr, return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } - if ((dstAllocationStruct.allocData && dstAllocationStruct.allocData->context != this->context) || - (srcAllocationStruct.allocData && srcAllocationStruct.allocData->context != this->context)) { - PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, - "Destination and source pointers need to be part of the same context as the list %s\n", ""); - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } - if (size >= 4ull * MemoryConstants::gigaByte) { isStateless = true; } @@ -1963,7 +1956,7 @@ inline AlignedAllocationData CommandListCoreFamily::getAlignedAll } } - return {alignedPtr, offset, alloc, hostPointerNeedsFlush, allocData}; + return {alignedPtr, offset, alloc, hostPointerNeedsFlush}; } template diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index 37e2f2baaf..fd87336e96 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -90,8 +90,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc, } auto usmPtr = this->driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, - unifiedMemoryProperties, - this); + unifiedMemoryProperties); if (usmPtr == nullptr) { return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } @@ -183,7 +182,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice, } void *usmPtr = - this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, this); + this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); if (usmPtr == nullptr) { return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } @@ -284,8 +283,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice, auto usmPtr = this->driverHandle->svmAllocsManager->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, - static_cast(neoDevice->getSpecializedDevice()), - this); + static_cast(neoDevice->getSpecializedDevice())); if (usmPtr == nullptr) { return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } @@ -505,10 +503,6 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice, return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*ptr); - UNRECOVERABLE_IF(alloc == nullptr); - alloc->context = static_cast(this); - return ZE_RESULT_SUCCESS; } @@ -535,10 +529,6 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice, return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*pptr); - UNRECOVERABLE_IF(alloc == nullptr); - alloc->context = static_cast(this); - return ZE_RESULT_SUCCESS; } @@ -767,7 +757,7 @@ ze_result_t ContextImp::createCommandList(ze_device_handle_t hDevice, ze_command_list_handle_t *commandList) { auto ret = L0::Device::fromHandle(hDevice)->createCommandList(desc, commandList); if (*commandList) { - L0::CommandList::fromHandle(*commandList)->context = this; + L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle(); } return ret; } @@ -777,7 +767,7 @@ ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice, ze_command_list_handle_t *commandList) { auto ret = L0::Device::fromHandle(hDevice)->createCommandListImmediate(desc, commandList); if (*commandList) { - L0::CommandList::fromHandle(*commandList)->context = this; + L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle(); } return ret; } diff --git a/level_zero/core/source/device/bcs_split.h b/level_zero/core/source/device/bcs_split.h index 271f5667ff..56c5f1885a 100644 --- a/level_zero/core/source/device/bcs_split.h +++ b/level_zero/core/source/device/bcs_split.h @@ -65,7 +65,7 @@ struct BcsSplit { cmdList->appendEventForProfilingAllWalkers(Event::fromHandle(hSignalEvent), true, true); } - auto markerEventIndex = this->events.obtainForSplit(cmdList->context, MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate::GfxFamily::TimestampPacketType)); + auto markerEventIndex = this->events.obtainForSplit(Context::fromHandle(cmdList->hContext), MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate::GfxFamily::TimestampPacketType)); auto subcopyEventIndex = markerEventIndex * this->cmdQs.size(); StackVec eventHandles; diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index c929d071b2..206852edc2 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -119,7 +119,6 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_ contextImp->allocDeviceMem(this->toHandle(), &deviceDesc, 8, 1, &memory); contextImp->allocDeviceMem(hPeerDevice, &peerDeviceDesc, 8, 1, &peerMemory); - L0::CommandList::fromHandle(commandList)->context = contextImp; auto ret = L0::CommandList::fromHandle(commandList)->appendMemoryCopy(peerMemory, memory, 8, nullptr, 0, nullptr); L0::CommandList::fromHandle(commandList)->close(); diff --git a/level_zero/core/test/aub_tests/aub_hello_world_test.cpp b/level_zero/core/test/aub_tests/aub_hello_world_test.cpp index 81bde8461b..2b7b96cdb3 100644 --- a/level_zero/core/test/aub_tests/aub_hello_world_test.cpp +++ b/level_zero/core/test/aub_tests/aub_hello_world_test.cpp @@ -27,8 +27,8 @@ TEST_F(AUBHelloWorldL0, whenAppendMemoryCopyIsCalledThenMemoryIsProperlyCopied) context->rootDeviceIndices, context->deviceBitfields); - auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); - auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); + auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); memset(srcMemory, val, size); commandList->appendMemoryCopy(dstMemory, srcMemory, size, 0, 0, nullptr); diff --git a/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp b/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp index 64f795fce8..6db3746b9f 100644 --- a/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp +++ b/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp @@ -73,10 +73,10 @@ HWTEST_F(L0BindlessAub, DISABLED_GivenBindlessKernelWhenExecutedThenOutputIsCorr context->rootDeviceIndices, context->deviceBitfields); - auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr); + auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties); memset(bufferSrc, 55, bufferSize); - auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr); + auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties); memset(bufferDst, 0, bufferSize); auto simulatedCsr = AUBFixtureL0::getSimulatedCsr(); diff --git a/level_zero/core/test/aub_tests/cmdlist/append_kernel_indirect_aub_tests.cpp b/level_zero/core/test/aub_tests/cmdlist/append_kernel_indirect_aub_tests.cpp index 734f36deb0..9e4c3f788c 100644 --- a/level_zero/core/test/aub_tests/cmdlist/append_kernel_indirect_aub_tests.cpp +++ b/level_zero/core/test/aub_tests/cmdlist/append_kernel_indirect_aub_tests.cpp @@ -60,9 +60,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsPr context->rootDeviceIndices, context->deviceBitfields); - auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr); + auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties); - auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); memset(outBuffer, 0, size); @@ -104,9 +104,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGroupCountIsProper context->rootDeviceIndices, context->deviceBitfields); - auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr); + auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties); - auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); memset(outBuffer, 0, size); @@ -179,9 +179,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyP uint8_t size = sizeof(uint32_t); - auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr); + auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties); - auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); memset(outBuffer, 0, size); diff --git a/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp b/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp index e97c3c29f2..70751024a1 100644 --- a/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp +++ b/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp @@ -91,7 +91,7 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe context->rootDeviceIndices, context->deviceBitfields); - auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr); + auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties); memset(bufferDst, 0, bufferSize); auto simulatedCsr = AUBFixtureL0::getSimulatedCsr(); diff --git a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp index 7896714b89..694ac12a66 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp @@ -47,7 +47,7 @@ ze_result_t Mock::allocDeviceMem(ze_device_handle_t hDevice, const size_t size, size_t alignment, void **ptr) { NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); if (allocation == nullptr) { return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index d63303f7ac..488145224e 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -29,35 +29,15 @@ namespace ult { using ContextCommandListCreate = Test; -TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextWithWrongOrdinalThenErrorIsReturned) { - ze_command_list_desc_t desc = {}; - ze_command_list_handle_t hCommandList = {}; - desc.commandQueueGroupOrdinal = std::numeric_limits::max(); - - ze_result_t result = context->createCommandList(device, &desc, &hCommandList); - EXPECT_NE(ZE_RESULT_SUCCESS, result); -} - -TEST_F(ContextCommandListCreate, whenCreatingImmediateCommandListFromContextWithWrongOrdinalThenErrorIsReturned) { - ze_command_queue_desc_t desc = {}; - ze_command_list_handle_t hCommandList = {}; - desc.ordinal = std::numeric_limits::max(); - - ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList); - EXPECT_NE(ZE_RESULT_SUCCESS, result); -} - TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextThenSuccessIsReturned) { ze_command_list_desc_t desc = {}; ze_command_list_handle_t hCommandList = {}; ze_result_t result = context->createCommandList(device, &desc, &hCommandList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context); + EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context); L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList); - EXPECT_NE(commandList->context, nullptr); - commandList->destroy(); } @@ -77,11 +57,9 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context); + EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context); L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList); - EXPECT_NE(commandList->context, nullptr); - commandList->destroy(); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index c2a34e6db0..51cf2d28b1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -616,7 +616,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInExternalHostAl HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) { auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - commandList->context = context; constexpr size_t allocSize = 4096; void *dstBuffer = nullptr; @@ -637,7 +636,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocat HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationThenBuiltinFlagIsSetAndDestinationAllocSystemNotSet, IsAtLeastSkl) { auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - commandList->context = context; constexpr size_t size = 4096u; constexpr size_t alignment = 4096u; @@ -648,9 +646,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc &deviceDesc, size, alignment, &dstBuffer); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer); - EXPECT_NE(alloc, nullptr); - EXPECT_EQ(alloc->context, context); void *srcPtr = reinterpret_cast(0x1234); @@ -662,62 +657,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc context->freeMem(dstBuffer); } -HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) { - auto commandList = std::make_unique>>(); - commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - std::unique_ptr context1 = std::make_unique(driverHandle.get()); - commandList->context = context1.get(); - - constexpr size_t size = 4096u; - constexpr size_t alignment = 4096u; - void *dstBuffer = nullptr; - - ze_device_mem_alloc_desc_t deviceDesc = {}; - auto result = context->allocDeviceMem(device->toHandle(), - &deviceDesc, - size, alignment, &dstBuffer); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer); - EXPECT_NE(alloc, nullptr); - EXPECT_EQ(alloc->context, context); - - void *srcPtr = reinterpret_cast(0x1234); - - ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr); - EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT); - - res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr); - EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT); - - context->freeMem(dstBuffer); -} - -HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) { - auto commandList = std::make_unique>>(); - commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - std::unique_ptr context1 = std::make_unique(driverHandle.get()); - commandList->context = context1.get(); - - constexpr size_t size = 4096u; - constexpr size_t alignment = 4096u; - void *dstBuffer = nullptr; - - ze_host_mem_alloc_desc_t hostDesc = {}; - auto result = context->allocHostMem(&hostDesc, - size, alignment, &dstBuffer); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - - void *srcPtr = reinterpret_cast(0x1234); - - ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr); - EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT); - - res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr); - EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT); - - context->freeMem(dstBuffer); -} - HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryFillInUsmHostThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) { auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp index cd27c86d17..a1bf844e74 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp @@ -2241,7 +2241,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW void *usmSrcPtr; ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, 1024, 1u, &usmSrcPtr); - cmdList.context = context; + cmdList.appendMemoryCopy(devicePtr, usmSrcPtr, 1024, nullptr, 0, nullptr); EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u); context->freeMem(usmSrcPtr); @@ -2253,7 +2253,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmDstHostPtrW void *usmHostDstPtr; ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, 1024, 1u, &usmHostDstPtr); - cmdList.context = context; + cmdList.appendMemoryCopy(usmHostDstPtr, nonUsmHostPtr, 1024, nullptr, 0, nullptr); EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u); context->freeMem(usmHostDstPtr); @@ -2265,7 +2265,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW void *usmHostSrcPtr; ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, 1024, 1u, &usmHostSrcPtr); - cmdList.context = context; + cmdList.appendMemoryCopy(nonUsmHostPtr, usmHostSrcPtr, 1024, nullptr, 0, nullptr); EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u); context->freeMem(usmHostSrcPtr); @@ -2274,7 +2274,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) { MockAppendMemoryLockedCopyTestImmediateCmdList cmdList; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr); EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u); } @@ -2282,7 +2281,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostP HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmDstHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) { MockAppendMemoryLockedCopyTestImmediateCmdList cmdList; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - cmdList.context = context; cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr); EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u); } @@ -2292,7 +2290,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndD2HCopyWhenSiz MockAppendMemoryLockedCopyTestImmediateCmdList cmdList; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver; - cmdList.context = context; + cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u); } @@ -2302,7 +2300,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndH2DCopyWhenSiz MockAppendMemoryLockedCopyTestImmediateCmdList cmdList; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver; - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u); } @@ -2322,7 +2319,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWithD EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); auto phEvent = event->toHandle(); - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 1, &phEvent); EXPECT_EQ(cmdList.appendBarrierCalled, 1u); } @@ -2331,7 +2327,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWitho MockAppendMemoryLockedCopyTestImmediateCmdList cmdList; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver; - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr); EXPECT_EQ(cmdList.appendBarrierCalled, 0u); } @@ -2355,7 +2350,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagS auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); auto phEvent = event->toHandle(); - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr); ze_kernel_timestamp_result_t resultTimestamp = {}; auto result = event->queryKernelTimestamp(&resultTimestamp); @@ -2388,7 +2382,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagN auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); auto phEvent = event->toHandle(); - cmdList.context = context; cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr); ze_kernel_timestamp_result_t resultTimestamp = {}; auto result = event->queryKernelTimestamp(&resultTimestamp); diff --git a/level_zero/core/test/unit_tests/sources/context/test_context.cpp b/level_zero/core/test/unit_tests/sources/context/test_context.cpp index deeffae2f5..2074ba27d8 100644 --- a/level_zero/core/test/unit_tests/sources/context/test_context.cpp +++ b/level_zero/core/test/unit_tests/sources/context/test_context.cpp @@ -150,13 +150,13 @@ TEST_F(MultiDeviceContextTests, struct SVMAllocsManagerContextMock : public NEO::SVMAllocsManager { SVMAllocsManagerContextMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} - void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties, void *context) override { + void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties) override { EXPECT_EQ(expectedRootDeviceIndexes.size(), memoryProperties.rootDeviceIndices.size()); EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[0]), memoryProperties.rootDeviceIndices.end()); EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[1]), memoryProperties.rootDeviceIndices.end()); - return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties, context); + return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties); } std::vector expectedRootDeviceIndexes; @@ -746,7 +746,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests, std::map deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device, nullptr); + auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device); EXPECT_NE(nullptr, sharedPtr); auto allocation = svmManager->getSVMAlloc(sharedPtr); diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index 2bae39ec6f..5d572ada53 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -809,15 +809,13 @@ TEST_F(MemoryTest, whenAllocatingDeviceMemoryAsRayTracingAllocationAddressIsIn48 struct SVMAllocsManagerSharedAllocZexPointerMock : public NEO::SVMAllocsManager { SVMAllocsManagerSharedAllocZexPointerMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} void *createHostUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &memoryProperties, - void *context) override { + const UnifiedMemoryProperties &memoryProperties) override { hostUnifiedMemoryAllocationTimes++; return alignedMalloc(4096u, 4096u); } void *createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties, - void *cmdQ, - void *context) override { + void *cmdQ) override { sharedUnifiedMemoryAllocationTimes++; return alignedMalloc(4096u, 4096u); @@ -1075,8 +1073,7 @@ TEST_F(FreeExtTests, struct SVMAllocsManagerOutOFMemoryMock : public NEO::SVMAllocsManager { SVMAllocsManagerOutOFMemoryMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} void *createUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &svmProperties, - void *context) override { + const UnifiedMemoryProperties &svmProperties) override { return nullptr; } }; @@ -1132,23 +1129,19 @@ TEST_F(OutOfMemoryTests, struct SVMAllocsManagerRelaxedSizeMock : public NEO::SVMAllocsManager { SVMAllocsManagerRelaxedSizeMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} - void *createUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &svmProperties, - void *context) override { + const UnifiedMemoryProperties &svmProperties) override { return alignedMalloc(4096u, 4096u); } void *createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties, - void *cmdQ, - void *context) override { + void *cmdQ) override { return alignedMalloc(4096u, 4096u); } void *createHostUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &memoryProperties, - void *context) override { + const UnifiedMemoryProperties &memoryProperties) override { return alignedMalloc(4096u, 4096u); } }; @@ -3822,8 +3815,7 @@ struct SVMAllocsManagerSharedAllocFailMock : public NEO::SVMAllocsManager { SVMAllocsManagerSharedAllocFailMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} void *createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties, - void *cmdQ, - void *context) override { + void *cmdQ) override { return nullptr; } }; @@ -3876,8 +3868,7 @@ TEST_F(SharedAllocFailTests, whenAllocatinSharedMemoryAndAllocationFailsThenOutO struct SVMAllocsManagerSharedAllocMultiDeviceMock : public NEO::SVMAllocsManager { SVMAllocsManagerSharedAllocMultiDeviceMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {} void *createHostUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &memoryProperties, - void *context) override { + const UnifiedMemoryProperties &memoryProperties) override { createHostUnifiedMemoryAllocationTimes++; return alignedMalloc(4096u, 4096u); } diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp index 071b0b3c38..e606fd0c83 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp @@ -409,7 +409,6 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr ze_command_list_handle_t commandListHandle = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)->toHandle(); auto commandList = CommandList::fromHandle(commandListHandle); - commandList->context = context; auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, returnValue); ze_event_pool_desc_t eventPoolDesc = {}; @@ -944,7 +943,6 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_group_count_t groupCount{8, 1, 1}; auto commandList = std::make_unique>>(); result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); - commandList->context = context; ASSERT_EQ(ZE_RESULT_SUCCESS, result); CmdListKernelLaunchParams launchParams = {}; @@ -1080,7 +1078,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule constexpr size_t offset = 32; void *copyPtr = reinterpret_cast(ptr) + offset; - commandList->context = input.context; result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -1141,7 +1138,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule constexpr size_t offset = 32; void *copyPtr = reinterpret_cast(ptr) + offset; - commandList->context = input.context; result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp index a76cc85814..4e675548be 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp @@ -301,7 +301,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -353,7 +352,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -403,7 +401,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -421,6 +418,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe context->allocDeviceMem(device->toHandle(), &deviceDesc, size, alignment, &dstPtr); + auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); @@ -455,7 +453,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -505,7 +502,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -558,7 +554,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -628,7 +623,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -640,21 +634,21 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 2u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.subcopy.size(), 8u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 10u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 2u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 3u); @@ -685,7 +679,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -697,14 +690,14 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u); - auto ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10); + auto ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(ret, 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); @@ -714,7 +707,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe static_cast(testL0Device.get())->bcsSplit.events.marker[1]->hostSignal(); - ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10); + ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10); EXPECT_EQ(ret, 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); @@ -746,7 +739,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); - commandList0->context = context; EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 83de2a9631..22aca931e0 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -3875,7 +3875,7 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL( return nullptr; } - return neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext); + return neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties); } CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( @@ -3923,7 +3923,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL( unifiedMemoryProperties.device = &neoDevice->getDevice(); - return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext); + return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); } CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( @@ -3976,7 +3976,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL( err.set(CL_INVALID_BUFFER_SIZE); return nullptr; } - auto ptr = neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue(neoDevice->getRootDeviceIndex()), neoContext); + auto ptr = neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue(neoDevice->getRootDeviceIndex())); if (!ptr) { err.set(CL_OUT_OF_RESOURCES); } diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp index 609d6c6d47..7d3a38900e 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp @@ -1668,7 +1668,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAll auto allocationSize = 4096u; auto svmManager = this->context->getSVMAllocsManager(); EXPECT_NE(0u, svmManager->getNumAllocs()); - auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr); + auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties); EXPECT_NE(nullptr, unifiedMemoryPtr); EXPECT_EQ(2u, svmManager->getNumAllocs()); @@ -1692,7 +1692,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThen auto allocationSize = 4096u; auto svmManager = this->context->getSVMAllocsManager(); EXPECT_NE(0u, svmManager->getNumAllocs()); - auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr); + auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties); EXPECT_NE(nullptr, unifiedMemoryPtr); EXPECT_EQ(2u, svmManager->getNumAllocs()); @@ -1716,7 +1716,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyC auto allocationSize = 4096u; auto svmManager = this->context->getSVMAllocsManager(); EXPECT_NE(0u, svmManager->getNumAllocs()); - auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr); + auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties); EXPECT_NE(nullptr, unifiedMemoryPtr); EXPECT_EQ(2u, svmManager->getNumAllocs()); @@ -1764,7 +1764,7 @@ HWTEST_F(createHostUnifiedMemoryAllocationTest, EXPECT_EQ(0u, svmManager->getNumAllocs()); auto unifiedMemoryPtr = svmManager->createHostUnifiedMemoryAllocation(allocationSize, - unifiedMemoryProperties, nullptr); + unifiedMemoryProperties); EXPECT_NE(nullptr, unifiedMemoryPtr); EXPECT_EQ(1u, svmManager->getNumAllocs()); diff --git a/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp b/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp index e644676753..4c037ff9ce 100644 --- a/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp @@ -476,11 +476,11 @@ TEST_F(KernelArgBufferTest, givenKernelExecInfoWithIndirectStatelessAccessWhenHa auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields()); deviceProperties.device = &pClDevice->getDevice(); - auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); + auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields()); - auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr); + auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); EXPECT_TRUE(mockKernel.hasIndirectStatelessAccessToHostMemory()); svmAllocationsManager->freeSVMAlloc(unifiedDeviceMemoryAllocation); diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index 38a6a13c32..c901b8b056 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -1200,7 +1200,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); properties.device = pDevice; - auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties, nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties); mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver()); @@ -1227,8 +1227,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); deviceProperties.device = pDevice; auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); - auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr); + auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); + auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver()); EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size()); @@ -1249,8 +1249,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); - auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr); + auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); + auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver()); EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size()); @@ -1273,7 +1273,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); deviceProperties.device = pDevice; - auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size()); @@ -1300,7 +1300,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1334,7 +1334,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1372,7 +1372,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelDoesNotRequireUnifiedMemorySy auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1401,7 +1401,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelRequireUnifiedMemorySyncThenS auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1431,7 +1431,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryRequiredMemSyncWhenMakeRes auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1465,7 +1465,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0); @@ -1494,7 +1494,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); deviceProperties.device = pDevice; - auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size()); @@ -1520,9 +1520,9 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); deviceProperties.device = pDevice; - auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); - auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr); + auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto status = clSetKernelExecInfo(mockKernel.mockMultiDeviceKernel, CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL, sizeof(unifiedMemoryAllocation), &unifiedMemoryAllocation); EXPECT_EQ(CL_SUCCESS, status); @@ -1943,7 +1943,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenExecEnvDoesNotHavePageFaultMa auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(reinterpret_cast(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); @@ -1970,7 +1970,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenIsUnifiedMemorySyncRequiredIs auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); - auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr); + auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); mockPageFaultManager->insertAllocation(reinterpret_cast(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); diff --git a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp index 287f87c3f9..5f83948a6a 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp @@ -554,7 +554,7 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); auto svmAllocationsManager = mockContext.getSVMAllocsManager(); - auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties, nullptr); + auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties); ASSERT_NE(nullptr, sharedMemory); auto svmEntry = svmAllocationsManager->getSVMAlloc(sharedMemory); @@ -588,7 +588,7 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); auto svmAllocationsManager = mockContext.getSVMAllocsManager(); - auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); ASSERT_NE(nullptr, hostMemory); auto svmEntry = svmAllocationsManager->getSVMAlloc(hostMemory); diff --git a/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp index d6e23c13dd..0ce9187782 100644 --- a/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp @@ -169,7 +169,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif auto device = mockContext.getDevice(0u); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = &device->getDevice(); - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); svmManager->freeSVMAlloc(ptr); @@ -211,7 +211,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredW SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = true; auto allocationSize = 4000u; - auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(nullptr, allocation->cpuAllocation); @@ -237,7 +237,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = false; auto allocationSize = 4096u; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(nullptr, allocation->cpuAllocation); @@ -255,7 +255,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) { SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); auto allocationSize = 4096u; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(nullptr, allocation->cpuAllocation); @@ -279,7 +279,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateShar svmManager->memoryManager = &failMemoryManager; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); svmManager->freeSVMAlloc(ptr); @@ -290,7 +290,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithPr SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); auto allocationSize = 4096u; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(nullptr, allocation->cpuAllocation); @@ -316,7 +316,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = &device->getDevice(); auto allocationSize = 4096u; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); @@ -346,7 +346,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); auto allocationSize = 4096u; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); @@ -368,7 +368,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory svmManager->freeSVMAlloc(ptr); } -TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIsAllocatedThenOneStorageIsProduced) { +TEST_F(SVMMemoryAllocatorTest, givenSharedAllocationsDebugFlagWhenDeviceMemoryIsAllocatedThenOneStorageIsProduced) { DebugManagerStateRestore restore; DebugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.set(true); @@ -377,7 +377,7 @@ TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIs SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = &device->getDevice(); auto allocationSize = 4096u; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_NE(nullptr, ptr); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(nullptr, allocation->cpuAllocation); @@ -392,19 +392,6 @@ TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIs svmManager->freeSVMAlloc(ptr); } -TEST_F(SVMMemoryAllocatorTest, givenCallToHostAllocationMemoryThenMemoryIsAllocated) { - DebugManagerStateRestore restore; - - MockContext mockContext; - auto device = mockContext.getDevice(0u); - SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - unifiedMemoryProperties.device = &device->getDevice(); - auto allocationSize = 4096u; - auto ptr = svmManager->createHostUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr); - EXPECT_NE(nullptr, ptr); - svmManager->freeSVMAlloc(ptr); -} - TEST(SvmAllocationPropertiesTests, givenDifferentMemFlagsWhenGettingSvmAllocationPropertiesThenPropertiesAreCorrectlySet) { SVMAllocsManager::SvmAllocationProperties allocationProperties = MemObjHelper::getSvmAllocationProperties(0); EXPECT_FALSE(allocationProperties.coherent); @@ -567,7 +554,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenSharedUnifiedM SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_TRUE(memoryManager->multiStorageResourcePassed); @@ -582,7 +569,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -604,7 +591,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_TRUE(memoryManager->multiStorageResourcePassed); @@ -628,7 +615,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = false; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto expectedSubDevices = unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex); expectedSubDevices.reset(); @@ -653,7 +640,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = &device->getDevice(); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_TRUE(memoryManager->multiStorageResourcePassed); @@ -673,7 +660,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithTwoBitsSetWhenMultiOsContextFlagT auto device = mockContext.getDevice(0u); unifiedMemoryProperties.device = &device->getDevice(); - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -698,7 +685,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithSingleBitsSetWhenMultiOsContextFl std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -719,7 +706,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenNewTracki std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); ASSERT_NE(nullptr, ptr); auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr); @@ -753,7 +740,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenSubsequen std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); ASSERT_NE(nullptr, ptr); auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr); @@ -791,7 +778,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenNewAllocationIsCreatedThenItI std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); ASSERT_NE(nullptr, ptr); auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr); @@ -802,7 +789,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenNewAllocationIsCreatedThenItI // force to non resident graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->updateResidencyTaskCount(GraphicsAllocation::objectNotResident, commandStreamReceiver.getOsContext().getContextId()); - auto ptr2 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr2 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto graphicsAllocation2 = unifiedMemoryManager->getSVMAlloc(ptr); EXPECT_FALSE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->isResident(commandStreamReceiver.getOsContext().getContextId())); @@ -831,7 +818,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationsWhenTheyArePreparedForFreeingThe std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); ASSERT_NE(nullptr, ptr); auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr); @@ -856,7 +843,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh std::map deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}}; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -871,7 +858,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_TRUE(memoryManager->multiStorageResourcePassed); @@ -889,7 +876,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = false; - auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); auto expectedSubDevices = unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex); expectedSubDevices.reset(); @@ -908,7 +895,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleDeviceBi SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -924,7 +911,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -940,7 +927,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties); auto allocation = svmManager->getSVMAlloc(ptr); EXPECT_EQ(MemoryConstants::pageSize, allocation->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize()); @@ -955,7 +942,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = false; - auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_FALSE(memoryManager->multiStorageResourcePassed); @@ -971,7 +958,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); svmManager->multiOsContextSupport = true; - auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); EXPECT_FALSE(memoryManager->multiOsContextCapablePassed); EXPECT_TRUE(memoryManager->multiStorageResourcePassed); @@ -1007,7 +994,7 @@ TEST_F(ShareableUnifiedMemoryManagerPropertiesTest, givenShareableUnifiedPropert unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.allocationFlags.flags.shareable = 1; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); EXPECT_TRUE(memoryManager->shareablePassed); svmManager->freeSVMAlloc(ptr); @@ -1338,7 +1325,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenC SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice(); - auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory); GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); @@ -1369,7 +1356,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCp SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice(); - auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory); GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); @@ -1399,7 +1386,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCp HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) { SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); - auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory); GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); @@ -1429,7 +1416,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenC HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) { SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); - auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); + auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory); GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index f22f20c2a2..f40a3d746e 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -162,13 +162,12 @@ void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationPropertie return createZeroCopySvmAllocation(size, svmProperties, rootDeviceIndices, subdeviceBitfields); } else { UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::NOT_SPECIFIED, rootDeviceIndices, subdeviceBitfields); - return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties, nullptr); + return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties); } } void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &memoryProperties, - void *context) { + const UnifiedMemoryProperties &memoryProperties) { size_t pageSizeForAlignment = MemoryConstants::pageSize; size_t alignedSize = alignUp(size, pageSizeForAlignment); @@ -209,7 +208,6 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size, allocData.device = nullptr; allocData.pageSizeForAlignment = pageSizeForAlignment; allocData.setAllocId(this->allocationsCounter++); - allocData.context = context; std::unique_lock lock(mtx); this->SVMAllocs.insert(allocData); @@ -218,8 +216,7 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size, } void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &memoryProperties, - void *context) { + const UnifiedMemoryProperties &memoryProperties) { auto rootDeviceIndex = memoryProperties.device ? memoryProperties.device->getRootDeviceIndex() : *memoryProperties.rootDeviceIndices.begin(); @@ -288,7 +285,6 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, allocData.allocationFlagsProperty = memoryProperties.allocationFlags; allocData.device = memoryProperties.device; allocData.setAllocId(this->allocationsCounter++); - allocData.context = context; std::unique_lock lock(mtx); this->SVMAllocs.insert(allocData); @@ -297,10 +293,9 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties, - void *cmdQ, - void *context) { + void *cmdQ) { if (memoryProperties.rootDeviceIndices.size() > 1 && memoryProperties.device == nullptr) { - return createHostUnifiedMemoryAllocation(size, memoryProperties, context); + return createHostUnifiedMemoryAllocation(size, memoryProperties); } auto supportDualStorageSharedMemory = memoryManager->isLocalMemorySupported(*memoryProperties.rootDeviceIndices.begin()); @@ -314,12 +309,12 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, void *unifiedMemoryPointer = nullptr; if (useKmdMigration) { - unifiedMemoryPointer = createUnifiedKmdMigratedAllocation(size, {}, memoryProperties, context); + unifiedMemoryPointer = createUnifiedKmdMigratedAllocation(size, {}, memoryProperties); if (!unifiedMemoryPointer) { return nullptr; } } else { - unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(size, {}, memoryProperties, context); + unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(size, {}, memoryProperties); if (!unifiedMemoryPointer) { return nullptr; } @@ -332,14 +327,13 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, auto unifiedMemoryAllocation = this->getSVMAlloc(unifiedMemoryPointer); unifiedMemoryAllocation->memoryType = memoryProperties.memoryType; unifiedMemoryAllocation->allocationFlagsProperty = memoryProperties.allocationFlags; - unifiedMemoryAllocation->context = context; return unifiedMemoryPointer; } - return createUnifiedMemoryAllocation(size, memoryProperties, context); + return createUnifiedMemoryAllocation(size, memoryProperties); } -void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context) { +void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties) { auto rootDeviceIndex = unifiedMemoryProperties.device ? unifiedMemoryProperties.device->getRootDeviceIndex() @@ -372,7 +366,6 @@ void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const Sv allocData.device = unifiedMemoryProperties.device; allocData.size = size; allocData.pageSizeForAlignment = pageSizeForAlignment; - allocData.context = context; allocData.setAllocId(this->allocationsCounter++); std::unique_lock lock(mtx); @@ -479,7 +472,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca return usmPtr; } -void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context) { +void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties) { auto rootDeviceIndex = unifiedMemoryProperties.device ? unifiedMemoryProperties.device->getRootDeviceIndex() : *unifiedMemoryProperties.rootDeviceIndices.begin(); @@ -539,7 +532,6 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co allocData.device = unifiedMemoryProperties.device; allocData.pageSizeForAlignment = pageSizeForAlignment; allocData.size = size; - allocData.context = context; allocData.setAllocId(this->allocationsCounter++); std::unique_lock lock(mtx); diff --git a/shared/source/memory_manager/unified_memory_manager.h b/shared/source/memory_manager/unified_memory_manager.h index 5c93f67e76..fa7276f990 100644 --- a/shared/source/memory_manager/unified_memory_manager.h +++ b/shared/source/memory_manager/unified_memory_manager.h @@ -38,7 +38,6 @@ struct SvmAllocationData { this->allocId = svmAllocData.allocId; this->pageSizeForAlignment = svmAllocData.pageSizeForAlignment; this->isImportedAllocation = svmAllocData.isImportedAllocation; - this->context = svmAllocData.context; for (auto allocation : svmAllocData.gpuAllocations.getGraphicsAllocations()) { if (allocation) { this->gpuAllocations.addAllocation(allocation); @@ -54,7 +53,6 @@ struct SvmAllocationData { MemoryProperties allocationFlagsProperty; Device *device = nullptr; bool isImportedAllocation = false; - void *context = nullptr; void setAllocId(uint32_t id) { allocId = id; } @@ -155,19 +153,15 @@ class SVMAllocsManager { const RootDeviceIndicesContainer &rootDeviceIndices, const std::map &subdeviceBitfields); MOCKABLE_VIRTUAL void *createHostUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &svmProperties, - void *context); + const UnifiedMemoryProperties &svmProperties); MOCKABLE_VIRTUAL void *createUnifiedMemoryAllocation(size_t size, - const UnifiedMemoryProperties &svmProperties, - void *context); + const UnifiedMemoryProperties &svmProperties); MOCKABLE_VIRTUAL void *createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties, - void *cmdQ, - void *context); + void *cmdQ); void *createUnifiedKmdMigratedAllocation(size_t size, const SvmAllocationProperties &svmProperties, - const UnifiedMemoryProperties &unifiedMemoryProperties, - void *context); + const UnifiedMemoryProperties &unifiedMemoryProperties); void setUnifiedAllocationProperties(GraphicsAllocation *allocation, const SvmAllocationProperties &svmProperties); SvmAllocationData *getSVMAlloc(const void *ptr); MOCKABLE_VIRTUAL bool freeSVMAlloc(void *ptr, bool blocking); @@ -186,7 +180,7 @@ class SVMAllocsManager { ResidencyContainer &residencyContainer, uint32_t requestedTypesMask); void makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask); - void *createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context); + void *createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties); void freeSvmAllocationWithDeviceStorage(SvmAllocationData *svmData); bool hasHostAllocations(); std::atomic allocationsCounter = 0; diff --git a/shared/source/program/program_initialization.cpp b/shared/source/program/program_initialization.cpp index b7c79a51e5..d4373a17ed 100644 --- a/shared/source/program/program_initialization.cpp +++ b/shared/source/program/program_initialization.cpp @@ -37,7 +37,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield}); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, subDeviceBitfields); unifiedMemoryProperties.device = &device; - auto ptr = svmAllocManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); + auto ptr = svmAllocManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); DEBUG_BREAK_IF(ptr == nullptr); if (ptr == nullptr) { return nullptr; diff --git a/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp b/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp index 6be7ee20fc..2235221a36 100644 --- a/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp @@ -558,7 +558,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = pDevice; - auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties); ASSERT_NE(nullptr, ptr); auto gfxAllocation = svmManager->getSVMAlloc(ptr)->gpuAllocations.getGraphicsAllocation(0); diff --git a/shared/test/unit_test/memory_manager/prefetch_manager_tests.cpp b/shared/test/unit_test/memory_manager/prefetch_manager_tests.cpp index 72426e70dd..1720614187 100644 --- a/shared/test/unit_test/memory_manager/prefetch_manager_tests.cpp +++ b/shared/test/unit_test/memory_manager/prefetch_manager_tests.cpp @@ -27,7 +27,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingInterfaceFunctionsThen PrefetchContext prefetchContext; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); ASSERT_NE(nullptr, ptr); auto svmData = svmManager->getSVMAlloc(ptr); diff --git a/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp b/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp index 1b5f20f8c3..e3aeeafc6e 100644 --- a/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp +++ b/shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp @@ -55,7 +55,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationCacheEnabledWhenFreeingDeviceA SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device; for (auto &testData : testDataset) { - testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr); + testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); ASSERT_NE(testData.allocation, nullptr); } size_t expectedCacheSize = 0u; @@ -103,7 +103,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device; for (auto &testData : testDataset) { - testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr); + testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); ASSERT_NE(testData.allocation, nullptr); } @@ -119,7 +119,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat std::vector allocationsToFree; for (auto &testData : testDataset) { - auto secondAllocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr); + auto secondAllocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), testDataset.size() - 1); EXPECT_EQ(secondAllocation, testData.allocation); svmManager->freeSVMAlloc(secondAllocation); @@ -151,7 +151,7 @@ TEST(SvmDeviceAllocationCacheTest, givenMultipleAllocationsWhenAllocatingAfterFr SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device; for (auto &testData : testDataset) { - testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr); + testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); ASSERT_NE(testData.allocation, nullptr); } @@ -164,18 +164,18 @@ TEST(SvmDeviceAllocationCacheTest, givenMultipleAllocationsWhenAllocatingAfterFr size_t expectedCacheSize = testDataset.size(); ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), expectedCacheSize); - auto allocationLargerThanInCache = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis << 3, unifiedMemoryProperties, nullptr); + auto allocationLargerThanInCache = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis << 3, unifiedMemoryProperties); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), expectedCacheSize); - auto firstAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr); + auto firstAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties); EXPECT_EQ(firstAllocation, testDataset[0].allocation); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), --expectedCacheSize); - auto secondAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr); + auto secondAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties); EXPECT_EQ(secondAllocation, testDataset[1].allocation); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), --expectedCacheSize); - auto thirdAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr); + auto thirdAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties); EXPECT_EQ(thirdAllocation, testDataset[2].allocation); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u); @@ -252,7 +252,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentFlagsWhenAllocat for (auto &allocationDataToVerify : testDataset) { for (auto &testData : testDataset) { - testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, testData.unifiedMemoryProperties, nullptr); + testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, testData.unifiedMemoryProperties); } ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u); @@ -261,10 +261,10 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentFlagsWhenAllocat } ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), testDataset.size()); - auto allocationFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties, nullptr); + auto allocationFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties); EXPECT_EQ(allocationFromCache, allocationDataToVerify.allocation); - auto allocationNotFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties, nullptr); + auto allocationNotFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties); for (auto &cachedAllocation : testDataset) { EXPECT_NE(allocationNotFromCache, cachedAllocation.allocation); } @@ -293,8 +293,8 @@ TEST(SvmDeviceAllocationCacheTest, givenDeviceOutOfMemoryWhenAllocatingThenCache SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device; - auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); - auto allocationInCache2 = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); + auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); + auto allocationInCache2 = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u); svmManager->freeSVMAlloc(allocationInCache); svmManager->freeSVMAlloc(allocationInCache2); @@ -302,11 +302,11 @@ TEST(SvmDeviceAllocationCacheTest, givenDeviceOutOfMemoryWhenAllocatingThenCache ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 2u); ASSERT_NE(svmManager->getSVMAlloc(allocationInCache), nullptr); ASSERT_NE(svmManager->getSVMAlloc(allocationInCache2), nullptr); - auto ptr = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k * 2, unifiedMemoryProperties, nullptr); + auto ptr = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k * 2, unifiedMemoryProperties); EXPECT_NE(ptr, nullptr); EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u); svmManager->freeSVMAlloc(ptr); svmManager->trimUSMDeviceAllocCache(); ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u); -} \ No newline at end of file +} diff --git a/shared/test/unit_test/memory_manager/unified_memory_manager_tests.cpp b/shared/test/unit_test/memory_manager/unified_memory_manager_tests.cpp index d1f89771fe..9d1b93a164 100644 --- a/shared/test/unit_test/memory_manager/unified_memory_manager_tests.cpp +++ b/shared/test/unit_test/memory_manager/unified_memory_manager_tests.cpp @@ -46,7 +46,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSharedAllocWithOffsetPointerThenReso SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); auto allocationSize = 4096u; - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ); EXPECT_NE(nullptr, ptr); auto svmData = svmManager->getSVMAlloc(ptr); auto pageFaultMemoryData = mockPageFaultManager->memoryData.find(ptr); @@ -74,7 +74,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenKmdMigratedSharedAllocationWhenPrefetch SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ, nullptr); + auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); EXPECT_NE(nullptr, ptr); auto svmData = svmManager->getSVMAlloc(ptr); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp index 6367abc65f..141c84fa96 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp @@ -433,7 +433,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -479,33 +479,11 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, MmapFailWhenCreateSharedUnifiedMem SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_EQ(ptr, nullptr); } -TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCallToHostAllocationMemoryThenMemoryIsAllocated) { - DebugManagerStateRestore restorer; - - bool svmSupported = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.ftrSvm; - if (!svmSupported) { - GTEST_SKIP(); - } - - RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; - std::map deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; - SVMAllocsManager unifiedMemoryManager(memoryManager, false); - - SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto allocationSize = 4096u; - - auto ptr = unifiedMemoryManager.createHostUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr); - - EXPECT_NE(ptr, nullptr); - - unifiedMemoryManager.freeSVMAlloc(ptr); -} - TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateSharedUnifiedMemoryAllocationWithDeviceThenKmdMigratedAllocationIsCreated) { DebugManagerStateRestore restorer; DebugManager.flags.UseKmdMigration.set(1); @@ -526,7 +504,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device.get(); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -574,7 +552,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseAtomicAttributeWhe for (auto atomicAdvise : {-1, 0, 1, 2}) { DebugManager.flags.SetVmAdviseAtomicAttribute.set(atomicAdvise); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); ASSERT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -626,7 +604,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationAndUsmInitialP SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device.get(); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -669,7 +647,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationWithAccessCoun SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); unifiedMemoryProperties.device = device.get(); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -709,7 +687,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, whenVmAdviseIoctlFailsThenCreateSh SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_EQ(ptr, nullptr); EXPECT_TRUE(mock->context.receivedVmAdvise); @@ -732,7 +710,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_EQ(ptr, nullptr); } @@ -759,7 +737,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS auto size = 2 * MemoryConstants::megaByte; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -806,7 +784,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateKmdMigratedSharedAlloca auto size = 2 * MemoryConstants::megaByte; SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); EXPECT_NE(ptr, nullptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); @@ -1485,7 +1463,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenPrintBOCreateDestroyResultFla SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); testing::internal::CaptureStdout(); - auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr); + auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); EXPECT_NE(nullptr, ptr); auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation(); diff --git a/shared/test/unit_test/page_fault_manager/cpu_page_fault_manager_tests.cpp b/shared/test/unit_test/page_fault_manager/cpu_page_fault_manager_tests.cpp index 19aeea1fe3..466b9be8d5 100644 --- a/shared/test/unit_test/page_fault_manager/cpu_page_fault_manager_tests.cpp +++ b/shared/test/unit_test/page_fault_manager/cpu_page_fault_manager_tests.cpp @@ -627,7 +627,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSetAubWritableIsCalledTh auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields); void *cmdQ = reinterpret_cast(0xFFFF); - void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ, nullptr); + void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ); pageFaultManager->baseAubWritable(false, alloc1, unifiedMemoryManager.get());