From c5e1fcf313ea29c618e675222890494de0a3043d Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Fri, 7 Mar 2025 15:32:42 +0000 Subject: [PATCH] fix: Copy tiled 1D array per array element with BLT Related-To: NEO-14147, HSD-14024424096, HSD-14024424178 Signed-off-by: Maciej Plewka --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 2 + .../sources/cmdlist/test_cmdlist_blit.cpp | 79 +++++++++- opencl/source/helpers/cl_blit_properties.h | 2 + .../command_stream_receiver_hw_2_tests.cpp | 57 +++++++ shared/source/helpers/blit_properties.cpp | 40 +++++ shared/source/helpers/blit_properties.h | 9 +- .../unit_test/blit_properties/CMakeLists.txt | 12 ++ .../blitter_properties_tests.cpp | 146 ++++++++++++++++++ 8 files changed, 344 insertions(+), 3 deletions(-) create mode 100644 shared/test/unit_test/blit_properties/CMakeLists.txt create mode 100644 shared/test/unit_test/blit_properties/blitter_properties_tests.cpp diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 6a18cd2dfd..2bd3fa2863 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1459,6 +1459,8 @@ ze_result_t CommandListCoreFamily::appendCopyImageBlit(NEO::Graph commandContainer.addToResidencyContainer(clearColorAllocation); appendEventForProfiling(signalEvent, nullptr, true, false, false, true); + blitProperties.transform1DArrayTo2DArrayIfNeeded(); + NEO::BlitCommandsHelper::dispatchBlitCommandsForImageRegion(blitProperties, *commandContainer.getCommandStream(), *dummyBlitWa.rootDeviceEnvironment); dummyBlitWa.isWaRequired = true; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp index da89960224..719c89b71c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,9 @@ #include "shared/source/helpers/register_offsets.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/mocks/mock_device.h" +#include "shared/test/common/mocks/mock_gmm.h" +#include "shared/test/common/mocks/mock_gmm_client_context.h" +#include "shared/test/common/mocks/mock_gmm_resource_info.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/test_macros/hw_test.h" @@ -352,5 +355,79 @@ HWTEST2_F(AppendMemoryCopyFromContext, givenCommandListThenUpOnPerformingAppendM EXPECT_EQ(ZE_RESULT_SUCCESS, result); } +struct IsAtLeastXeHpCoreAndNotXe2HpgCoreWith2DArrayImageSupport { + template + static constexpr bool isMatched() { + return IsAtLeastGfxCore::isMatched() && !IsXe2HpgCore::isMatched() && NEO::HwMapper::GfxProduct::supportsSampler; + } +}; +HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenTiled1DArrayImagePassedToImageCopyBlitThenTransformedTo2DArrayCopy, IsAtLeastXeHpCoreAndNotXe2HpgCoreWith2DArrayImageSupport) { + using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT; + auto commandList = std::make_unique>>(); + commandList->initialize(device, NEO::EngineGroupType::copy, 0u); + + auto gmmSrc = std::make_unique(device->getNEODevice()->getGmmHelper()); + auto resourceInfoSrc = static_cast(gmmSrc->gmmResourceInfo.get()); + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + + NEO::MockGraphicsAllocation mockAllocationSrc(0, 1u /*num gmms*/, NEO::AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, 1u /*num gmms*/, NEO::AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + + mockAllocationSrc.setGmm(gmmSrc.get(), 0); + mockAllocationDst.setGmm(gmmSrc.get(), 0); + + size_t arrayLevels = 8; + size_t depth = 1; + commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 4, 4, 4, 4, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr); + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); + auto itor = find(cmdList.begin(), cmdList.end()); + EXPECT_NE(cmdList.end(), itor); + auto cmd = genCmdCast(*itor); + EXPECT_EQ(cmd->getSourceSurfaceDepth(), arrayLevels); + EXPECT_EQ(cmd->getSourceSurfaceHeight(), depth); +} + +HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenNotTiled1DArrayImagePassedToImageCopyBlitThenNotTransformedTo2DArrayCopy, IsAtLeastXeHpCoreAndNotXe2HpgCoreWith2DArrayImageSupport) { + using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT; + auto commandList = std::make_unique>>(); + commandList->initialize(device, NEO::EngineGroupType::copy, 0u); + + auto gmmSrc = std::make_unique(device->getNEODevice()->getGmmHelper()); + auto resourceInfoSrc = static_cast(gmmSrc->gmmResourceInfo.get()); + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 0; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + + NEO::MockGraphicsAllocation mockAllocationSrc(0, 1u /*num gmms*/, NEO::AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, 1u /*num gmms*/, NEO::AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + + mockAllocationSrc.setGmm(gmmSrc.get(), 0); + mockAllocationDst.setGmm(gmmSrc.get(), 0); + + size_t arrayLevels = 8; + size_t depth = 1; + commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr); + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); + auto itor = find(cmdList.begin(), cmdList.end()); + EXPECT_NE(cmdList.end(), itor); + auto cmd = genCmdCast(*itor); + EXPECT_EQ(cmd->getSourceSurfaceDepth(), depth); + EXPECT_EQ(cmd->getSourceSurfaceHeight(), arrayLevels); +} + } // namespace ult } // namespace L0 diff --git a/opencl/source/helpers/cl_blit_properties.h b/opencl/source/helpers/cl_blit_properties.h index 323ecc6811..c22ef077d5 100644 --- a/opencl/source/helpers/cl_blit_properties.h +++ b/opencl/source/helpers/cl_blit_properties.h @@ -56,6 +56,7 @@ struct ClBlitProperties { blitProperties.blitDirection = blitDirection; setBlitPropertiesForImage(blitProperties, builtinOpParams); } + blitProperties.transform1DArrayTo2DArrayIfNeeded(); return blitProperties; } @@ -142,6 +143,7 @@ struct ClBlitProperties { setBlitPropertiesForImage(blitProperties, builtinOpParams); } + blitProperties.transform1DArrayTo2DArrayIfNeeded(); return blitProperties; } diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index 97a3b1b645..51e3f3574a 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -20,6 +20,9 @@ #include "shared/test/common/mocks/mock_allocation_properties.h" #include "shared/test/common/mocks/mock_direct_submission_hw.h" #include "shared/test/common/mocks/mock_gfx_core_helper.h" +#include "shared/test/common/mocks/mock_gmm.h" +#include "shared/test/common/mocks/mock_gmm_client_context.h" +#include "shared/test/common/mocks/mock_gmm_resource_info.h" #include "shared/test/common/mocks/mock_internal_allocation_storage.h" #include "shared/test/common/mocks/mock_memory_manager.h" #include "shared/test/common/mocks/mock_timestamp_container.h" @@ -2201,3 +2204,57 @@ HWTEST_F(BcsTests, givenHostPtrToImageWhenBlitBufferIsCalledThenBlitCmdIsFound) auto cmdIterator = find(hwParser.cmdList.begin(), hwParser.cmdList.end()); EXPECT_NE(hwParser.cmdList.end(), cmdIterator); } +HWTEST_F(BcsTests, given1DTiledArrayImageWhenConstructPropertiesThenImageTransformedTo2DArray) { + if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) { + GTEST_SKIP(); + } + + auto gmmSrc = std::make_unique(pDevice->getGmmHelper()); + auto resourceInfoSrc = static_cast(gmmSrc->gmmResourceInfo.get()); + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + + std::unique_ptr image(Image2dHelper<>::create(context.get())); + auto oldGmm = std::unique_ptr(image->getGraphicsAllocation(pDevice->getRootDeviceIndex())->getDefaultGmm()); + image->getGraphicsAllocation(pDevice->getRootDeviceIndex())->setGmm(gmmSrc.release(), 0); + BuiltinOpParams builtinOpParams{}; + builtinOpParams.srcMemObj = image.get(); + builtinOpParams.dstMemObj = image.get(); + builtinOpParams.size = {1, 8, 1}; + + auto &csr = pDevice->getUltCommandStreamReceiver(); + csr.getCmdSizeForComputeMode(); + auto blitProperties = ClBlitProperties::constructProperties(BlitterConstants::BlitDirection::imageToImage, + csr, + builtinOpParams); + EXPECT_EQ(blitProperties.copySize.z, builtinOpParams.size.y); + EXPECT_EQ(blitProperties.copySize.y, builtinOpParams.size.z); +} +HWTEST_F(BcsTests, given1DNotTiledArrayImageWhenConstructPropertiesThenImageNotTransformedTo2DArray) { + if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) { + GTEST_SKIP(); + } + + auto gmmSrc = std::make_unique(pDevice->getGmmHelper()); + auto resourceInfoSrc = static_cast(gmmSrc->gmmResourceInfo.get()); + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 0; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + + std::unique_ptr image(Image2dHelper<>::create(context.get())); + auto oldGmm = std::unique_ptr(image->getGraphicsAllocation(pDevice->getRootDeviceIndex())->getDefaultGmm()); + image->getGraphicsAllocation(pDevice->getRootDeviceIndex())->setGmm(gmmSrc.release(), 0); + BuiltinOpParams builtinOpParams{}; + builtinOpParams.srcMemObj = image.get(); + builtinOpParams.dstMemObj = image.get(); + builtinOpParams.size = {1, 8, 1}; + + auto &csr = pDevice->getUltCommandStreamReceiver(); + csr.getCmdSizeForComputeMode(); + auto blitProperties = ClBlitProperties::constructProperties(BlitterConstants::BlitDirection::imageToImage, + csr, + builtinOpParams); + EXPECT_EQ(blitProperties.copySize.y, builtinOpParams.size.y); + EXPECT_EQ(blitProperties.copySize.z, builtinOpParams.size.z); +} \ No newline at end of file diff --git a/shared/source/helpers/blit_properties.cpp b/shared/source/helpers/blit_properties.cpp index f701247c37..bbdb82ae12 100644 --- a/shared/source/helpers/blit_properties.cpp +++ b/shared/source/helpers/blit_properties.cpp @@ -8,6 +8,8 @@ #include "shared/source/helpers/blit_properties.h" #include "shared/source/command_stream/command_stream_receiver.h" +#include "shared/source/gmm_helper/gmm.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/memory_manager/surface.h" @@ -179,5 +181,43 @@ bool BlitProperties::isImageOperation() const { blitDirection == BlitterConstants::BlitDirection::imageToHostPtr || blitDirection == BlitterConstants::BlitDirection::imageToImage; } +bool BlitProperties::isSrc1DTiledArray() const { + if (srcAllocation->getDefaultGmm()) { + return is1DTiledArray(srcAllocation->getDefaultGmm()->gmmResourceInfo.get()); + } + return false; +} +bool BlitProperties::isDst1DTiledArray() const { + if (dstAllocation->getDefaultGmm()) { + return is1DTiledArray(dstAllocation->getDefaultGmm()->gmmResourceInfo.get()); + } + return false; +} +bool BlitProperties::is1DTiledArray(GmmResourceInfo *resInfo) const { + auto resourceType = resInfo->getResourceType(); + auto isArray = resInfo->getArraySize() > 1; + auto isTiled = resInfo->getResourceFlags()->Info.Tile4 || resInfo->getResourceFlags()->Info.Tile64; + if (resourceType == GMM_RESOURCE_TYPE::RESOURCE_1D && isTiled && isArray) { + return true; + } + return false; +} +void BlitProperties::transform1DArrayTo2DArrayIfNeeded() { + if (this->isSrc1DTiledArray() || this->isDst1DTiledArray()) { + this->srcSize.z = this->srcSize.y; + this->srcSize.y = 1; + this->dstSize.z = this->dstSize.y; + this->dstSize.y = 1; + + this->srcOffset.z = this->srcOffset.y; + this->srcOffset.y = 0; + + this->dstOffset.z = this->dstOffset.y; + this->dstOffset.y = 0; + + this->copySize.z = this->copySize.y; + this->copySize.y = 1; + } +} } // namespace NEO \ No newline at end of file diff --git a/shared/source/helpers/blit_properties.h b/shared/source/helpers/blit_properties.h index 7b1b34a35c..6a19c94414 100644 --- a/shared/source/helpers/blit_properties.h +++ b/shared/source/helpers/blit_properties.h @@ -21,6 +21,7 @@ class TagNodeBase; class TimestampPacketContainer; class GraphicsAllocation; class CommandStreamReceiver; +class GmmResourceInfo; enum class BlitSyncMode { none = 0, @@ -66,6 +67,12 @@ struct BlitProperties { TimestampPacketContainer &kernelTimestamps, const CsrDependencies &depsFromEvents, CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr); + bool isImageOperation() const; + bool isSrc1DTiledArray() const; + bool isDst1DTiledArray() const; + bool is1DTiledArray(GmmResourceInfo *resInfo) const; + void transform1DArrayTo2DArrayIfNeeded(); + BlitSyncProperties blitSyncProperties = {}; CsrDependencies csrDependencies; TagNodeBase *multiRootDeviceEventSync = nullptr; @@ -95,8 +102,6 @@ struct BlitProperties { GMM_YUV_PLANE_ENUM dstPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE; GMM_YUV_PLANE_ENUM srcPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE; bool isSystemMemoryPoolUsed = false; - - bool isImageOperation() const; }; } // namespace NEO \ No newline at end of file diff --git a/shared/test/unit_test/blit_properties/CMakeLists.txt b/shared/test/unit_test/blit_properties/CMakeLists.txt new file mode 100644 index 0000000000..ef25f29c72 --- /dev/null +++ b/shared/test/unit_test/blit_properties/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Copyright (C) 2020-2025 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +target_sources(neo_shared_tests PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/blitter_properties_tests.cpp +) + +add_subdirectories() diff --git a/shared/test/unit_test/blit_properties/blitter_properties_tests.cpp b/shared/test/unit_test/blit_properties/blitter_properties_tests.cpp new file mode 100644 index 0000000000..d01185243f --- /dev/null +++ b/shared/test/unit_test/blit_properties/blitter_properties_tests.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/blit_properties.h" +#include "shared/test/common/fixtures/device_fixture.h" +#include "shared/test/common/mocks/mock_gmm.h" +#include "shared/test/common/mocks/mock_gmm_client_context.h" +#include "shared/test/common/mocks/mock_gmm_resource_info.h" +#include "shared/test/common/test_macros/test.h" + +#include "gtest/gtest.h" + +#include + +namespace NEO { +class BlitPropertiesTests : public Test { + public: + void SetUp() override { + Test::SetUp(); + gmmSrc = std::make_unique(pDevice->getGmmHelper()); + gmmDst = std::make_unique(pDevice->getGmmHelper()); + resourceInfoSrc = static_cast(gmmSrc->gmmResourceInfo.get()); + resourceInfoDst = static_cast(gmmSrc->gmmResourceInfo.get()); + mockAllocationSrc = std::make_unique(0, 1u /*num gmms*/, AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + mockAllocationDst = std::make_unique(0, 1u /*num gmms*/, AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + mockAllocationSrc->setGmm(gmmSrc.get(), 0); + mockAllocationDst->setGmm(gmmSrc.get(), 0); + blitProperties.srcAllocation = mockAllocationSrc.get(); + blitProperties.dstAllocation = mockAllocationDst.get(); + blitProperties.srcSize = size; + blitProperties.dstSize = size; + blitProperties.copySize = size; + blitProperties.srcOffset = size; + blitProperties.dstOffset = size; + + BlitProperties blitProperties; + } + void TearDown() override { + Test::TearDown(); + } + std::unique_ptr gmmSrc; + std::unique_ptr gmmDst; + std::unique_ptr mockAllocationSrc; + std::unique_ptr mockAllocationDst; + MockGmmResourceInfo *resourceInfoSrc; + MockGmmResourceInfo *resourceInfoDst; + BlitProperties blitProperties{}; + Vec3 size = {8, 8, 1}; +}; + +TEST_F(BlitPropertiesTests, givenBlitPropertiesWhenSrcIs1DTiledArrayThenTransformFrom1dArrayTo2DArray) { + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + blitProperties.transform1DArrayTo2DArrayIfNeeded(); + + EXPECT_EQ(blitProperties.srcSize.y, 1u); + EXPECT_EQ(blitProperties.srcSize.z, size.y); + + EXPECT_EQ(blitProperties.dstSize.y, 1u); + EXPECT_EQ(blitProperties.dstSize.z, size.y); + + EXPECT_EQ(blitProperties.copySize.y, 1u); + EXPECT_EQ(blitProperties.copySize.z, size.y); + + EXPECT_EQ(blitProperties.srcOffset.y, 0u); + EXPECT_EQ(blitProperties.srcOffset.z, size.y); + + EXPECT_EQ(blitProperties.dstOffset.y, 0u); + EXPECT_EQ(blitProperties.dstOffset.z, size.y); +} + +TEST_F(BlitPropertiesTests, givenBlitPropertiesWhenDstIs1DTiledArrayThenTransformFrom1dArrayTo2DArray) { + resourceInfoDst->getResourceFlags()->Info.Tile64 = 1; + resourceInfoDst->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoDst->mockResourceCreateParams.ArraySize = 8; + blitProperties.transform1DArrayTo2DArrayIfNeeded(); + + EXPECT_EQ(blitProperties.srcSize.y, 1u); + EXPECT_EQ(blitProperties.srcSize.z, size.y); + + EXPECT_EQ(blitProperties.dstSize.y, 1u); + EXPECT_EQ(blitProperties.dstSize.z, size.y); + + EXPECT_EQ(blitProperties.copySize.y, 1u); + EXPECT_EQ(blitProperties.copySize.z, size.y); + + EXPECT_EQ(blitProperties.srcOffset.y, 0u); + EXPECT_EQ(blitProperties.srcOffset.z, size.y); + + EXPECT_EQ(blitProperties.dstOffset.y, 0u); + EXPECT_EQ(blitProperties.dstOffset.z, size.y); +} +TEST_F(BlitPropertiesTests, givenBlitPropertiesWhenDstAndSrcIsNot1DTiledArrayThenSizeAndOffsetNotchanged) { + blitProperties.transform1DArrayTo2DArrayIfNeeded(); + + EXPECT_EQ(blitProperties.srcSize.y, size.y); + EXPECT_EQ(blitProperties.srcSize.z, size.z); + + EXPECT_EQ(blitProperties.dstSize.y, size.y); + EXPECT_EQ(blitProperties.dstSize.z, size.z); + + EXPECT_EQ(blitProperties.copySize.y, size.y); + EXPECT_EQ(blitProperties.copySize.z, size.z); + + EXPECT_EQ(blitProperties.srcOffset.y, size.y); + EXPECT_EQ(blitProperties.srcOffset.z, size.z); + + EXPECT_EQ(blitProperties.dstOffset.y, size.y); + EXPECT_EQ(blitProperties.dstOffset.z, size.z); +} + +TEST_F(BlitPropertiesTests, givenGmmResInfoForTiled1DArrayWhenIs1DTiledArrayCalledThenTrueReturned) { + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + EXPECT_TRUE(blitProperties.is1DTiledArray(resourceInfoSrc)); +} +TEST_F(BlitPropertiesTests, givenGmmResInfoForTiled2DArrayWhenIs1DTiledArrayCalledThenFalseReturned) { + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_2D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + EXPECT_FALSE(blitProperties.is1DTiledArray(resourceInfoSrc)); +} + +TEST_F(BlitPropertiesTests, givenGmmResInfoForNotTiled1DArrayWhenIs1DTiledArrayCalledThenFalseReturned) { + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 0; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 8; + EXPECT_FALSE(blitProperties.is1DTiledArray(resourceInfoSrc)); +} +TEST_F(BlitPropertiesTests, givenGmmResInfoForTiled1DWhenIs1DTiledArrayCalledThenFalseReturned) { + resourceInfoSrc->getResourceFlags()->Info.Tile64 = 1; + resourceInfoSrc->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D; + resourceInfoSrc->mockResourceCreateParams.ArraySize = 1; + EXPECT_FALSE(blitProperties.is1DTiledArray(resourceInfoSrc)); +} +} // namespace NEO