From 3e116ea378127ec21350c0d5dcc4503e716cc8b5 Mon Sep 17 00:00:00 2001 From: "Cencelewska, Katarzyna" Date: Fri, 3 Mar 2023 19:01:14 +0000 Subject: [PATCH] refactor: use same paths when add command mi_semaphore_wait Signed-off-by: Cencelewska, Katarzyna --- .../core/source/cmdqueue/cmdqueue_hw.inl | 4 +- .../core/source/cmdqueue/cmdqueue_hw_base.inl | 4 +- .../cmdqueue_xe_hp_core_and_later.inl | 4 +- .../sources/cmdlist/test_cmdlist_5.cpp | 4 +- .../cmdlist/test_cmdlist_append_barrier.cpp | 32 ++++---- .../test_cmdlist_append_launch_kernel_3.cpp | 3 +- .../test_cmdlist_append_wait_on_events.cpp | 4 +- .../command_queue/gpgpu_walker_base.inl | 2 +- .../command_queue/hardware_interface_base.inl | 1 - .../aub_multicontext_tests_xehp_and_later.cpp | 4 +- .../command_queue/blit_enqueue_1_tests.cpp | 4 - .../command_queue_tests_pvc_and_later.cpp | 1 - ...and_stream_receiver_flush_task_4_tests.cpp | 2 +- .../command_stream_receiver_hw_2_tests.cpp | 1 - ...tream_receiver_hw_tests_xehp_and_later.cpp | 6 +- .../gfx_core_helper_tests_xe_hpc_core.cpp | 5 +- .../command_container/command_encoder.h | 6 +- .../command_container/command_encoder.inl | 8 +- .../command_encoder_bdw_and_later.inl | 13 ++-- .../command_encoder_xehp_and_later.inl | 13 ++-- .../walker_partition_xehp_and_later.h | 14 +--- .../experimental_command_buffer.inl | 15 ++-- .../direct_submission_hw.inl | 3 - .../helpers/blit_commands_helper_base.inl | 4 +- .../blit_commands_helper_xehp_and_later.inl | 6 +- shared/source/helpers/timestamp_packet.h | 7 +- .../gfx_core_helper_xe_hpc_core.cpp | 3 +- .../gfx_core_helper_xe_hpg_core.cpp | 4 +- .../encoders/test_encode_semaphore.cpp | 28 ++++--- .../test_implicit_scaling_xehp_and_later.cpp | 78 +++++++++---------- .../gfx_core_helper_tests_dg2_and_later.cpp | 3 +- ...st_blit_commands_helper_xehp_and_later.cpp | 2 +- .../helpers/timestamp_packet_tests.cpp | 4 +- .../pvc/gfx_core_helper_tests_pvc.cpp | 10 +-- 34 files changed, 147 insertions(+), 155 deletions(-) diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index bf04ff5acd..578892f851 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -598,14 +598,14 @@ size_t CommandQueueHw::estimateLinearStreamSizeInitial( this->device->getNEODevice()->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::BeforeWorkload)) { linearStreamSizeEstimate += NEO::MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(this->device->getNEODevice()->getRootDeviceEnvironment(), false); - linearStreamSizeEstimate += sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); + linearStreamSizeEstimate += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } if (NEO::PauseOnGpuProperties::pauseModeAllowed(NEO::DebugManager.flags.PauseOnEnqueue.get(), this->device->getNEODevice()->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::AfterWorkload)) { linearStreamSizeEstimate += NEO::MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(this->device->getNEODevice()->getRootDeviceEnvironment(), false); - linearStreamSizeEstimate += sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); + linearStreamSizeEstimate += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } return linearStreamSizeEstimate; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl index 5cfb88ba3d..666207606f 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl @@ -147,7 +147,7 @@ void CommandQueueHw::patchCommands(CommandList &commandList, uint csr->getDebugPauseStateGPUAddress(), static_cast(NEO::DebugPauseState::hasUserStartConfirmation), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, - false); + false, true); break; } case CommandList::CommandToPatch::PauseOnEnqueueSemaphoreEnd: { @@ -155,7 +155,7 @@ void CommandQueueHw::patchCommands(CommandList &commandList, uint csr->getDebugPauseStateGPUAddress(), static_cast(NEO::DebugPauseState::hasUserEndConfirmation), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, - false); + false, true); break; } case CommandList::CommandToPatch::PauseOnEnqueuePipeControlStart: { diff --git a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl index 4b4d53ffe9..67b2fe69ee 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl @@ -194,7 +194,7 @@ void CommandQueueHw::patchCommands(CommandList &commandList, uint csr->getDebugPauseStateGPUAddress(), static_cast(NEO::DebugPauseState::hasUserStartConfirmation), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, - false); + false, true); break; } case CommandList::CommandToPatch::PauseOnEnqueueSemaphoreEnd: { @@ -202,7 +202,7 @@ void CommandQueueHw::patchCommands(CommandList &commandList, uint csr->getDebugPauseStateGPUAddress(), static_cast(NEO::DebugPauseState::hasUserEndConfirmation), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, - false); + false, true); break; } case CommandList::CommandToPatch::PauseOnEnqueuePipeControlStart: { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp index 15d60bb88f..f8642ce08c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp @@ -704,7 +704,7 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW EXPECT_EQ(1u, commandList->cmdListType); EXPECT_NE(nullptr, commandList->cmdQImmediate); - size_t expectedUsed = 2 * sizeof(SEMAPHORE_WAIT) + sizeof(MI_BATCH_BUFFER_END); + size_t expectedUsed = 2 * NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_END); if (NEO::MemorySynchronizationCommands::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment())) { expectedUsed += sizeof(PIPE_CONTROL); } @@ -753,7 +753,7 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW EXPECT_EQ(1u, commandList->cmdListType); EXPECT_NE(nullptr, commandList->cmdQImmediate); - size_t expectedUsed = 2 * sizeof(SEMAPHORE_WAIT) + sizeof(MI_BATCH_BUFFER_END); + size_t expectedUsed = 2 * NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_END); expectedUsed = alignUp(expectedUsed, 64); auto &commandContainer = commandList->commandContainer; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp index a469af7cdd..17e16e7600 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp @@ -124,7 +124,7 @@ void validateMultiTileBarrier(void *cmdBuffer, size_t &parsedOffset, EXPECT_EQ(gpuCrossTileSyncAddress, miSemaphore->getSemaphoreGraphicsAddress()); EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD, miSemaphore->getCompareOperation()); EXPECT_EQ(2u, miSemaphore->getSemaphoreDataDword()); - parsedOffset += sizeof(MI_SEMAPHORE_WAIT); + parsedOffset += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } { auto bbStart = genCmdCast(ptrOffset(cmdBuffer, parsedOffset)); @@ -162,7 +162,7 @@ void validateMultiTileBarrier(void *cmdBuffer, size_t &parsedOffset, EXPECT_EQ(gpuFinalSyncAddress, miSemaphore->getSemaphoreGraphicsAddress()); EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD, miSemaphore->getCompareOperation()); EXPECT_EQ(2u, miSemaphore->getSemaphoreDataDword()); - parsedOffset += sizeof(MI_SEMAPHORE_WAIT); + parsedOffset += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } { auto storeDataImm = genCmdCast(ptrOffset(cmdBuffer, parsedOffset)); @@ -186,7 +186,7 @@ void validateMultiTileBarrier(void *cmdBuffer, size_t &parsedOffset, EXPECT_EQ(gpuFinalSyncAddress, miSemaphore->getSemaphoreGraphicsAddress()); EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD, miSemaphore->getCompareOperation()); EXPECT_EQ(4u, miSemaphore->getSemaphoreDataDword()); - parsedOffset += sizeof(MI_SEMAPHORE_WAIT); + parsedOffset += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } } } @@ -205,16 +205,16 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, WhenAppendingBarrierThenPipeControl size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START); size_t startOffset = beforeControlSectionOffset + (2 * sizeof(uint32_t)); size_t expectedUseBuffer = startOffset + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); auto gpuBaseAddress = commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->getGpuAddress() + @@ -261,16 +261,16 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START); size_t bbStartOffset = beforeControlSectionOffset + (2 * sizeof(uint32_t)); size_t expectedUseBuffer = bbStartOffset + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); auto firstBatchBufferAllocation = cmdListStream->getGraphicsAllocation(); auto useSize = cmdListStream->getAvailableSpace(); @@ -327,16 +327,16 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START); size_t bbStartOffset = beforeControlSectionOffset + (2 * sizeof(uint32_t)); size_t multiTileBarrierSize = bbStartOffset + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t postSyncSize = NEO::MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(device->getNEODevice()->getRootDeviceEnvironment(), false); @@ -433,16 +433,16 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START); size_t bbStartOffset = beforeControlSectionOffset + (2 * sizeof(uint32_t)); size_t multiTileBarrierSize = bbStartOffset + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t timestampRegisters = 2 * (sizeof(MI_LOAD_REGISTER_REG) + sizeof(MI_LOAD_REGISTER_IMM) + NEO::EncodeMath::streamCommandSize + sizeof(MI_STORE_REGISTER_MEM)); @@ -527,7 +527,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendBarrier, constexpr size_t sizeBarrierCommands = sizeof(PIPE_CONTROL) + sizeof(MI_ATOMIC) + - sizeof(MI_SEMAPHORE_WAIT) + + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START); constexpr size_t expectedSize = sizeBarrierCommands + diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp index 6614537194..2b5b3e279e 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp @@ -876,7 +876,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendLaunchKernelXeHpCoreTest, givenImpl auto sizeAfter = cmdStream->getUsed(); uint64_t bbStartGpuAddress = cmdStream->getGraphicsAllocation()->getGpuAddress() + sizeBefore; - bbStartGpuAddress += sizeof(WALKER_TYPE) + sizeof(PIPE_CONTROL) + sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + bbStartGpuAddress += sizeof(WALKER_TYPE) + sizeof(PIPE_CONTROL) + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + 3 * sizeof(uint32_t); GenCmdList cmdList; @@ -912,7 +912,6 @@ HWTEST2_F(MultiTileImmediateCommandListAppendLaunchKernelXeHpCoreTest, givenImpl HWTEST2_F(MultiTileImmediateCommandListAppendLaunchKernelXeHpCoreTest, givenImplicitScalingWhenUsingImmediateCommandListWithoutFlushTaskThenUseSecondaryBuffer, IsAtLeastXeHpCore) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; using MI_ATOMIC = typename FamilyType::MI_ATOMIC; - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp index d5dfb00bd5..6ba9b5f47c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp @@ -526,7 +526,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenCommandBufferIsEmptyWhenAppendingWai consumeSpace -= sizeof(MI_BATCH_BUFFER_END); commandList->commandContainer.getCommandStream()->getSpace(consumeSpace); - size_t expectedConsumedSpace = sizeof(MI_SEMAPHORE_WAIT); + size_t expectedConsumedSpace = NEO::EncodeSempahore::getSizeMiSemaphoreWait(); if (MemorySynchronizationCommands::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment())) { expectedConsumedSpace += sizeof(PIPE_CONTROL); } @@ -596,7 +596,7 @@ HWTEST2_F(MultTileCommandListAppendWaitOnEvent, GivenMultiTileCmdListWhenPartitionedEventUsedToWaitThenExpectProperGpuAddressAndSemaphoreCount, IsAtLeastXeHpCore) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - size_t expectedSize = commandList->partitionCount * sizeof(MI_SEMAPHORE_WAIT); + size_t expectedSize = commandList->partitionCount * NEO::EncodeSempahore::getSizeMiSemaphoreWait(); event->setPacketsInUse(commandList->partitionCount); event->setUsingContextEndOffset(true); diff --git a/opencl/source/command_queue/gpgpu_walker_base.inl b/opencl/source/command_queue/gpgpu_walker_base.inl index f1bff6b46f..73074d1636 100644 --- a/opencl/source/command_queue/gpgpu_walker_base.inl +++ b/opencl/source/command_queue/gpgpu_walker_base.inl @@ -214,7 +214,7 @@ size_t EnqueueOperation::getTotalSizeRequiredCS(uint32_t eventType, c if (DebugManager.flags.PauseOnEnqueue.get() != -1) { expectedSizeCS += MemorySynchronizationCommands::getSizeForSingleBarrier(false) * 2; - expectedSizeCS += sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT) * 2; + expectedSizeCS += NEO::EncodeSempahore::getSizeMiSemaphoreWait() * 2; } if (DebugManager.flags.GpuScratchRegWriteAfterWalker.get() != -1) { diff --git a/opencl/source/command_queue/hardware_interface_base.inl b/opencl/source/command_queue/hardware_interface_base.inl index 221c8b0043..40f1c37696 100644 --- a/opencl/source/command_queue/hardware_interface_base.inl +++ b/opencl/source/command_queue/hardware_interface_base.inl @@ -285,7 +285,6 @@ inline void HardwareInterface::dispatchDebugPauseCommands( } { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; EncodeSempahore::addMiSemaphoreWaitCommand(*commandStream, address, diff --git a/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp b/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp index 68d35b35c5..876999d345 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -331,7 +331,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DynamicWalkerPartitionFourTilesTests, whenWalkerPar } HWCMDTEST_F(IGFX_XE_HP_CORE, DynamicWalkerPartitionFourTilesTests, whenWalkerPartitionIsEnabledForKernelWithoutAtomicThenOutputDataIsValid) { - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto mockCommandQueue = new MockCommandQueueHw(multiTileDefaultContext.get(), rootDevice, nullptr); @@ -403,7 +402,6 @@ struct StaticWalkerPartitionFourTilesTests : EnqueueWithWalkerPartitionFourTiles }; HWCMDTEST_F(IGFX_XE_HP_CORE, StaticWalkerPartitionFourTilesTests, givenFourTilesWhenStaticWalkerPartitionIsEnabledForKernelThenOutputDataIsValid) { - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto mockCommandQueue = new MockCommandQueueHw(multiTileDefaultContext.get(), rootDevice, nullptr); diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp index fd8db04e11..92579efe49 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp @@ -1485,8 +1485,6 @@ HWTEST_TEMPLATED_F(BlitEnqueueTaskCountTests, givenMarkerThatFollowsCopyOperatio auto buffer = createBuffer(1, false); int hostPtr = 0; - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - cl_event outEvent1; commandQueue->enqueueKernel(mockKernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1511,8 +1509,6 @@ HWTEST_TEMPLATED_F(BlitEnqueueTaskCountTests, givenMarkerThatFollowsCopyOperatio auto buffer = createBuffer(1, false); int hostPtr = 0; - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - cl_event outEvent1, outEvent2; commandQueue->enqueueKernel(mockKernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); diff --git a/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp b/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp index 3f9c8edabb..3a2806ab76 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp @@ -692,7 +692,6 @@ HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelec } HWTEST2_F(OoqCommandQueueHwBlitTest, givenBarrierBeforeFirstKernelWhenEnqueueNDRangeThenProgramBarrierBeforeGlobalAllocation, IsPVC) { - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS; using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE; diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp index 679d1a1653..75eab9a661 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp @@ -367,7 +367,7 @@ HWTEST_F(CrossDeviceDependenciesTests, givenMultipleEventInMultiRootDeviceEnviro eventsRequest.fillCsrDependenciesForRootDevices(csrDeps, pCmdQ2->getGpgpuCommandStreamReceiver()); EXPECT_EQ(3u, csrDeps.multiRootTimeStampSyncContainer.size()); - EXPECT_EQ(3u * sizeof(MI_SEMAPHORE_WAIT), TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer(csrDeps)); + EXPECT_EQ(3u * NEO::EncodeSempahore::getSizeMiSemaphoreWait(), TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer(csrDeps)); } } 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 fa6620ad15..9a85bddf71 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 @@ -1480,7 +1480,6 @@ HWTEST_F(BcsTests, givenInvalidBlitDirectionWhenConstructPropertiesThenException HWTEST_F(BcsTests, givenBlitterDirectSubmissionEnabledWhenProgrammingBlitterThenExpectRingBufferDispatched) { using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START; - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; VariableBackup backup(&ultHwConfig); ultHwConfig.csrBaseCallBlitterDirectSubmissionAvailable = true; diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp index 3ac1a534d1..0dea276b0d 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp @@ -914,7 +914,7 @@ HWTEST2_F(CommandStreamReceiverHwTestXeHPAndLater, givenStaticPartitionEnabledWh commandStreamReceiver.activePartitions = 2; size_t expectedSize = sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + 2 * sizeof(uint32_t); size_t estimatedCmdSize = commandStreamReceiver.getCmdSizeForStallingNoPostSyncCommands(); @@ -936,7 +936,7 @@ HWTEST2_F(CommandStreamReceiverHwTestXeHPAndLater, givenStaticPartitionEnabledWh MI_SEMAPHORE_WAIT *miSemaphore = genCmdCast(ptrOffset(cmdBuffer, offset)); ASSERT_NE(nullptr, miSemaphore); - offset += sizeof(MI_SEMAPHORE_WAIT); + offset += NEO::EncodeSempahore::getSizeMiSemaphoreWait(); MI_BATCH_BUFFER_START *bbStart = genCmdCast(ptrOffset(cmdBuffer, offset)); ASSERT_NE(nullptr, bbStart); @@ -1071,7 +1071,7 @@ HWTEST2_F(CommandStreamReceiverHwTestXeHPAndLater, givenStaticPartitionEnabledWh commandStreamReceiver->activePartitions = 2; size_t expectedSize = MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + 2 * sizeof(uint32_t); size_t estimatedCmdSize = commandStreamReceiver->getCmdSizeForStallingCommands(dispatchFlags); diff --git a/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp index 7f1d43d63a..5c2efda5bd 100644 --- a/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/command_container/command_encoder.h" #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/os_interface/hw_info_config.h" @@ -631,9 +632,7 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenDontProgramGlobalFenceAsMiMe DebugManagerStateRestore debugRestorer; DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(0); - using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - - EXPECT_EQ(sizeof(MI_SEMAPHORE_WAIT), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); + EXPECT_EQ(NEO::EncodeSempahore::getSizeMiSemaphoreWait(), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); } XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenProgramGlobalFenceAsMiMemFenceCommandInCommandStreamWhenGettingSizeForAdditionalSynchronizationThenCorrectValueIsReturned) { diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index a139199f7c..2cc12600f2 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -370,7 +370,8 @@ struct EncodeSempahore { uint64_t compareAddress, uint32_t compareData, COMPARE_OPERATION compareMode, - bool registerPollMode); + bool registerPollMode, + bool waitMode); static void addMiSemaphoreWaitCommand(LinearStream &commandStream, uint64_t compareAddress, @@ -383,6 +384,9 @@ struct EncodeSempahore { uint32_t compareData, COMPARE_OPERATION compareMode); + static void applyMiSemaphoreWaitCommand(LinearStream &commandStream, + std::list &commandsList); + static constexpr size_t getSizeMiSemaphoreWait() { return sizeof(MI_SEMAPHORE_WAIT); } }; diff --git a/shared/source/command_container/command_encoder.inl b/shared/source/command_container/command_encoder.inl index 26af6ddd8d..6933f988b6 100644 --- a/shared/source/command_container/command_encoder.inl +++ b/shared/source/command_container/command_encoder.inl @@ -807,7 +807,13 @@ void EncodeSempahore::addMiSemaphoreWaitCommand(LinearStream &commandStr compareAddress, compareData, compareMode, - registerPollMode); + registerPollMode, + true); +} +template +void EncodeSempahore::applyMiSemaphoreWaitCommand(LinearStream &commandStream, std::list &commandsList) { + MI_SEMAPHORE_WAIT *semaphoreCommand = commandStream.getSpaceForCmd(); + commandsList.push_back(semaphoreCommand); } template diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index 15c26b9dcc..e88088c2a6 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -268,9 +268,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis void *commandBuffer = listCmdBufferStream->getSpace(MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(args.device->getRootDeviceEnvironment(), false)); args.additionalCommands->push_back(commandBuffer); - using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; - MI_SEMAPHORE_WAIT *semaphoreCommand = listCmdBufferStream->getSpaceForCmd(); - args.additionalCommands->push_back(semaphoreCommand); + EncodeSempahore::applyMiSemaphoreWaitCommand(*listCmdBufferStream, *args.additionalCommands); } PreemptionHelper::applyPreemptionWaCmdsBegin(listCmdBufferStream, *args.device); @@ -290,9 +288,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis void *commandBuffer = listCmdBufferStream->getSpace(MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(args.device->getRootDeviceEnvironment(), false)); args.additionalCommands->push_back(commandBuffer); - using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; - MI_SEMAPHORE_WAIT *semaphoreCommand = listCmdBufferStream->getSpaceForCmd(); - args.additionalCommands->push_back(semaphoreCommand); + EncodeSempahore::applyMiSemaphoreWaitCommand(*listCmdBufferStream, *args.additionalCommands); } } @@ -542,12 +538,13 @@ void EncodeSempahore::programMiSemaphoreWait(MI_SEMAPHORE_WAIT *cmd, uint64_t compareAddress, uint32_t compareData, COMPARE_OPERATION compareMode, - bool registerPollMode) { + bool registerPollMode, + bool waitMode) { MI_SEMAPHORE_WAIT localCmd = Family::cmdInitMiSemaphoreWait; localCmd.setCompareOperation(compareMode); localCmd.setSemaphoreDataDword(compareData); localCmd.setSemaphoreGraphicsAddress(compareAddress); - localCmd.setWaitMode(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE); + localCmd.setWaitMode(waitMode ? MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE : MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_SIGNAL_MODE); *cmd = localCmd; } 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 9d6686f03a..89624c7516 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -252,9 +252,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis void *commandBuffer = listCmdBufferStream->getSpace(MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(args.device->getRootDeviceEnvironment(), false)); args.additionalCommands->push_back(commandBuffer); - using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; - MI_SEMAPHORE_WAIT *semaphoreCommand = listCmdBufferStream->getSpaceForCmd(); - args.additionalCommands->push_back(reinterpret_cast(semaphoreCommand)); + EncodeSempahore::applyMiSemaphoreWaitCommand(*listCmdBufferStream, *args.additionalCommands); } walkerCmd.setIndirectDataStartAddress(static_cast(offsetThreadData)); @@ -342,9 +340,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis void *commandBuffer = listCmdBufferStream->getSpace(MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false)); args.additionalCommands->push_back(commandBuffer); - using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; - MI_SEMAPHORE_WAIT *semaphoreCommand = listCmdBufferStream->getSpaceForCmd(); - args.additionalCommands->push_back(semaphoreCommand); + EncodeSempahore::applyMiSemaphoreWaitCommand(*listCmdBufferStream, *args.additionalCommands); } } @@ -720,12 +716,13 @@ void EncodeSempahore::programMiSemaphoreWait(MI_SEMAPHORE_WAIT *cmd, uint64_t compareAddress, uint32_t compareData, COMPARE_OPERATION compareMode, - bool registerPollMode) { + bool registerPollMode, + bool waitMode) { MI_SEMAPHORE_WAIT localCmd = Family::cmdInitMiSemaphoreWait; localCmd.setCompareOperation(compareMode); localCmd.setSemaphoreDataDword(compareData); localCmd.setSemaphoreGraphicsAddress(compareAddress); - localCmd.setWaitMode(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE); + localCmd.setWaitMode(waitMode ? MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE : MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_SIGNAL_MODE); localCmd.setRegisterPollMode(registerPollMode ? MI_SEMAPHORE_WAIT::REGISTER_POLL_MODE::REGISTER_POLL_MODE_REGISTER_POLL : MI_SEMAPHORE_WAIT::REGISTER_POLL_MODE::REGISTER_POLL_MODE_MEMORY_POLL); *cmd = localCmd; diff --git a/shared/source/command_container/walker_partition_xehp_and_later.h b/shared/source/command_container/walker_partition_xehp_and_later.h index 05b66e0128..e12b7780dc 100644 --- a/shared/source/command_container/walker_partition_xehp_and_later.h +++ b/shared/source/command_container/walker_partition_xehp_and_later.h @@ -219,13 +219,7 @@ void programRegisterWithValue(void *&inputAddress, uint32_t registerOffset, uint template void programWaitForSemaphore(void *&inputAddress, uint32_t &totalBytesProgrammed, uint64_t gpuAddress, uint32_t semaphoreCompareValue, typename MI_SEMAPHORE_WAIT::COMPARE_OPERATION compareOperation) { auto semaphoreWait = putCommand>(inputAddress, totalBytesProgrammed); - MI_SEMAPHORE_WAIT cmd = GfxFamily::cmdInitMiSemaphoreWait; - - cmd.setSemaphoreDataDword(semaphoreCompareValue); - cmd.setSemaphoreGraphicsAddress(gpuAddress); - cmd.setWaitMode(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE); - cmd.setCompareOperation(compareOperation); - *semaphoreWait = cmd; + NEO::EncodeSempahore::programMiSemaphoreWait(semaphoreWait, gpuAddress, semaphoreCompareValue, compareOperation, false, true); } template @@ -379,7 +373,7 @@ void programSelfCleanupSection(void *&inputAddress, template uint64_t computeTilesSynchronizationWithAtomicsSectionSize() { return sizeof(MI_ATOMIC) + - sizeof(MI_SEMAPHORE_WAIT); + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } template @@ -459,7 +453,7 @@ uint64_t computeControlSectionOffset(WalkerPartitionArgs &args) { size += sizeof(LOAD_REGISTER_REG); // id into register size += sizeof(MI_SET_PREDICATE) * 2 + sizeof(BATCH_BUFFER_START) * 2; - size += (args.semaphoreProgrammingRequired ? sizeof(MI_SEMAPHORE_WAIT) * args.partitionCount : 0u); + size += (args.semaphoreProgrammingRequired ? NEO::EncodeSempahore::getSizeMiSemaphoreWait() * args.partitionCount : 0u); size += computeWalkerSectionSize(); size += args.emitPipeControlStall ? NEO::MemorySynchronizationCommands::getSizeForSingleBarrier(false) : 0u; if (args.crossTileAtomicSynchronization || args.emitSelfCleanup) { @@ -662,7 +656,7 @@ uint64_t computeStaticPartitioningControlSectionOffset(WalkerPartitionArgs &args ? computeTilesSynchronizationWithAtomicsSectionSize() : 0u; const auto afterExecutionSyncPostSyncSize = args.semaphoreProgrammingRequired - ? sizeof(MI_SEMAPHORE_WAIT) * args.partitionCount + ? NEO::EncodeSempahore::getSizeMiSemaphoreWait() * args.partitionCount : 0u; const auto selfCleanupSectionSize = args.emitSelfCleanup ? computeSelfCleanupSectionSize(args.useAtomicsForSelfCleanup) diff --git a/shared/source/command_stream/experimental_command_buffer.inl b/shared/source/command_stream/experimental_command_buffer.inl index e5b31bd99e..1664df7c37 100644 --- a/shared/source/command_stream/experimental_command_buffer.inl +++ b/shared/source/command_stream/experimental_command_buffer.inl @@ -5,6 +5,7 @@ * */ +#include "shared/source/command_container/command_encoder.h" #include "shared/source/command_stream/command_stream_receiver_hw.h" #include "shared/source/command_stream/experimental_command_buffer.h" #include "shared/source/command_stream/linear_stream.h" @@ -94,18 +95,16 @@ void ExperimentalCommandBuffer::addExperimentalCommands() { *semaphoreData = 1; uint64_t gpuAddr = experimentalAllocation->getGpuAddress() + experimentalAllocationOffset; - auto semaphoreCmdSpace = currentStream->getSpaceForCmd(); - auto semaphoreCmd = GfxFamily::cmdInitMiSemaphoreWait; - semaphoreCmd.setCompareOperation(MI_SEMAPHORE_WAIT::COMPARE_OPERATION_SAD_EQUAL_SDD); - semaphoreCmd.setSemaphoreDataDword(*semaphoreData); - semaphoreCmd.setSemaphoreGraphicsAddress(gpuAddr); - *semaphoreCmdSpace = semaphoreCmd; + EncodeSempahore::programMiSemaphoreWait(currentStream->getSpaceForCmd(), + gpuAddr, + *semaphoreData, + MI_SEMAPHORE_WAIT::COMPARE_OPERATION_SAD_EQUAL_SDD, + false, false); } template size_t ExperimentalCommandBuffer::getExperimentalCommandsSize() noexcept { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; - return sizeof(MI_SEMAPHORE_WAIT); + return NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } } // namespace NEO diff --git a/shared/source/direct_submission/direct_submission_hw.inl b/shared/source/direct_submission/direct_submission_hw.inl index df8cd8ee46..4d4569bc81 100644 --- a/shared/source/direct_submission/direct_submission_hw.inl +++ b/shared/source/direct_submission/direct_submission_hw.inl @@ -282,7 +282,6 @@ void DirectSubmissionHw::dispatchRelaxedOrderingScheduler // 3. Semaphore section { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; schedulerCmdStream.getSpace(EncodeMiPredicate::getCmdSize()); // skip patching @@ -564,7 +563,6 @@ bool DirectSubmissionHw::stopRingBuffer() { template inline void DirectSubmissionHw::dispatchSemaphoreSection(uint32_t value) { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; dispatchDisablePrefetcher(true); @@ -867,7 +865,6 @@ void DirectSubmissionHw::preinitializeRelaxedOrderingSect // 3. Semaphore section { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; EncodeMiPredicate::encode(schedulerStream, MiPredicateType::Disable); diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 8b31801d71..68a312e41f 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -321,14 +321,14 @@ template void BlitCommandsHelper::dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger, DebugPauseState waitCondition, const ProductHelper &productHelper) { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; + using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; MiFlushArgs args; args.commandWithPostSync = true; EncodeMiFlushDW::programMiFlushDw(commandStream, debugPauseStateGPUAddress, static_cast(confirmationTrigger), args, productHelper); - EncodeSempahore::addMiSemaphoreWaitCommand(commandStream, debugPauseStateGPUAddress, static_cast(waitCondition), MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD); + EncodeSempahore::addMiSemaphoreWaitCommand(commandStream, debugPauseStateGPUAddress, static_cast(waitCondition), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD); } template diff --git a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl index 1bcc2c84ed..36436c4719 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -365,13 +365,13 @@ void BlitCommandsHelper::appendTilingEnable(typename GfxFamily::XY_CO template void BlitCommandsHelper::programGlobalSequencerFlush(LinearStream &commandStream) { if (DebugManager.flags.GlobalSequencerFlushOnCopyEngine.get() != 0) { - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; + using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; constexpr uint32_t globalInvalidationRegister = 0xB404u; LriHelper::program(&commandStream, globalInvalidationRegister, 1u, false); EncodeSempahore::addMiSemaphoreWaitCommand(commandStream, globalInvalidationRegister, 0u, - MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, + COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, true); } } @@ -379,7 +379,7 @@ void BlitCommandsHelper::programGlobalSequencerFlush(LinearStream &co template size_t BlitCommandsHelper::getSizeForGlobalSequencerFlush() { if (DebugManager.flags.GlobalSequencerFlushOnCopyEngine.get() != 0) { - return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) + sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); + return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } return 0u; } diff --git a/shared/source/helpers/timestamp_packet.h b/shared/source/helpers/timestamp_packet.h index e3b939bc79..718f02cca2 100644 --- a/shared/source/helpers/timestamp_packet.h +++ b/shared/source/helpers/timestamp_packet.h @@ -95,7 +95,6 @@ struct TimestampPacketHelper { template static void programSemaphore(LinearStream &cmdStream, TagNodeBase ×tampPacketNode) { using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; - using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; auto compareAddress = getContextEndGpuAddress(timestampPacketNode); @@ -161,12 +160,12 @@ struct TimestampPacketHelper { template static size_t getRequiredCmdStreamSizeForNodeDependencyWithBlitEnqueue() { - return sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); + return NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } template static size_t getRequiredCmdStreamSizeForNodeDependency(TagNodeBase ×tampPacketNode) { - return (timestampPacketNode.getPacketsUsed() * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT)); + return (timestampPacketNode.getPacketsUsed() * NEO::EncodeSempahore::getSizeMiSemaphoreWait()); } template @@ -183,7 +182,7 @@ struct TimestampPacketHelper { template static size_t getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer(const CsrDependencies &csrDependencies) { - return csrDependencies.multiRootTimeStampSyncContainer.size() * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); + return csrDependencies.multiRootTimeStampSyncContainer.size() * NEO::EncodeSempahore::getSizeMiSemaphoreWait(); } }; diff --git a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp index bb503603cb..7eb008c3e0 100644 --- a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp @@ -196,7 +196,8 @@ void MemorySynchronizationCommands::setAdditionalSynchronization(void *& gpuAddress, EncodeSempahore::invalidHardwareTag, MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, - false); + false, + true); commandsBuffer = ptrOffset(commandsBuffer, EncodeSempahore::getSizeMiSemaphoreWait()); } } diff --git a/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp b/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp index 87940e6865..e4e67b5320 100644 --- a/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/gfx_core_helper_xe_hpg_core.cpp @@ -87,9 +87,9 @@ size_t MemorySynchronizationCommands::getSizeForSingleAdditionalSynchron template <> void MemorySynchronizationCommands::addAdditionalSynchronizationForDirectSubmission(LinearStream &commandStream, uint64_t gpuAddress, bool acquire, const RootDeviceEnvironment &rootDeviceEnvironment) { - using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; + using COMPARE_OPERATION = typename Family::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; - EncodeSempahore::addMiSemaphoreWaitCommand(commandStream, gpuAddress, EncodeSempahore::invalidHardwareTag, MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); + EncodeSempahore::addMiSemaphoreWaitCommand(commandStream, gpuAddress, EncodeSempahore::invalidHardwareTag, COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); } template <> diff --git a/shared/test/unit_test/encoders/test_encode_semaphore.cpp b/shared/test/unit_test/encoders/test_encode_semaphore.cpp index b227a8c990..b2ec185d76 100644 --- a/shared/test/unit_test/encoders/test_encode_semaphore.cpp +++ b/shared/test/unit_test/encoders/test_encode_semaphore.cpp @@ -17,18 +17,28 @@ using CommandEncodeSemaphore = Test; HWTEST_F(CommandEncodeSemaphore, WhenProgrammingThenMiSemaphoreWaitIsUsed) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - MI_SEMAPHORE_WAIT miSemaphore; + MI_SEMAPHORE_WAIT miSemaphore1; - EncodeSempahore::programMiSemaphoreWait(&miSemaphore, + EncodeSempahore::programMiSemaphoreWait(&miSemaphore1, 0x123400, 4, MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, - false); + false, + true); - EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, miSemaphore.getCompareOperation()); - EXPECT_EQ(4u, miSemaphore.getSemaphoreDataDword()); - EXPECT_EQ(0x123400u, miSemaphore.getSemaphoreGraphicsAddress()); - EXPECT_EQ(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE, miSemaphore.getWaitMode()); + EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, miSemaphore1.getCompareOperation()); + EXPECT_EQ(4u, miSemaphore1.getSemaphoreDataDword()); + EXPECT_EQ(0x123400u, miSemaphore1.getSemaphoreGraphicsAddress()); + EXPECT_EQ(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE, miSemaphore1.getWaitMode()); + + MI_SEMAPHORE_WAIT miSemaphore2; + EncodeSempahore::programMiSemaphoreWait(&miSemaphore2, + 0x123400, + 4, + MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, + false, + false); + EXPECT_EQ(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_SIGNAL_MODE, miSemaphore2.getWaitMode()); } HWTEST_F(CommandEncodeSemaphore, whenAddingMiSemaphoreCommandThenExpectCompareFieldsAreSetCorrectly) { @@ -45,7 +55,7 @@ HWTEST_F(CommandEncodeSemaphore, whenAddingMiSemaphoreCommandThenExpectCompareFi 5u, compareMode); - EXPECT_EQ(sizeof(MI_SEMAPHORE_WAIT), stream.getUsed()); + EXPECT_EQ(NEO::EncodeSempahore::getSizeMiSemaphoreWait(), stream.getUsed()); HardwareParse hwParse; hwParse.parseCommands(stream); @@ -60,7 +70,7 @@ HWTEST_F(CommandEncodeSemaphore, whenAddingMiSemaphoreCommandThenExpectCompareFi HWTEST_F(CommandEncodeSemaphore, whenGettingMiSemaphoreCommandSizeThenExpectSingleMiSemaphoreCommandSize) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - size_t expectedSize = sizeof(MI_SEMAPHORE_WAIT); + size_t expectedSize = NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t actualSize = EncodeSempahore::getSizeMiSemaphoreWait(); EXPECT_EQ(expectedSize, actualSize); } diff --git a/shared/test/unit_test/encoders/test_implicit_scaling_xehp_and_later.cpp b/shared/test/unit_test/encoders/test_implicit_scaling_xehp_and_later.cpp index 9522c27aae..eb01da596e 100644 --- a/shared/test/unit_test/encoders/test_implicit_scaling_xehp_and_later.cpp +++ b/shared/test/unit_test/encoders/test_implicit_scaling_xehp_and_later.cpp @@ -434,12 +434,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(WALKER_TYPE) + sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) * 2 + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -502,12 +502,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, sizeof(WALKER_TYPE) + sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) * 2 + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -689,12 +689,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(WALKER_TYPE) + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) * 2 + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -755,7 +755,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, walker.setThreadGroupIdXDimension(32); size_t expectedSize = sizeof(WALKER_TYPE) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection); @@ -820,7 +820,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_LOAD_REGISTER_MEM) + sizeof(WALKER_TYPE) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection); @@ -882,15 +882,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, WALKER_TYPE walker = FamilyType::cmdInitGpgpuWalker; walker.setThreadGroupIdXDimension(32); - size_t expectedSize = sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + size_t expectedSize = sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(WALKER_TYPE) + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) * 2 + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -952,12 +952,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(WALKER_TYPE) + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::StaticPartitioningControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) * 2 + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -1006,7 +1006,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START; size_t expectedSize = sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection); @@ -1056,12 +1056,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -1110,12 +1110,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_ATOMIC) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_ATOMIC) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); DebugManager.flags.UseAtomicsForSelfCleanupSection.set(1); @@ -1165,7 +1165,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, MockExecutionEnvironment mockExecutionEnvironment{}; size_t expectedSize = MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection); @@ -1242,12 +1242,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_STORE_DATA_IMM) + MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -1326,12 +1326,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_ATOMIC) + MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_ATOMIC) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -1406,7 +1406,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, DebugManager.flags.ProgramWalkerPartitionSelfCleanup.set(0); size_t expectedSize = sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection); @@ -1460,12 +1460,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; @@ -1517,14 +1517,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, size_t expectedSize = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_START) + sizeof(WalkerPartition::BarrierControlSection) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) + + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + - sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT); + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); size_t estimatedSize = 0; size_t totalBytesProgrammed = 0; diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp index 079dac96e1..f918e34c93 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp @@ -127,7 +127,8 @@ HWTEST2_F(PipeControlHelperTestsDg2AndLater, WhenAddingPipeControlWAThenCorrectC EncodeSempahore::programMiSemaphoreWait(&expectedMiSemaphoreWait, address, EncodeSempahore::invalidHardwareTag, MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, - false); + false, + true); auto pMiSemaphoreWait = genCmdCast(*(++it)); ASSERT_NE(nullptr, pMiSemaphoreWait); EXPECT_TRUE(memcmp(&expectedMiSemaphoreWait, pMiSemaphoreWait, sizeof(MI_SEMAPHORE_WAIT)) == 0); diff --git a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp index 33e8c6102a..a41d0df425 100644 --- a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -1113,7 +1113,7 @@ HWTEST2_F(BlitTests, givenEnabledGlobalCacheInvalidationWhenProgrammingGlobalSeq uint32_t streamBuffer[100] = {}; LinearStream stream(streamBuffer, sizeof(streamBuffer)); - size_t expectedSize = sizeof(MI_LOAD_REGISTER_IMM) + sizeof(MI_SEMAPHORE_WAIT); + size_t expectedSize = sizeof(MI_LOAD_REGISTER_IMM) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); auto val = BlitCommandsHelper::getSizeForGlobalSequencerFlush(); EXPECT_EQ(expectedSize, val); diff --git a/shared/test/unit_test/helpers/timestamp_packet_tests.cpp b/shared/test/unit_test/helpers/timestamp_packet_tests.cpp index f3f4e14904..aeb9cde1f9 100644 --- a/shared/test/unit_test/helpers/timestamp_packet_tests.cpp +++ b/shared/test/unit_test/helpers/timestamp_packet_tests.cpp @@ -194,7 +194,7 @@ HWTEST_F(TimestampPacketTests, whenEstimatingSizeForNodeDependencyThenReturnCorr size_t sizeForNodeDependency = 0; sizeForNodeDependency += TimestampPacketHelper::getRequiredCmdStreamSizeForNodeDependency(mockNode); - size_t expectedSize = mockNode.getPacketsUsed() * sizeof(typename FamilyType::MI_SEMAPHORE_WAIT); + size_t expectedSize = mockNode.getPacketsUsed() * NEO::EncodeSempahore::getSizeMiSemaphoreWait(); EXPECT_EQ(expectedSize, sizeForNodeDependency); } @@ -315,7 +315,7 @@ HWTEST_F(TimestampPacketHelperTests, givenTagNodesInMultiRootSyncContainerWhenPr container.add(mockTagAllocator->getTag()); deps.multiRootTimeStampSyncContainer.push_back(&container); TimestampPacketHelper::programCsrDependenciesForForMultiRootDeviceSyncContainer(cmdStream, deps); - EXPECT_EQ(cmdStream.getUsed(), sizeof(typename FamilyType::MI_SEMAPHORE_WAIT)); + EXPECT_EQ(cmdStream.getUsed(), NEO::EncodeSempahore::getSizeMiSemaphoreWait()); } HWTEST_F(TimestampPacketHelperTests, givenEmptyContainerMultiRootSyncContainerWhenProgramingDependensiecThenZeroSemaforesAreProgrammed) { diff --git a/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp index 798b66fbd1..5be359bbdf 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/command_container/command_encoder.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/xe_hpc_core/hw_cmds_pvc.h" #include "shared/test/common/cmd_parse/hw_parse.h" @@ -60,17 +61,14 @@ PVCTEST_F(GfxCoreHelperTestsPvc, givenRevisionEnumAndPlatformFamilyTypeThenPrope } PVCTEST_F(GfxCoreHelperTestsPvc, givenDefaultMemorySynchronizationCommandsWhenGettingSizeForAdditionalSynchronizationThenCorrectValueIsReturned) { - using MI_SEMAPHORE_WAIT = typename XeHpcCoreFamily::MI_SEMAPHORE_WAIT; - - EXPECT_EQ(sizeof(MI_SEMAPHORE_WAIT), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); + EXPECT_EQ(NEO::EncodeSempahore::getSizeMiSemaphoreWait(), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); } PVCTEST_F(GfxCoreHelperTestsPvc, givenDebugMemorySynchronizationCommandsWhenGettingSizeForAdditionalSynchronizationThenCorrectValueIsReturned) { DebugManagerStateRestore restorer; DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(1); - using MI_SEMAPHORE_WAIT = typename XeHpcCoreFamily::MI_SEMAPHORE_WAIT; - EXPECT_EQ(2 * sizeof(MI_SEMAPHORE_WAIT), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); + EXPECT_EQ(2 * NEO::EncodeSempahore::getSizeMiSemaphoreWait(), MemorySynchronizationCommands::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())); } PVCTEST_F(GfxCoreHelperTestsPvc, givenRevisionIdWhenGetComputeUnitsUsedForScratchThenReturnValidValue) { @@ -141,7 +139,7 @@ PVCTEST_F(GfxCoreHelperTestsPvc, givenMemorySynchronizationCommandsWhenAddingSyn EXPECT_EQ(1u, hwParser.cmdList.size()); if (testInput.expectMiSemaphoreWait) { - EXPECT_EQ(sizeof(MI_SEMAPHORE_WAIT), synchronizationSize); + EXPECT_EQ(NEO::EncodeSempahore::getSizeMiSemaphoreWait(), synchronizationSize); auto semaphoreCmd = genCmdCast(*hwParser.cmdList.begin()); ASSERT_NE(nullptr, semaphoreCmd);