diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 494c589571..e85754fc42 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -4149,7 +4149,7 @@ void *CL_API_CALL clSVMAlloc(cl_context context, return pAlloc; } - pAlloc = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, MemObjHelper::getSvmAllocationProperties(flags)); + pAlloc = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, MemObjHelper::getSvmAllocationProperties(flags), pDevice->getDeviceBitfield()); if (pContext->isProvidingPerformanceHints()) { pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_SVM_ALLOC_MEETS_ALIGNMENT_RESTRICTIONS, pAlloc, size); diff --git a/opencl/test/unit_test/api/cl_svm_alloc_tests.inl b/opencl/test/unit_test/api/cl_svm_alloc_tests.inl index b493eedf7a..5670dbb931 100644 --- a/opencl/test/unit_test/api/cl_svm_alloc_tests.inl +++ b/opencl/test/unit_test/api/cl_svm_alloc_tests.inl @@ -9,6 +9,7 @@ #include "shared/test/unit_test/utilities/base_object_utils.h" #include "opencl/source/context/context.h" +#include "opencl/test/unit_test/mocks/mock_memory_manager.h" #include "opencl/test/unit_test/mocks/mock_platform.h" #include "opencl/test/unit_test/test_macros/test_checks_ocl.h" @@ -213,4 +214,25 @@ TEST_F(clSVMAllocTests, GivenAlignmentTooLargeWhenAllocatingSvmThenSvmIsNotAlloc auto SVMPtr = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 4096 /* Size */, 4096 /* alignment */); EXPECT_EQ(nullptr, SVMPtr); }; +TEST(clSvmAllocTest, givenSubDeviceWhenCreatingSvmAllocThenProperDeviceBitfieldIsPassed) { + REQUIRE_SVM_OR_SKIP(defaultHwInfo.get()); + UltClDeviceFactory deviceFactory{1, 2}; + auto device = deviceFactory.subDevices[1]; + auto expectedDeviceBitfield = device->getDeviceBitfield(); + + auto executionEnvironment = device->getExecutionEnvironment(); + auto memoryManager = new MockMemoryManager(*executionEnvironment); + + std::unique_ptr memoryManagerBackup(memoryManager); + std::swap(memoryManagerBackup, executionEnvironment->memoryManager); + + MockContext context(device); + EXPECT_NE(expectedDeviceBitfield, memoryManager->recentlyPassedDeviceBitfield); + auto svmPtr = clSVMAlloc(&context, CL_MEM_READ_WRITE, MemoryConstants::pageSize, MemoryConstants::cacheLineSize); + EXPECT_NE(nullptr, svmPtr); + EXPECT_EQ(expectedDeviceBitfield, memoryManager->recentlyPassedDeviceBitfield); + clSVMFree(&context, svmPtr); + + std::swap(memoryManagerBackup, executionEnvironment->memoryManager); +} } // namespace ULT diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp index 7b07c9cc7c..a2ac94f2e0 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp @@ -35,9 +35,9 @@ struct EnqueueSvmMemCopyTest : public DeviceFixture, } CommandQueueFixture::SetUp(pClDevice, 0); - srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); ASSERT_NE(nullptr, srcSvmPtr); - dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); ASSERT_NE(nullptr, dstSvmPtr); auto srcSvmData = context->getSVMAllocsManager()->getSVMAlloc(srcSvmPtr); ASSERT_NE(nullptr, srcSvmData); @@ -312,7 +312,7 @@ struct EnqueueSvmMemCopyHw : public ::testing::Test { } context = std::make_unique(device.get()); - srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); ASSERT_NE(nullptr, srcSvmPtr); dstHostPtr = alignedMalloc(256, 64); } diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp index fffbea3a74..2ac8126d4d 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp @@ -34,7 +34,7 @@ struct EnqueueSvmMemFillTest : public DeviceFixture, ASSERT_TRUE((0 < patternSize) && (patternSize <= 128)); SVMAllocsManager::SvmAllocationProperties svmProperties; svmProperties.coherent = true; - svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties); + svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties, {}); ASSERT_NE(nullptr, svmPtr); auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtr); ASSERT_NE(nullptr, svmData); @@ -156,7 +156,7 @@ struct EnqueueSvmMemFillHw : public ::testing::Test { } context = std::make_unique(device.get()); - svmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + svmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); ASSERT_NE(nullptr, svmPtr); } 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 ec28dc1ae2..fc2c732037 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp @@ -43,7 +43,7 @@ struct EnqueueSvmTest : public DeviceFixture, REQUIRE_SVM_OR_SKIP(defaultHwInfo); DeviceFixture::SetUp(); CommandQueueFixture::SetUp(pClDevice, 0); - ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); } void TearDown() override { @@ -251,7 +251,7 @@ TEST_F(EnqueueSvmTest, GivenNullDstPtrWhenCopyingMemoryThenInvalidVaueErrorIsRet DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableAsyncEventsHandler.set(false); void *pDstSVM = nullptr; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); retVal = this->pCmdQ->enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -496,7 +496,7 @@ TEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrAndSizeZeroWhenEnqueueSVMMemc HWTEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSVMMemcpyThenSvmMemcpyCommandIsEnqueued) { void *pDstSVM = ptrSVM; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy @@ -526,7 +526,7 @@ HWTEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSVMMemcpyThe TEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueBlockingSVMMemcpyThenSuccessIsReturned) { void *pDstSVM = ptrSVM; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); retVal = this->pCmdQ->enqueueSVMMemcpy( true, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -542,7 +542,7 @@ TEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueBlockingSVMMemcpyThenSucc TEST_F(EnqueueSvmTest, GivenValidParamsWhenCopyingMemoryWithBlockingThenSuccessisReturned) { void *pDstSVM = ptrSVM; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); auto uEvent = make_releaseable(); cl_event eventWaitList[] = {uEvent.get()}; retVal = this->pCmdQ->enqueueSVMMemcpy( @@ -563,7 +563,7 @@ TEST_F(EnqueueSvmTest, GivenCoherencyWhenCopyingMemoryThenSuccessIsReturned) { void *pDstSVM = ptrSVM; SVMAllocsManager::SvmAllocationProperties svmProperties; svmProperties.coherent = true; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties, {}); retVal = this->pCmdQ->enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -581,7 +581,7 @@ TEST_F(EnqueueSvmTest, GivenCoherencyWhenCopyingMemoryWithBlockingThenSuccessIsR void *pDstSVM = ptrSVM; SVMAllocsManager::SvmAllocationProperties svmProperties; svmProperties.coherent = true; - void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties); + void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties, {}); auto uEvent = make_releaseable(); cl_event eventWaitList[] = {uEvent.get()}; retVal = this->pCmdQ->enqueueSVMMemcpy( @@ -806,7 +806,7 @@ TEST_F(EnqueueSvmTest, GivenMultipleThreasWhenAllocatingSvmThenOnlyOneAllocation auto allocSvm = [&](uint32_t from, uint32_t to) { for (uint32_t i = from; i <= to; i++) { - svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 1, {}); + svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 1, {}, {}); auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtrs[i]); ASSERT_NE(nullptr, svmData); auto ga = svmData->gpuAllocation; @@ -882,7 +882,7 @@ TEST(CreateSvmAllocTests, givenVariousSvmAllocationPropertiesWhenAllocatingSvmTh svmAllocationProperties.readOnly = isReadOnly; svmAllocationProperties.hostPtrReadOnly = isHostPtrReadOnly; - auto ptrSVM = mockContext->getSVMAllocsManager()->createSVMAlloc(mockDevice->getRootDeviceIndex(), 256, svmAllocationProperties); + auto ptrSVM = mockContext->getSVMAllocsManager()->createSVMAlloc(mockDevice->getRootDeviceIndex(), 256, svmAllocationProperties, {}); EXPECT_NE(nullptr, ptrSVM); mockContext->getSVMAllocsManager()->freeSVMAlloc(ptrSVM); } @@ -900,7 +900,7 @@ struct EnqueueSvmTestLocalMemory : public DeviceFixture, DeviceFixture::SetUp(); context = std::make_unique(pClDevice, true); size = 256; - svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, {}); + svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, {}, {}); ASSERT_NE(nullptr, svmPtr); mockSvmManager = reinterpret_cast(context->getSVMAllocsManager()); } @@ -1423,7 +1423,7 @@ TEST_F(EnqueueSvmTest, givenPageFaultManagerWhenEnqueueMemcpyThenAllocIsDecommit mockMemoryManager->pageFaultManager.reset(new MockPageFaultManager()); auto memoryManager = context->getMemoryManager(); context->memoryManager = mockMemoryManager.get(); - auto srcSvm = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + auto srcSvm = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); mockMemoryManager->getPageFaultManager()->insertAllocation(srcSvm, 256, context->getSVMAllocsManager(), context->getSpecialQueue()); mockMemoryManager->getPageFaultManager()->insertAllocation(ptrSVM, 256, context->getSVMAllocsManager(), context->getSpecialQueue()); EXPECT_EQ(static_cast(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 2); diff --git a/opencl/test/unit_test/command_queue/zero_size_enqueue_tests.cpp b/opencl/test/unit_test/command_queue/zero_size_enqueue_tests.cpp index 422f40d641..a947f0123f 100644 --- a/opencl/test/unit_test/command_queue/zero_size_enqueue_tests.cpp +++ b/opencl/test/unit_test/command_queue/zero_size_enqueue_tests.cpp @@ -782,8 +782,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingSv REQUIRE_SVM_OR_SKIP(pDevice); auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); - void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); - void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); + void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); size_t zeroSize = 0; mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, nullptr); EXPECT_EQ(static_cast(CL_COMMAND_MARKER), mockCmdQ->lastCommandType); @@ -797,8 +797,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingSv auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; - void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); - void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); + void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); size_t zeroSize = 0; mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, &event); EXPECT_EQ(static_cast(CL_COMMAND_MARKER), mockCmdQ->lastCommandType); @@ -820,7 +820,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingSv REQUIRE_SVM_OR_SKIP(pDevice); auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); - void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); const float pattern[1] = {1.2345f}; size_t zeroSize = 0; mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, nullptr); @@ -834,7 +834,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingSv auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; - void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); const float pattern[1] = {1.2345f}; size_t zeroSize = 0; mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, &event); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp index 0ae6fcb15b..aa078434ae 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp @@ -1437,7 +1437,7 @@ HWTEST_F(BcsTests, givenNonZeroCopySvmAllocationWhenConstructingBlitPropertiesFo SVMAllocsManager svmAllocsManager(&mockMemoryManager); auto svmAllocationProperties = MemObjHelper::getSvmAllocationProperties(CL_MEM_READ_WRITE); - auto svmAlloc = svmAllocsManager.createSVMAlloc(csr.getRootDeviceIndex(), 1, svmAllocationProperties); + auto svmAlloc = svmAllocsManager.createSVMAlloc(csr.getRootDeviceIndex(), 1, svmAllocationProperties, {}); auto svmData = svmAllocsManager.getSVMAlloc(svmAlloc); EXPECT_NE(nullptr, svmData->gpuAllocation); @@ -1480,7 +1480,7 @@ HWTEST_F(BcsTests, givenSvmAllocationWhenBlitCalledThenUsePassedPointers) { SVMAllocsManager svmAllocsManager(&mockMemoryManager); auto svmAllocationProperties = MemObjHelper::getSvmAllocationProperties(CL_MEM_READ_WRITE); - auto svmAlloc = svmAllocsManager.createSVMAlloc(csr.getRootDeviceIndex(), 1, svmAllocationProperties); + auto svmAlloc = svmAllocsManager.createSVMAlloc(csr.getRootDeviceIndex(), 1, svmAllocationProperties, {}); auto svmData = svmAllocsManager.getSVMAlloc(svmAlloc); EXPECT_NE(nullptr, svmData->gpuAllocation); diff --git a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp index 45f29b38eb..c885dc4564 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp @@ -664,7 +664,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueUnmapIsCalling TEST_F(PerformanceHintEnqueueTest, GivenSVMPointerWhenEnqueueSVMMapIsCallingThenContextProvidesProperHint) { REQUIRE_SVM_OR_SKIP(pPlatform->getClDevice(0)); - void *svmPtr = context->getSVMAllocsManager()->createSVMAlloc(0, 256, {}); + void *svmPtr = context->getSVMAllocsManager()->createSVMAlloc(0, 256, {}, {}); pCmdQ->enqueueSVMMap(CL_FALSE, 0, svmPtr, 256, 0, nullptr, nullptr, false); diff --git a/opencl/test/unit_test/kernel/clone_kernel_tests.cpp b/opencl/test/unit_test/kernel/clone_kernel_tests.cpp index 98ca35cae4..e1e0a4d523 100644 --- a/opencl/test/unit_test/kernel/clone_kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/clone_kernel_tests.cpp @@ -512,7 +512,7 @@ TEST_F(CloneKernelTest, GivenArgImmediateWhenCloningKernelThenKernelInfoIsCorrec TEST_F(CloneKernelTest, GivenExecInfoWhenCloningKernelThenSvmAllocationIsCorrect) { REQUIRE_SVM_OR_SKIP(pDevice); - void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); ASSERT_NE(nullptr, ptrSVM); auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(ptrSVM); diff --git a/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp index 4cc90feb4d..00eb8e336a 100644 --- a/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp @@ -291,7 +291,7 @@ TEST_F(BufferSetArgTest, clSetKernelArgBuffer) { TEST_F(BufferSetArgTest, clSetKernelArgSVMPointer) { REQUIRE_SVM_OR_SKIP(pDevice); - void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); + void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, {}); EXPECT_NE(nullptr, ptrSVM); auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(ptrSVM); diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index 729d73ae74..94bbded8d7 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -611,7 +611,7 @@ struct RenderCompressedBuffersSvmTests : public RenderCompressedBuffersTests { TEST_F(RenderCompressedBuffersSvmTests, givenSvmAllocationWhenCreatingBufferThenForceDisableCompression) { hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; - auto svmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), sizeof(uint32_t), {}); + auto svmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), sizeof(uint32_t), {}, {}); auto expectedAllocationType = context->getSVMAllocsManager()->getSVMAlloc(svmPtr)->gpuAllocation->getAllocationType(); buffer.reset(Buffer::create(context.get(), CL_MEM_USE_HOST_PTR, sizeof(uint32_t), svmPtr, retVal)); EXPECT_EQ(expectedAllocationType, buffer->getGraphicsAllocation()->getAllocationType()); @@ -979,7 +979,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenDstHostPtrWhenEnqueueSVMMemcpyThenEnqueu auto cmdQ = clUniquePtr(new MockCommandQueueHw(bcsMockContext.get(), device.get(), nullptr)); auto pDstSVM = std::make_unique(1); - auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 1, {}); + auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 1, {}, {}); cmdQ->enqueueSVMMemcpy(true, pDstSVM.get(), pSrcSVM, 1, 0, nullptr, nullptr); @@ -1000,7 +1000,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSrcHostPtrWhenEnqueueSVMMemcpyThenEnqueu auto cmdQ = clUniquePtr(new MockCommandQueueHw(bcsMockContext.get(), device.get(), nullptr)); auto pSrcSVM = std::make_unique(1); - auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 1, {}); + auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 1, {}, {}); cmdQ->enqueueSVMMemcpy(true, pDstSVM, pSrcSVM.get(), 1, 0, nullptr, nullptr); @@ -1657,7 +1657,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingSVMMemcpyAndEnqueuReadBufferIsCa myMockCsr->gpgpuCsr = &gpgpuCsr; auto pDstSVM = std::make_unique(256); - auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); cmdQ->enqueueSVMMemcpy(false, pDstSVM.get(), pSrcSVM, 256, 0, nullptr, nullptr); EXPECT_EQ(0u, myMockCsr->waitForTaskCountAndCleanAllocationListCalled); @@ -1690,7 +1690,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSrcHostPtrBlockingEnqueueSVMMemcpyAndEnq myMockCsr->gpgpuCsr = &gpgpuCsr; auto pSrcSVM = std::make_unique(256); - auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); cmdQ->enqueueSVMMemcpy(false, pDstSVM, pSrcSVM.get(), 256, 0, nullptr, nullptr); EXPECT_EQ(0u, myMockCsr->waitForTaskCountAndCleanAllocationListCalled); @@ -1744,8 +1744,8 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSvmToSvmCopyWhenEnqueueSVMMemcpyThenSvmM using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; auto cmdQ = clUniquePtr(new MockCommandQueueHw(bcsMockContext.get(), device.get(), nullptr)); - auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); - auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); + auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); cmdQ->enqueueSVMMemcpy(false, pDstSVM, pSrcSVM, 256, 0, nullptr, nullptr); @@ -1776,8 +1776,8 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSV auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver(); myMockCsr->gpgpuCsr = &gpgpuCsr; - auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); - auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}); + auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); + auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), 256, {}, {}); cmdQ->enqueueSVMMemcpy(false, pDstSVM, pSrcSVM, 256, 0, nullptr, nullptr); EXPECT_EQ(0u, myMockCsr->waitForTaskCountAndCleanAllocationListCalled); @@ -2174,7 +2174,7 @@ TEST_P(ValidHostPtr, failedAllocationInjection) { TEST_P(ValidHostPtr, SvmHostPtr) { const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo(); if (devInfo.svmCapabilities != 0) { - auto ptr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 64, {}); + auto ptr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 64, {}, {}); auto bufferSvm = Buffer::create(context.get(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 64, ptr, retVal); EXPECT_NE(nullptr, bufferSvm); diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index 70958faa6c..0b53baafa6 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -2141,24 +2141,30 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenGetReservedMemoryIsCalledManyTimes class MemoryManagerWithFailure : public MockMemoryManager { public: GraphicsAllocation *allocateGraphicsMemoryWithProperties(const AllocationProperties &properties) override { + recentlyPassedDeviceBitfield = properties.subDevicesBitfield; return nullptr; } }; TEST(MemoryManagerTest, whenMemoryManagerReturnsNullptrThenAllocateGlobalsSurfaceAlsoReturnsNullptr) { MockClDevice device{new MockDevice}; - std::unique_ptr memoryManager(new MemoryManagerWithFailure()); - device.injectMemoryManager(memoryManager.release()); + auto deviceBitfield = device.getDeviceBitfield(); + auto memoryManager = new MemoryManagerWithFailure(); + device.injectMemoryManager(memoryManager); WhiteBox linkerInput; linkerInput.traits.exportsGlobalConstants = true; linkerInput.traits.exportsGlobalVariables = true; + memoryManager->recentlyPassedDeviceBitfield = {}; GraphicsAllocation *allocation = allocateGlobalsSurface(nullptr, device.getDevice(), 1024, false, &linkerInput, nullptr); EXPECT_EQ(nullptr, allocation); + EXPECT_EQ(deviceBitfield, memoryManager->recentlyPassedDeviceBitfield); auto svmAllocsManager = std::make_unique(device.getMemoryManager()); + memoryManager->recentlyPassedDeviceBitfield = {}; allocation = allocateGlobalsSurface(svmAllocsManager.get(), device.getDevice(), 1024, false, &linkerInput, nullptr); EXPECT_EQ(nullptr, allocation); + EXPECT_EQ(deviceBitfield, memoryManager->recentlyPassedDeviceBitfield); } HWTEST_F(MemoryAllocatorTest, givenMemoryManagerWhenEnableHostPtrTrackingFlagIsSetTo0ThenHostPointerTrackingIsDisabled) { 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 6411e5d1d6..8615714d5c 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 @@ -53,7 +53,7 @@ using SVMMemoryAllocatorTest = Test>; using SVMLocalMemoryAllocatorTest = Test>; TEST_F(SVMMemoryAllocatorTest, whenCreateZeroSizedSVMAllocationThenReturnNullptr) { - auto ptr = svmManager->createSVMAlloc(0, 0, {}); + auto ptr = svmManager->createSVMAlloc(0, 0, {}, {}); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); EXPECT_EQ(ptr, nullptr); @@ -65,7 +65,7 @@ TEST_F(SVMMemoryAllocatorTest, whenRequestSVMAllocsThenReturnNonNullptr) { } TEST_F(SVMMemoryAllocatorTest, whenSVMAllocationIsFreedThenCannotBeGotAgain) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_NE(nullptr, ptr); auto svmData = svmManager->getSVMAlloc(ptr); ASSERT_NE(nullptr, svmData); @@ -83,7 +83,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSVMAllocationIsFreedThenCannotBeGotAgain) { } TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromReturnedPointerAreaThenReturnSameAllocation) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_NE(ptr, nullptr); auto svmData = svmManager->getSVMAlloc(ptr); ASSERT_NE(nullptr, svmData); @@ -102,7 +102,7 @@ TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromReturnedPointerAreaThenRe } TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerAreaThenDontReturnThisAllocation) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_NE(ptr, nullptr); auto svmData = svmManager->getSVMAlloc(ptr); ASSERT_NE(nullptr, svmData); @@ -123,7 +123,7 @@ TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerA TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) { FailMemoryManager failMemoryManager(executionEnvironment); svmManager->memoryManager = &failMemoryManager; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); svmManager->freeSVMAlloc(ptr); @@ -144,7 +144,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif TEST_F(SVMMemoryAllocatorTest, given64kbAllowedWhenAllocatingSvmMemoryThenDontPreferRenderCompression) { MockMemoryManager memoryManager64Kb(true, false, executionEnvironment); svmManager->memoryManager = &memoryManager64Kb; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_FALSE(memoryManager64Kb.preferRenderCompressedFlagPassed); svmManager->freeSVMAlloc(ptr); } @@ -152,13 +152,13 @@ TEST_F(SVMMemoryAllocatorTest, given64kbAllowedWhenAllocatingSvmMemoryThenDontPr TEST_F(SVMMemoryAllocatorTest, given64kbAllowedwhenAllocatingSvmMemoryThenAllocationIsIn64kbPagePool) { MockMemoryManager memoryManager64Kb(true, false, executionEnvironment); svmManager->memoryManager = &memoryManager64Kb; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(MemoryPool::System64KBPages, svmManager->getSVMAlloc(ptr)->gpuAllocation->getMemoryPool()); svmManager->freeSVMAlloc(ptr); } TEST_F(SVMMemoryAllocatorTest, given64kbDisallowedWhenAllocatingSvmMemoryThenAllocationIsIn4kbPagePool) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(MemoryPool::System4KBPages, svmManager->getSVMAlloc(ptr)->gpuAllocation->getMemoryPool()); svmManager->freeSVMAlloc(ptr); } @@ -166,7 +166,7 @@ TEST_F(SVMMemoryAllocatorTest, given64kbDisallowedWhenAllocatingSvmMemoryThenAll TEST_F(SVMMemoryAllocatorTest, whenCoherentFlagIsPassedThenAllocationIsCoherent) { SVMAllocsManager::SvmAllocationProperties svmProperties; svmProperties.coherent = true; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, svmProperties); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, svmProperties, {}); EXPECT_TRUE(svmManager->getSVMAlloc(ptr)->gpuAllocation->isCoherent()); svmManager->freeSVMAlloc(ptr); } @@ -389,7 +389,7 @@ TEST(SvmAllocationPropertiesTests, givenDifferentMemFlagsWhenGettingSvmAllocatio TEST_F(SVMMemoryAllocatorTest, whenReadOnlySvmAllocationCreatedThenGraphicsAllocationHasWriteableFlagFalse) { SVMAllocsManager::SvmAllocationProperties svmProperties; svmProperties.readOnly = true; - void *svm = svmManager->createSVMAlloc(0, 4096, svmProperties); + void *svm = svmManager->createSVMAlloc(0, 4096, svmProperties, {}); EXPECT_NE(nullptr, svm); auto svmData = svmManager->getSVMAlloc(svm); @@ -402,7 +402,7 @@ TEST_F(SVMMemoryAllocatorTest, whenReadOnlySvmAllocationCreatedThenGraphicsAlloc } TEST_F(SVMLocalMemoryAllocatorTest, whenAllocatingSvmThenExpectCpuAllocationWithPointerAndGpuAllocationWithSameGpuAddress) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_NE(ptr, nullptr); auto svmData = svmManager->getSVMAlloc(ptr); ASSERT_NE(nullptr, svmData); @@ -418,7 +418,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenAllocatingSvmThenExpectCpuAllocationWith } TEST_F(SVMLocalMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerAreaThenDontReturnThisAllocation) { - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_NE(ptr, nullptr); auto svmData = svmManager->getSVMAlloc(ptr); ASSERT_NE(nullptr, svmData); @@ -439,7 +439,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPoi TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateCpuAllocationInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) { FailMemoryManager failMemoryManager(false, true, executionEnvironment); svmManager->memoryManager = &failMemoryManager; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); svmManager->freeSVMAlloc(ptr); @@ -448,7 +448,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateCpuAllocationInMemoryMan TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateGpuAllocationInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) { FailMemoryManager failMemoryManager(1, executionEnvironment, true); svmManager->memoryManager = &failMemoryManager; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); svmManager->freeSVMAlloc(ptr); @@ -456,7 +456,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateGpuAllocationInMemoryMan TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotReserveCpuAddressRangeInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) { memoryManager->failReserveAddress = true; - auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}); + auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {}, {}); EXPECT_EQ(nullptr, ptr); EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs()); } diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index e99f951b59..4289545f3c 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -90,15 +90,17 @@ void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &co SVMAllocsManager::SVMAllocsManager(MemoryManager *memoryManager) : memoryManager(memoryManager) { } -void *SVMAllocsManager::createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties) { +void *SVMAllocsManager::createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties, const DeviceBitfield &deviceBitfield) { if (size == 0) return nullptr; std::unique_lock lock(mtx); if (!memoryManager->isLocalMemorySupported(rootDeviceIndex)) { - return createZeroCopySvmAllocation(rootDeviceIndex, size, svmProperties); + return createZeroCopySvmAllocation(rootDeviceIndex, size, svmProperties, deviceBitfield); } else { - return createUnifiedAllocationWithDeviceStorage(rootDeviceIndex, size, svmProperties, {}); + UnifiedMemoryProperties unifiedMemoryProperties{}; + unifiedMemoryProperties.subdeviceBitfield = deviceBitfield; + return createUnifiedAllocationWithDeviceStorage(rootDeviceIndex, size, svmProperties, unifiedMemoryProperties); } } @@ -196,8 +198,13 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr, bool blocking) { return false; } -void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties) { - AllocationProperties properties{rootDeviceIndex, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY}; +void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties, const DeviceBitfield &deviceBitfield) { + AllocationProperties properties{rootDeviceIndex, + true, // allocateMemory + size, + GraphicsAllocation::AllocationType::SVM_ZERO_COPY, + false, // isMultiStorageAllocation + deviceBitfield}; MemoryPropertiesParser::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false); GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties); if (!allocation) { diff --git a/shared/source/memory_manager/unified_memory_manager.h b/shared/source/memory_manager/unified_memory_manager.h index d334579a67..46db99e29f 100644 --- a/shared/source/memory_manager/unified_memory_manager.h +++ b/shared/source/memory_manager/unified_memory_manager.h @@ -82,7 +82,7 @@ class SVMAllocsManager { }; SVMAllocsManager(MemoryManager *memoryManager); - void *createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties); + void *createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties, const DeviceBitfield &deviceBitfield); void *createUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &svmProperties); void *createSharedUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &svmProperties, void *cmdQ); SvmAllocationData *getSVMAlloc(const void *ptr); @@ -100,7 +100,7 @@ class SVMAllocsManager { void freeSvmAllocationWithDeviceStorage(SvmAllocationData *svmData); protected: - void *createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties); + void *createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties, const DeviceBitfield &deviceBitfield); void freeZeroCopySvmAllocation(SvmAllocationData *svmData); diff --git a/shared/source/program/program_initialization.cpp b/shared/source/program/program_initialization.cpp index 4b0d581180..08ab8dd509 100644 --- a/shared/source/program/program_initialization.cpp +++ b/shared/source/program/program_initialization.cpp @@ -28,7 +28,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc svmProps.coherent = false; svmProps.readOnly = constant; svmProps.hostPtrReadOnly = constant; - auto ptr = svmAllocManager->createSVMAlloc(device.getRootDeviceIndex(), size, svmProps); + auto ptr = svmAllocManager->createSVMAlloc(device.getRootDeviceIndex(), size, svmProps, device.getDeviceBitfield()); DEBUG_BREAK_IF(ptr == nullptr); if (ptr == nullptr) { return nullptr;