diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index ffae45d1d2..b50490a852 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1496,7 +1496,9 @@ ze_result_t CommandListCoreFamily::appendMemoryCopyBlitRegion(Ali const bool copyOnly = isCopyOnly(dualStreamCopyOffload); - if (copyOnly) { + if (useAdditionalBlitProperties) { + setAdditionalBlitProperties(blitProperties, signalEvent); + } else if (copyOnly) { appendEventForProfiling(signalEvent, nullptr, true, false, false, true); } auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironmentRef(); @@ -1508,7 +1510,7 @@ ze_result_t CommandListCoreFamily::appendMemoryCopyBlitRegion(Ali } dummyBlitWa.isWaRequired = true; - if (copyOnly) { + if (!useAdditionalBlitProperties && copyOnly) { appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true); } return ZE_RESULT_SUCCESS; @@ -1541,14 +1543,19 @@ ze_result_t CommandListCoreFamily::appendCopyImageBlit(NEO::Graph commandContainer.addToResidencyContainer(src); commandContainer.addToResidencyContainer(clearColorAllocation); - appendEventForProfiling(signalEvent, nullptr, true, false, false, true); + if (useAdditionalBlitProperties) { + setAdditionalBlitProperties(blitProperties, signalEvent); + } else { + appendEventForProfiling(signalEvent, nullptr, true, false, false, true); + } blitProperties.transform1DArrayTo2DArrayIfNeeded(); NEO::BlitCommandsHelper::dispatchBlitCommandsForImageRegion(blitProperties, *commandContainer.getCommandStream(), *dummyBlitWa.rootDeviceEnvironment); dummyBlitWa.isWaRequired = true; - appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true); - + if (!useAdditionalBlitProperties) { + appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true); + } if (this->isInOrderExecutionEnabled()) { appendSignalInOrderDependencyCounter(signalEvent, false, false, false); } @@ -1831,7 +1838,6 @@ ze_result_t CommandListCoreFamily::appendMemoryCopy(void *dstptr, } else { handleInOrderDependencyCounter(signalEvent, false, isCopyOnlyEnabled); } - appendSynchronizedDispatchCleanupSection(); if (NEO::debugManager.flags.EnableSWTags.get()) { @@ -2439,7 +2445,9 @@ ze_result_t CommandListCoreFamily::appendBlitFill(void *ptr, } auto neoDevice = device->getNEODevice(); - appendEventForProfiling(signalEvent, nullptr, true, false, false, true); + if (!useAdditionalBlitProperties) { + appendEventForProfiling(signalEvent, nullptr, true, false, false, true); + } NEO::GraphicsAllocation *gpuAllocation = device->getDriverHandle()->getDriverSystemMemoryAllocation(ptr, size, neoDevice->getRootDeviceIndex(), @@ -2463,12 +2471,16 @@ ze_result_t CommandListCoreFamily::appendBlitFill(void *ptr, memcpy_s(&patternToCommand, sizeof(patternToCommand), pattern, patternSize); auto blitProperties = NEO::BlitProperties::constructPropertiesForMemoryFill(gpuAllocation, size, patternToCommand, patternSize, offset); + if (useAdditionalBlitProperties) { + setAdditionalBlitProperties(blitProperties, signalEvent); + } blitProperties.computeStreamPartitionCount = this->partitionCount; NEO::BlitCommandsHelper::dispatchBlitMemoryColorFill(blitProperties, *commandContainer.getCommandStream(), neoDevice->getRootDeviceEnvironmentRef()); dummyBlitWa.isWaRequired = true; - - appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true); + if (!useAdditionalBlitProperties) { + appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true); + } if (isInOrderExecutionEnabled()) { appendSignalInOrderDependencyCounter(signalEvent, false, false, false); 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 e45e52ad2f..a34c0c5016 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 @@ -496,5 +496,59 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled); } +HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPropertiesWhenCallingAppendMemoryCopyImageBlitThenAdditionalBlitPropertiesCalled) { + auto commandList = std::make_unique>(); + commandList->initialize(device, NEO::EngineGroupType::copy, 0u); + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + ze_result_t result = ZE_RESULT_SUCCESS; + auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result)); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); + + 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); + + commandList->useAdditionalBlitProperties = false; + EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled); + commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get()); + EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled); + + commandList->useAdditionalBlitProperties = true; + commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get()); + EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled); +} + +HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPropertiesWhenCallingAppendMemoryCopyRegionThenAdditionalBlitPropertiesCalled) { + auto commandList = std::make_unique>(); + commandList->initialize(device, NEO::EngineGroupType::copy, 0u); + void *srcBuffer = reinterpret_cast(0x1234); + void *dstBuffer = reinterpret_cast(0x2345); + uint32_t width = 16; + uint32_t height = 16; + ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U}; + ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U}; + CmdListMemoryCopyParams copyParams = {}; + + commandList->useAdditionalBlitProperties = false; + EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled); + commandList->appendMemoryCopyRegion(dstBuffer, &dr, width, 0, + srcBuffer, &sr, width, 0, nullptr, 0, nullptr, copyParams); + EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled); + + commandList->useAdditionalBlitProperties = true; + commandList->appendMemoryCopyRegion(dstBuffer, &dr, width, 0, + srcBuffer, &sr, width, 0, nullptr, 0, nullptr, copyParams); + EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled); +} + } // namespace ult } // namespace L0 diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index df836837a8..86caf35037 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -70,8 +70,8 @@ struct EncodePostSyncArgs { bool requiresSystemMemoryFence() const { return (isHostScopeSignalEvent && isUsingSystemAllocation && this->device->getProductHelper().isGlobalFenceInPostSyncRequired(this->device->getHardwareInfo())); } - bool isValidEvent() const { - return (eventAddress != 0) || (isCounterBasedEvent && !isTimestampEvent); + bool isRegularEvent() const { + return (eventAddress != 0) && (inOrderExecInfo == nullptr); } }; diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index a4e66e730d..fe3a5ed4a7 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -372,7 +372,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis if (args.postSyncArgs.inOrderExecInfo) { EncodePostSync::setupPostSyncForInOrderExec(walkerCmd, args.postSyncArgs); - } else if (args.postSyncArgs.isValidEvent()) { + } else if (args.postSyncArgs.isRegularEvent()) { EncodePostSync::setupPostSyncForRegularEvent(walkerCmd, args.postSyncArgs); } else { EncodeDispatchKernel::forceComputeWalkerPostSyncFlushWithWrite(walkerCmd); diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index a9eb0d3ea6..0cc4424a5c 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -292,6 +292,11 @@ void BlitCommandsHelper::dispatchBlitMemoryFill(const BlitProperties blitCmd.setFillColor(blitProperties.fillPattern); blitCmd.setColorDepth(colorDepth); + const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper().useAdditionalBlitProperties(); + + if (useAdditionalBlitProperties) { + applyAdditionalBlitProperties(blitProperties, blitCmd, rootDeviceEnvironment, false); + } uint64_t sizeToFill = blitProperties.copySize.x / patternSize; uint64_t offset = blitProperties.dstOffset.x; @@ -310,16 +315,20 @@ void BlitCommandsHelper::dispatchBlitMemoryFill(const BlitProperties appendTilingEnable(tmpCmd); } } + auto blitSize = width * height; + auto lastCommand = (sizeToFill - blitSize == 0); tmpCmd.setDestinationX2CoordinateRight(static_cast(width)); tmpCmd.setDestinationY2CoordinateBottom(static_cast(height)); tmpCmd.setDestinationPitch(static_cast(width * patternSize)); + if (useAdditionalBlitProperties && lastCommand) { + applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand); + } appendBlitMemoryOptionsForFillBuffer(blitProperties.dstAllocation, tmpCmd, rootDeviceEnvironment); appendBlitFillCommand(blitProperties, tmpCmd); auto cmd = linearStream.getSpaceForCmd(); *cmd = tmpCmd; - auto blitSize = width * height; offset += (blitSize * patternSize); sizeToFill -= blitSize; } @@ -351,6 +360,12 @@ void BlitCommandsHelper::dispatchBlitCommandsForImageRegion(const Bli appendSurfaceType(blitProperties, bltCmd); dispatchPreBlitCommand(linearStream, rootDeviceEnvironment); + const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper().useAdditionalBlitProperties(); + + if (useAdditionalBlitProperties) { + applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, false); + } + for (uint32_t i = 0; i < blitProperties.copySize.z; i++) { appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch); @@ -358,6 +373,9 @@ void BlitCommandsHelper::dispatchBlitCommandsForImageRegion(const Bli printImageBlitBlockCopyCommand(bltCmd, i); } + if (useAdditionalBlitProperties && i == (blitProperties.copySize.z - 1)) { + applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, true); + } auto cmd = linearStream.getSpaceForCmd(); *cmd = bltCmd; dispatchPostBlitCommand(linearStream, rootDeviceEnvironment); diff --git a/shared/source/helpers/blit_commands_helper_pvc_and_later.inl b/shared/source/helpers/blit_commands_helper_pvc_and_later.inl index 035840ec6b..5474ad7090 100644 --- a/shared/source/helpers/blit_commands_helper_pvc_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_pvc_and_later.inl @@ -32,6 +32,12 @@ void BlitCommandsHelper::dispatchBlitMemoryByteFill(const BlitPropert blitCmd.setFillData(*blitProperties.fillPattern); + const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper().useAdditionalBlitProperties(); + + if (useAdditionalBlitProperties) { + applyAdditionalBlitProperties(blitProperties, blitCmd, rootDeviceEnvironment, false); + } + auto sizeToFill = blitProperties.copySize.x; uint64_t offset = blitProperties.dstOffset.x; while (sizeToFill != 0) { @@ -49,16 +55,20 @@ void BlitCommandsHelper::dispatchBlitMemoryByteFill(const BlitPropert tmpCmd.setFillType(MEM_SET::FILL_TYPE::FILL_TYPE_MATRIX_FILL); } } + auto blitSize = width * height; + auto lastCommand = (sizeToFill - blitSize == 0); tmpCmd.setFillWidth(static_cast(width)); tmpCmd.setFillHeight(static_cast(height)); tmpCmd.setDestinationPitch(static_cast(width)); + if (useAdditionalBlitProperties && lastCommand) { + applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand); + } appendBlitMemSetCommand(blitProperties, &tmpCmd); auto cmd = linearStream.getSpaceForCmd(); *cmd = tmpCmd; - auto blitSize = width * height; offset += blitSize; sizeToFill -= blitSize; } diff --git a/shared/test/unit_test/encoders/test_command_encoder.cpp b/shared/test/unit_test/encoders/test_command_encoder.cpp index 48233e2415..41662c0d4e 100644 --- a/shared/test/unit_test/encoders/test_command_encoder.cpp +++ b/shared/test/unit_test/encoders/test_command_encoder.cpp @@ -237,16 +237,13 @@ HWTEST_F(CommandEncoderTest, givenEncodePostSyncArgsWhenCallingIsRegularEventThe EncodePostSyncArgs args{}; MockTagAllocator> deviceTagAllocator(0, pDevice->getMemoryManager()); auto inOrderExecInfo = InOrderExecInfo::create(deviceTagAllocator.getTag(), deviceTagAllocator.getTag(), *pDevice, 1, false); // setting duplicateStorage = true; - for (bool counterBasedEvent : {true, false}) { - for (bool timestampEvent : {true, false}) { - for (uint64_t eventAddress : {0, 0x1010}) { - args.device = pDevice; - args.isCounterBasedEvent = counterBasedEvent; - args.isTimestampEvent = timestampEvent; - args.eventAddress = eventAddress; - bool expectedValidEvent = (eventAddress != 0) || (counterBasedEvent && !timestampEvent); - EXPECT_EQ(expectedValidEvent, args.isValidEvent()); - } + for (bool inOrderExec : {true, false}) { + for (uint64_t eventAddress : {0, 0x1010}) { + args.device = pDevice; + args.inOrderExecInfo = (inOrderExec) ? reinterpret_cast(0x1234) : nullptr; + args.eventAddress = eventAddress; + bool expectedRegularEvent = (eventAddress != 0 && !inOrderExec); + EXPECT_EQ(expectedRegularEvent, args.isRegularEvent()); } } } diff --git a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp index de550a9c0e..9f48c75e3f 100644 --- a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp +++ b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp @@ -712,7 +712,7 @@ HWTEST_F(BlitTests, givenPlatformWhenCallingDispatchPreBlitCommandThenNoneMiFlus EXPECT_NE(estimatedSizeWithoutNode, estimatedSizeWithNode); } -HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutTimestampModeWhenCallingDispatchBlitCommandForBufferThenTheResultsAreTheSame, MatchAny) { +HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitCommandForBufferPerRowThenTheResultsAreTheSame, MatchAny) { uint32_t src[] = {1, 2, 3, 4}; uint32_t dst[] = {4, 3, 2, 1}; uint32_t clear[] = {5, 6, 7, 8}; @@ -741,8 +741,10 @@ HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutTimestampM LinearStream stream(streamBuffer, sizeof(streamBuffer)); NEO::BlitCommandsHelper::dispatchBlitCommandsForBufferPerRow(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef()); - // change it into timestamp mode - blitProperties.blitSyncProperties.syncMode = NEO::BlitSyncMode::timestamp; + // change productHelper to return true + pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw); + auto *mockProductHelper = static_cast *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get()); + mockProductHelper->enableAdditionalBlitProperties = true; uint32_t streamBuffer2[400] = {}; LinearStream stream2(streamBuffer2, sizeof(streamBuffer2)); @@ -750,18 +752,101 @@ HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutTimestampM EXPECT_EQ(stream.getUsed(), stream2.getUsed()); EXPECT_EQ(0, memcmp(ptrOffset(stream.getCpuBase(), 0), ptrOffset(stream2.getCpuBase(), 0), std::min(stream.getUsed(), stream2.getUsed()))); +} + +HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitCommandForImageRegionThenTheResultsAreTheSame, MatchAny) { + MockGraphicsAllocation srcAlloc; + MockGraphicsAllocation dstAlloc; + MockGraphicsAllocation clearColorAllocation; + + Vec3 dstOffsets = {0, 0, 0}; + Vec3 srcOffsets = {0, 0, 0}; + + size_t copySizeX = BlitterConstants::maxBlitWidth - 1; + size_t copySizeY = BlitterConstants::maxBlitHeight - 1; + Vec3 copySize = {copySizeX, copySizeY, 0x2}; + Vec3 srcSize = {copySizeX, copySizeY, 0x2}; + Vec3 dstSize = {copySizeX, copySizeY, 0x2}; + + size_t srcRowPitch = srcSize.x; + size_t srcSlicePitch = srcSize.y; + size_t dstRowPitch = dstSize.x; + size_t dstSlicePitch = dstSize.y; + + auto blitProperties = BlitProperties::constructPropertiesForCopy(&dstAlloc, &srcAlloc, + dstOffsets, srcOffsets, copySize, srcRowPitch, srcSlicePitch, + dstRowPitch, dstSlicePitch, &clearColorAllocation); + blitProperties.bytesPerPixel = 4; + blitProperties.srcSize = srcSize; + blitProperties.dstSize = dstSize; + + uint32_t streamBuffer[100] = {}; + LinearStream stream(streamBuffer, sizeof(streamBuffer)); + NEO::BlitCommandsHelper::dispatchBlitCommandsForImageRegion(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef()); // change productHelper to return true pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw); auto *mockProductHelper = static_cast *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get()); mockProductHelper->enableAdditionalBlitProperties = true; - uint32_t streamBuffer3[400] = {}; - LinearStream stream3(streamBuffer3, sizeof(streamBuffer2)); - NEO::BlitCommandsHelper::dispatchBlitCommandsForBufferPerRow(blitProperties, stream3, pDevice->getRootDeviceEnvironmentRef()); + uint32_t streamBuffer2[100] = {}; + LinearStream stream2(streamBuffer2, sizeof(streamBuffer2)); + NEO::BlitCommandsHelper::dispatchBlitCommandsForImageRegion(blitProperties, stream2, pDevice->getRootDeviceEnvironmentRef()); - EXPECT_EQ(stream.getUsed(), stream3.getUsed()); - EXPECT_EQ(0, memcmp(ptrOffset(stream.getCpuBase(), 0), ptrOffset(stream3.getCpuBase(), 0), std::min(stream.getUsed(), stream3.getUsed()))); + EXPECT_EQ(stream.getUsed(), stream2.getUsed()); + EXPECT_EQ(0, memcmp(ptrOffset(stream.getCpuBase(), 0), ptrOffset(stream2.getCpuBase(), 0), std::min(stream.getUsed(), stream2.getUsed()))); +} + +HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesAndSingleBytePatternWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitMemoryColorFillThenTheResultsAreTheSame, MatchAny) { + size_t dstSize = sizeof(uint8_t) * (BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight); + MockGraphicsAllocation dstAlloc(0, 1u /*num gmms*/, AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, dstSize, + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + uint32_t pattern[4] = {}; + pattern[0] = 0x1; + auto blitProperties = BlitProperties::constructPropertiesForMemoryFill(&dstAlloc, dstSize, pattern, sizeof(uint8_t), 0); + + uint32_t streamBuffer[800] = {}; + LinearStream stream(streamBuffer, sizeof(streamBuffer)); + NEO::BlitCommandsHelper::dispatchBlitMemoryColorFill(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef()); + + // change productHelper to return true + pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw); + auto *mockProductHelper = static_cast *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get()); + mockProductHelper->enableAdditionalBlitProperties = true; + + uint32_t streamBuffer2[800] = {}; + LinearStream stream2(streamBuffer2, sizeof(streamBuffer2)); + NEO::BlitCommandsHelper::dispatchBlitMemoryColorFill(blitProperties, stream2, pDevice->getRootDeviceEnvironmentRef()); + + EXPECT_EQ(stream.getUsed(), stream2.getUsed()); + EXPECT_EQ(0, memcmp(ptrOffset(stream.getCpuBase(), 0), ptrOffset(stream2.getCpuBase(), 0), std::min(stream.getUsed(), stream2.getUsed()))); +} + +HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitMemoryFillThenTheResultsAreTheSame, MatchAny) { + size_t dstSize = 2 * sizeof(uint32_t) * (BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight) + sizeof(uint32_t); + MockGraphicsAllocation dstAlloc(0, 1u /*num gmms*/, AllocationType::internalHostMemory, + reinterpret_cast(0x1234), 0x1000, 0, dstSize, + MemoryPool::system4KBPages, MemoryManager::maxOsContextCount); + uint32_t pattern[4] = {}; + pattern[0] = 0x4567; + auto blitProperties = BlitProperties::constructPropertiesForMemoryFill(&dstAlloc, dstSize, pattern, sizeof(uint32_t), 0); + + uint32_t streamBuffer[1200] = {}; + LinearStream stream(streamBuffer, sizeof(streamBuffer)); + NEO::BlitCommandsHelper::dispatchBlitMemoryFill(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef()); + + // change productHelper to return true + pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw); + auto *mockProductHelper = static_cast *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get()); + mockProductHelper->enableAdditionalBlitProperties = true; + + uint32_t streamBuffer2[1200] = {}; + LinearStream stream2(streamBuffer2, sizeof(streamBuffer2)); + NEO::BlitCommandsHelper::dispatchBlitMemoryFill(blitProperties, stream2, pDevice->getRootDeviceEnvironmentRef()); + + EXPECT_EQ(stream.getUsed(), stream2.getUsed()); + EXPECT_EQ(0, memcmp(ptrOffset(stream.getCpuBase(), 0), ptrOffset(stream2.getCpuBase(), 0), std::min(stream.getUsed(), stream2.getUsed()))); } HWTEST_F(BlitTests, givenBlitPropertieswithImageOperationWhenCallingEstimateBlitCommandSizeThenBlockCopySizeIsReturned) { diff --git a/shared/test/unit_test/helpers/test_blit_commands_helper_pvc_and_later.cpp b/shared/test/unit_test/helpers/test_blit_commands_helper_pvc_and_later.cpp index f93c85bc20..164fc2fef9 100644 --- a/shared/test/unit_test/helpers/test_blit_commands_helper_pvc_and_later.cpp +++ b/shared/test/unit_test/helpers/test_blit_commands_helper_pvc_and_later.cpp @@ -409,4 +409,4 @@ HWTEST2_F(BlitTests, GivenDispatchDummyBlitWhenWorkaroundIsNotRequiredThenDummyA EncodeDummyBlitWaArgs waArgs{false, rootDeviceEnvironment}; BlitCommandsHelper::dispatchDummyBlit(stream, waArgs); EXPECT_EQ(nullptr, rootDeviceEnvironment->getDummyAllocation()); -} \ No newline at end of file +}