diff --git a/opencl/source/mem_obj/image.cpp b/opencl/source/mem_obj/image.cpp index 65bb43770d..d246b436dd 100644 --- a/opencl/source/mem_obj/image.cpp +++ b/opencl/source/mem_obj/image.cpp @@ -248,7 +248,9 @@ Image *Image::create(Context *context, multiGraphicsAllocation.addAllocation(allocationInfo.memory); } - multiGraphicsAllocation.setMultiStorage(context->getRootDeviceIndices().size() > 1); + if (context->getRootDeviceIndices().size() > 1) { + multiGraphicsAllocation.setMultiStorage(!MemoryPoolHelper::isSystemMemoryPool(allocationInfos[defaultRootDeviceIndex].memory->getMemoryPool())); + } Image *image = createImageHw(context, memoryProperties, flags, flagsIntel, imgInfo.size, hostPtrToSet, surfaceFormat->OCLImageFormat, imageDescriptor, allocationInfos[defaultRootDeviceIndex].zeroCopyAllowed, std::move(multiGraphicsAllocation), false, 0, 0, surfaceFormat); diff --git a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp index 5e557f4f01..4834ab143a 100644 --- a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp @@ -483,10 +483,15 @@ HWTEST_F(EnqueueReadImageTest, givenMultiRootDeviceImageWhenEnqueueReadImageIsCa pImage->release(); } -HWTEST_F(EnqueueReadImageTest, givenImageFromBufferThatRequiresMigrationWhenEnqueueReadImageThenBufferObjectIsTakenForMigration) { +HWTEST2_F(EnqueueReadImageTest, givenImageFromBufferThatRequiresMigrationWhenEnqueueReadImageThenBufferObjectIsTakenForMigration, IsAtLeastGen12lp) { MockDefaultContext context{true}; + auto memoryManager = static_cast(context.getMemoryManager()); + for (auto &rootDeviceIndex : context.getRootDeviceIndices()) { + memoryManager->localMemorySupported[rootDeviceIndex] = true; + } + auto pCmdQ1 = createCommandQueue(context.getDevice(0), nullptr, &context); auto pBuffer = BufferHelper<>::create(&context); @@ -495,8 +500,6 @@ HWTEST_F(EnqueueReadImageTest, givenImageFromBufferThatRequiresMigrationWhenEnqu cl_mem clBuffer = pBuffer; imageDesc.mem_object = clBuffer; - const_cast(pBuffer->getMultiGraphicsAllocation()).setMultiStorage(true); - EXPECT_TRUE(pBuffer->getMultiGraphicsAllocation().requiresMigrations()); auto pImage = Image2dHelper<>::create(&context, &imageDesc); EXPECT_TRUE(pImage->getMultiGraphicsAllocation().requiresMigrations()); diff --git a/opencl/test/unit_test/mem_obj/image_tests.cpp b/opencl/test/unit_test/mem_obj/image_tests.cpp index c632495ec9..a2d0885e66 100644 --- a/opencl/test/unit_test/mem_obj/image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests.cpp @@ -1802,7 +1802,8 @@ TEST(ImageTest, givenMultiDeviceEnvironmentWhenReleaseImageFromBufferThenMainBuf buffer->release(); } -TEST(ImageTest, givenHostPtrToCopyWhenImageIsCreatedWithMultiStorageThenMemoryIsPutInFirstDeviceInContext) { +using MultiRootDeviceImageTest = ::testing::Test; +HWTEST2_F(MultiRootDeviceImageTest, givenHostPtrToCopyWhenImageIsCreatedWithMultiStorageThenMemoryIsPutInFirstDeviceInContext, IsAtLeastGen12lp) { REQUIRE_IMAGES_OR_SKIP(defaultHwInfo); cl_int retVal = 0; @@ -1819,6 +1820,10 @@ TEST(ImageTest, givenHostPtrToCopyWhenImageIsCreatedWithMultiStorageThenMemoryIs imageFormat.image_channel_order = CL_R; UltClDeviceFactory deviceFactory{2, 0}; + auto memoryManager = static_cast(deviceFactory.rootDevices[0]->getMemoryManager()); + for (auto &rootDeviceIndex : {0, 1}) { + memoryManager->localMemorySupported[rootDeviceIndex] = true; + } { cl_device_id deviceIds[] = { deviceFactory.rootDevices[0], @@ -1857,4 +1862,4 @@ TEST(ImageTest, givenHostPtrToCopyWhenImageIsCreatedWithMultiStorageThenMemoryIs EXPECT_EQ(2u, context.getRootDeviceIndices().size()); EXPECT_EQ(1u, image->getMultiGraphicsAllocation().getMigrationSyncData()->getCurrentLocation()); } -} \ No newline at end of file +}