fix OCL: don't set multi storage resource for system memory images

Related-To: NEO-5735
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-02-16 11:39:24 +00:00
committed by Compute-Runtime-Automation
parent 3072b8f4d2
commit 4a2e7d6530
3 changed files with 16 additions and 6 deletions

View File

@@ -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);

View File

@@ -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<MockMemoryManager *>(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<MultiGraphicsAllocation &>(pBuffer->getMultiGraphicsAllocation()).setMultiStorage(true);
EXPECT_TRUE(pBuffer->getMultiGraphicsAllocation().requiresMigrations());
auto pImage = Image2dHelper<>::create(&context, &imageDesc);
EXPECT_TRUE(pImage->getMultiGraphicsAllocation().requiresMigrations());

View File

@@ -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<MockMemoryManager *>(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());
}
}
}