Revert "Correct IMAGE1D_BUFFER width size calculation in BCS"

This reverts commit 3490b489ad.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-03-12 19:32:44 +01:00
committed by Compute-Runtime-Automation
parent c8e60ce3ba
commit 4f31b569e4
2 changed files with 38 additions and 52 deletions

View File

@ -84,7 +84,7 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
expectedSize = alignUp(expectedSize, MemoryConstants::cacheLineSize);
BlitProperties blitProperties{};
BlitProperties blitProperties;
blitProperties.copySize = {bltSize, 1, 1};
BlitPropertiesContainer blitPropertiesContainer;
blitPropertiesContainer.push_back(blitProperties);
@ -1443,18 +1443,20 @@ HWTEST_F(BcsTestsImages, givenImage1DWhenAdjustBlitPropertiesForImageIsCalledThe
imgDesc.image_height = 0u;
imgDesc.image_depth = 0u;
std::unique_ptr<Image> image(Image1dHelper<>::create(context.get(), &imgDesc));
Vec3<size_t> size{0, 0, 0};
size_t bytesPerPixel = 0u;
size_t expectedBytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
size_t expectedRowPitch = image->getImageDesc().image_row_pitch;
size_t expectedSlicePitch = image->getImageDesc().image_slice_pitch;
BlitProperties blitProperties{};
blitProperties.dstGpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, false);
uint64_t gpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
EXPECT_EQ(imgDesc.image_width, blitProperties.dstSize.x);
EXPECT_EQ(1u, blitProperties.dstSize.y);
EXPECT_EQ(1u, blitProperties.dstSize.z);
EXPECT_EQ(expectedBytesPerPixel, blitProperties.bytesPerPixel);
EXPECT_EQ(imgDesc.image_width, size.x);
EXPECT_EQ(1u, size.y);
EXPECT_EQ(1u, size.z);
EXPECT_EQ(expectedBytesPerPixel, bytesPerPixel);
EXPECT_EQ(expectedRowPitch, rowPitch);
EXPECT_EQ(expectedSlicePitch, slicePitch);
}
@ -1467,28 +1469,15 @@ HWTEST_F(BcsTestsImages, givenImage1DBufferWhenAdjustBlitPropertiesForImageIsCal
cl_image_desc imgDesc = Image1dBufferDefaults::imageDesc;
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
cl_image_format imgFormat{};
imgFormat.image_channel_order = CL_RGBA;
imgFormat.image_channel_data_type = CL_UNSIGNED_INT8;
std::unique_ptr<Image> image(Image1dHelper<>::create(context.get(), &imgDesc, &imgFormat));
size_t expectedBytesPerPixel = 4;
BlitProperties blitProperties{};
blitProperties.srcGpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
std::unique_ptr<Image> image(Image1dHelper<>::create(context.get(), &imgDesc));
Vec3<size_t> size{0, 0, 0};
size_t bytesPerPixel = 0u;
uint64_t gpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
for (auto &[blitDirection, expectedBlitDirection] : testParams) {
blitProperties.blitDirection = blitDirection;
blitProperties.copySize = {1, 1, 1};
blitProperties.srcSize = {imgDesc.image_width, imgDesc.image_height, imgDesc.image_depth};
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, true);
EXPECT_EQ(expectedBlitDirection, blitProperties.blitDirection);
EXPECT_EQ(expectedBytesPerPixel, blitProperties.bytesPerPixel);
EXPECT_EQ(imgDesc.image_width, blitProperties.srcSize.x / blitProperties.bytesPerPixel);
EXPECT_EQ(imgDesc.image_height, blitProperties.srcSize.y);
EXPECT_EQ(imgDesc.image_depth, blitProperties.srcSize.z);
EXPECT_EQ(1u, blitProperties.copySize.x / blitProperties.bytesPerPixel);
EXPECT_EQ(1u, blitProperties.copySize.y);
EXPECT_EQ(1u, blitProperties.copySize.z);
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
EXPECT_EQ(expectedBlitDirection, blitDirection);
}
}
@ -1501,18 +1490,20 @@ HWTEST_F(BcsTestsImages, givenImage2DArrayWhenAdjustBlitPropertiesForImageIsCall
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
std::unique_ptr<Image> image(Image2dArrayHelper<>::create(context.get(), &imgDesc));
Vec3<size_t> size{0, 0, 0};
size_t bytesPerPixel = 0u;
size_t expectedBytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
size_t expectedRowPitch = image->getImageDesc().image_row_pitch;
size_t expectedSlicePitch = image->getImageDesc().image_slice_pitch;
BlitProperties blitProperties{};
blitProperties.dstGpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, false);
uint64_t gpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
EXPECT_EQ(imgDesc.image_width, blitProperties.dstSize.x);
EXPECT_EQ(imgDesc.image_height, blitProperties.dstSize.y);
EXPECT_EQ(imgDesc.image_array_size, blitProperties.dstSize.z);
EXPECT_EQ(expectedBytesPerPixel, blitProperties.bytesPerPixel);
EXPECT_EQ(imgDesc.image_width, size.x);
EXPECT_EQ(imgDesc.image_height, size.y);
EXPECT_EQ(imgDesc.image_array_size, size.z);
EXPECT_EQ(expectedBytesPerPixel, bytesPerPixel);
EXPECT_EQ(expectedRowPitch, rowPitch);
EXPECT_EQ(expectedSlicePitch, slicePitch);
}
@ -1520,16 +1511,18 @@ HWTEST_F(BcsTestsImages, givenImage2DArrayWhenAdjustBlitPropertiesForImageIsCall
HWTEST_F(BcsTestsImages, givenImageWithSurfaceOffsetWhenAdjustBlitPropertiesForImageIsCalledThenGpuAddressIsCorrect) {
cl_image_desc imgDesc = Image1dDefaults::imageDesc;
std::unique_ptr<Image> image(Image2dArrayHelper<>::create(context.get(), &imgDesc));
Vec3<size_t> size{0, 0, 0};
size_t bytesPerPixel = 0u;
BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
uint64_t surfaceOffset = 0x01000;
image->setSurfaceOffsets(surfaceOffset, 0, 0, 0);
BlitProperties blitProperties{};
blitProperties.dstGpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
uint64_t expectedGpuAddress = blitProperties.dstGpuAddress + surfaceOffset;
uint64_t gpuAddress = image->getGraphicsAllocation(0)->getGpuAddress();
uint64_t expectedGpuAddress = gpuAddress + surfaceOffset;
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, false);
ClBlitProperties::adjustBlitPropertiesForImage(image.get(), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
EXPECT_EQ(blitProperties.dstGpuAddress, expectedGpuAddress);
EXPECT_EQ(gpuAddress, expectedGpuAddress);
}
HWTEST_F(BcsTests, givenHostPtrToImageWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {