From b6b331fbe216fa91f232429d81a3e9d38d868d84 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Thu, 27 Apr 2023 20:58:30 +0000 Subject: [PATCH] fix: update unit tests for command list primary batch buffer Related-To: NEO-7807 Signed-off-by: Zbigniew Zdanowicz --- .../l0_gfx_core_helper_xe_hpc_core.cpp | 5 -- .../unit_tests/fixtures/cmdlist_fixture.cpp | 7 +++ .../unit_tests/fixtures/cmdlist_fixture.h | 6 +++ .../sources/cmdlist/test_cmdlist_1.cpp | 4 ++ .../sources/cmdlist/test_cmdlist_2.cpp | 3 ++ .../sources/cmdlist/test_cmdlist_6.cpp | 2 + .../test_cmdlist_append_event_reset.cpp | 3 +- .../test_cmdlist_append_launch_kernel_1.cpp | 4 ++ .../test_cmdlist_append_launch_kernel_2.cpp | 6 ++- .../test_cmdlist_append_wait_on_events.cpp | 3 +- .../cmdlist/test_cmdlist_xehp_and_later.cpp | 3 ++ .../sources/cmdqueue/test_cmdqueue_1.cpp | 54 +++++++++++++++++-- .../sources/cmdqueue/test_cmdqueue_2.cpp | 12 +++++ .../sources/cmdqueue/test_cmdqueue_3.cpp | 27 ++++++++-- .../test_cmdqueue_enqueue_cmdlist.cpp | 33 ++++++++---- .../test_cmdqueue_enqueue_cmdlist_2.cpp | 8 ++- .../sources/context/test_context.cpp | 3 ++ .../sources/debugger/test_l0_debugger_1.cpp | 6 +++ .../sources/debugger/test_l0_debugger_2.cpp | 6 ++- .../test_l0_debugger_sba_tracking.cpp | 15 ++++-- .../debugger/test_source_level_debugger.cpp | 10 +++- .../xe_hpc_core/test_cmdlist_xe_hpc_core.cpp | 5 +- .../xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp | 6 +++ .../xe_hpc_core_test_l0_fixtures.cpp | 3 +- .../xe_hpg_core/dg2/test_cmdlist_dg2.cpp | 1 + .../xe_hpg_core/test_cmdlist_xe_hpg_core.cpp | 1 + ...mdqueue_enqueuecommandlist_xe_hpg_core.cpp | 4 ++ 27 files changed, 205 insertions(+), 35 deletions(-) diff --git a/level_zero/core/source/xe_hpc_core/l0_gfx_core_helper_xe_hpc_core.cpp b/level_zero/core/source/xe_hpc_core/l0_gfx_core_helper_xe_hpc_core.cpp index 9f8a84a39e..3f6603f2d6 100644 --- a/level_zero/core/source/xe_hpc_core/l0_gfx_core_helper_xe_hpc_core.cpp +++ b/level_zero/core/source/xe_hpc_core/l0_gfx_core_helper_xe_hpc_core.cpp @@ -29,11 +29,6 @@ bool L0GfxCoreHelperHw::alwaysAllocateEventInLocalMem() const { return true; } -template <> -bool L0GfxCoreHelperHw::platformSupportsRayTracing() const { - return true; -} - template class L0GfxCoreHelperHw; } // namespace L0 diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp index b233052295..5807416348 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp @@ -265,6 +265,13 @@ void AppendFillFixture::tearDown() { void CommandListEventUsedPacketSignalFixture::setUp() { NEO::DebugManager.flags.SignalAllEventPackets.set(0); + NEO::DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + + CommandListFixture::setUp(); +} + +void CommandListSecondaryBatchBufferFixture::setUp() { + NEO::DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); CommandListFixture::setUp(); } diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h index 6ec423aac3..bb94e7917c 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h @@ -239,6 +239,12 @@ struct CommandListEventUsedPacketSignalFixture : public CommandListFixture { DebugManagerStateRestore restorer; }; +struct CommandListSecondaryBatchBufferFixture : public CommandListFixture { + void setUp(); + + DebugManagerStateRestore restorer; +}; + struct TbxImmediateCommandListFixture : public ModuleMutableCommandListFixture { using EventFieldType = uint64_t; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index 57cbb2496a..7ce48da651 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -2064,6 +2064,8 @@ TEST_F(CommandListCreate, givenInvalidProductFamilyThenReturnsNullPointer) { HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenCommandListIsCreatedThenPCAndStateBaseAddressCmdsAreAddedAndCorrectlyProgrammed) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.UseBindlessMode.set(0); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; @@ -2120,6 +2122,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenCommandListIsCreatedThenPCAnd HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenBindlessModeEnabledWhenCommandListIsCreatedThenStateBaseAddressCmdsIsNotAdded) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.UseBindlessMode.set(1); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index f37e06058f..a021835f92 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -1313,6 +1313,9 @@ HWTEST2_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAnd using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; + DebugManagerStateRestore restorer; + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + uint64_t size = 1024; ze_result_t res = ZE_RESULT_SUCCESS; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index 3aa78b4ad5..8026525a22 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -1009,6 +1009,8 @@ HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest, givenGlobalStatelessWh auto ultCsr = static_cast *>(commandListImmediate->csr); ultCsr->storeMakeResidentAllocations = true; + commandList->close(); + ze_command_list_handle_t cmdListHandle = commandList->toHandle(); auto result = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp index a2e5f23817..916f052d92 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp @@ -25,6 +25,7 @@ namespace ult { using CommandListAppendEventReset = Test; using CommandListAppendUsedPacketSignalEvent = Test; +using CommandListAppendEventResetSecondaryBatchBuffer = Test; HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventAppendedThenStoreDataImmIsGenerated) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; @@ -126,7 +127,7 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventWithTimeStampIsA EXPECT_EQ(1u, postSyncFound); } -HWTEST_F(CommandListAppendEventReset, whenResetEventIsAppendedAndNoSpaceIsAvailableThenNextCommandBufferIsCreated) { +HWTEST_F(CommandListAppendEventResetSecondaryBatchBuffer, whenResetEventIsAppendedAndNoSpaceIsAvailableThenNextCommandBufferIsCreated) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index ba3aacb3e5..2e66b04a77 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -159,6 +159,10 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenAppendingKernelThenBbEndIsAddedAndNewCmdBufferAllocated, IsAtLeastSkl) { using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; + + DebugManagerStateRestore restorer; + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + createKernel(); ze_result_t returnValue; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp index b8b7cd0fa1..6902d16b9c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp @@ -1487,7 +1487,11 @@ HWTEST2_F(MultiTileCommandListAppendLaunchKernelXeHpCoreTest, auto itorBbStart = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itorBbStart); auto cmdBbStart = genCmdCast(*itorBbStart); - EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_SECOND_LEVEL_BATCH, cmdBbStart->getSecondLevelBatchBuffer()); + if (commandList->dispatchCmdListBatchBufferAsPrimary) { + EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, cmdBbStart->getSecondLevelBatchBuffer()); + } else { + EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_SECOND_LEVEL_BATCH, cmdBbStart->getSecondLevelBatchBuffer()); + } } } // namespace ult 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 e1773b532d..10f9b847c4 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 @@ -26,6 +26,7 @@ namespace ult { using CommandListAppendWaitOnEvent = Test; using CommandListAppendWaitOnUsedPacketSignalEvent = Test; +using CommandListAppendWaitOnSecondaryBatchBufferEvent = Test; HWTEST_F(CommandListAppendWaitOnEvent, WhenAppendingWaitOnEventThenSemaphoreWaitCmdIsGenerated) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; @@ -521,7 +522,7 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenCommandListWhenAppendWriteGlobalTim ASSERT_TRUE(postSyncFound); } -HWTEST_F(CommandListAppendWaitOnEvent, givenCommandBufferIsEmptyWhenAppendingWaitOnEventThenAllocateNewCommandBuffer) { +HWTEST_F(CommandListAppendWaitOnSecondaryBatchBufferEvent, givenCommandBufferIsEmptyWhenAppendingWaitOnEventThenAllocateNewCommandBuffer) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp index b06cadbec8..e8dff26a7b 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp @@ -33,6 +33,7 @@ using CommandListTests = Test; HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAndStateBaseAddressCmdsAreAddedAndCorrectlyProgrammed) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.EnableStateBaseAddressTracking.set(0); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; @@ -96,6 +97,7 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro DebugManagerStateRestore restorer; DebugManager.flags.EnableStateBaseAddressTracking.set(0); DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(1); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); @@ -164,6 +166,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, MultiTileCommandListTests, givenPartitionedCommandL DebugManagerStateRestore dbgRestorer; DebugManager.flags.EnableStateBaseAddressTracking.set(0); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index b80861d2aa..0d323b06fd 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -310,6 +310,9 @@ HWTEST_F(CommandQueueCreate, given100CmdListsWhenExecutingThenCommandStreamIsNot using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + const ze_command_queue_desc_t desc = {}; ze_result_t returnValue; auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, @@ -332,6 +335,8 @@ HWTEST_F(CommandQueueCreate, given100CmdListsWhenExecutingThenCommandStreamIsNot CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchKernelArguments, nullptr, 0, nullptr, launchParams, false); + commandList->close(); + const size_t numHandles = 100; ze_command_list_handle_t cmdListHandles[numHandles]; for (size_t i = 0; i < numHandles; i++) { @@ -382,6 +387,7 @@ HWTEST2_F(CommandQueueCreate, givenLogicalStateHelperWhenExecutingThenMergeState ze_group_count_t dispatchKernelArguments{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchKernelArguments, nullptr, 0, nullptr, launchParams, false); + commandList->close(); ze_command_list_handle_t cmdListHandles = commandList->toHandle(); @@ -406,7 +412,7 @@ HWTEST2_F(CommandQueueCreate, givenLogicalStateHelperAndImmediateCmdListWhenExec &desc, false, false, - false, + true, returnValue)); auto ultCsr = static_cast *>(commandQueue->getCsr()); ultCsr->logicalStateHelper.reset(mockCsrLogicalStateHelper); @@ -446,6 +452,7 @@ HWTEST2_F(CommandQueueCreate, givenOutOfHostMemoryErrorFromSubmitBatchBufferWhen ze_group_count_t dispatchFunctionArguments{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr, launchParams, false); + commandList->close(); ze_command_list_handle_t cmdListHandles[1] = {commandList->toHandle()}; @@ -469,6 +476,7 @@ HWTEST2_F(CommandQueueCreate, givenGpuHangInReservingLinearStreamWhenExecutingCo ze_group_count_t dispatchKernelArguments{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchKernelArguments, nullptr, 0, nullptr, launchParams, false); + commandList->close(); ze_command_list_handle_t cmdListHandles[1] = {commandList->toHandle()}; @@ -536,7 +544,7 @@ HWTEST2_F(CommandQueueCreate, GivenDispatchTaskCountPostSyncRequiredWhenExecuteC auto commandList = std::unique_ptr(whiteboxCast( CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); ASSERT_NE(nullptr, commandList); - + commandList->close(); ze_command_list_handle_t cmdListHandle = commandList->toHandle(); commandQueue->dispatchTaskCountPostSyncRequired = false; commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); @@ -574,6 +582,7 @@ HWTEST_F(CommandQueueCreate, givenUpdateTaskCountFromWaitAndRegularCmdListWhenDi auto commandList = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); ASSERT_NE(nullptr, commandList); + commandList->close(); ze_command_list_handle_t cmdListHandle = commandList->toHandle(); commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); @@ -610,7 +619,7 @@ HWTEST_F(CommandQueueCreate, givenUpdateTaskCountFromWaitAndImmediateCmdListWhen &desc, false, false, - false, + true, returnValue)); auto commandList = CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue); @@ -797,6 +806,7 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingNonCopyBlitComm std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); ASSERT_NE(nullptr, commandList); + commandList->close(); auto commandListHandle = commandList->toHandle(); auto status = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); @@ -821,6 +831,7 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommand std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); ASSERT_NE(nullptr, commandList); + commandList->close(); auto commandListHandle = commandList->toHandle(); auto status = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); @@ -1176,6 +1187,7 @@ HWTEST2_F(ExecuteCommandListTests, givenExecuteCommandListWhenItReturnsThenConta commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); commandList->setCommandListPerThreadScratchSize(100u); auto commandListHandle = commandList->toHandle(); + commandList->close(); void *alloc = alignedMalloc(0x100, 0x100); NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u); @@ -1215,6 +1227,7 @@ HWTEST2_F(ExecuteCommandListTests, givenOutOfMemorySubmitBatchBufferThenExecuteC auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, res); @@ -1234,6 +1247,7 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithSshAndScratchW commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); commandList->setCommandListPerThreadScratchSize(100u); auto commandListHandle = commandList->toHandle(); + commandList->close(); void *alloc = alignedMalloc(0x100, 0x100); NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u); @@ -1260,6 +1274,7 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithSshAndPrivateS commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); commandList->setCommandListPerThreadPrivateScratchSize(100u); auto commandListHandle = commandList->toHandle(); + commandList->close(); void *alloc = alignedMalloc(0x100, 0x100); NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u); @@ -1290,6 +1305,7 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithWhenBindlessEn commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); commandList->setCommandListPerThreadScratchSize(100u); auto commandListHandle = commandList->toHandle(); + commandList->close(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); @@ -1309,6 +1325,7 @@ HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenExecuteComma auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, res); @@ -1330,6 +1347,7 @@ HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenResetGraphic auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); void *alloc = alignedMalloc(0x100, 0x100); NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u); @@ -1360,6 +1378,7 @@ HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenResetGraphic auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); void *alloc = alignedMalloc(0x100, 0x100); NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u); @@ -1388,6 +1407,8 @@ HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenWaitForCompl auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); + TaskCountType flushedTaskCountPrior = csr->peekTaskCount(); csr->setLatestFlushedTaskCount(flushedTaskCountPrior); auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); @@ -1409,6 +1430,7 @@ HWTEST2_F(ExecuteCommandListTests, givenSuccessfulSubmitBatchBufferThenExecuteCo auto commandList = new CommandListCoreFamily(); commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); EXPECT_EQ(ZE_RESULT_SUCCESS, res); @@ -1437,7 +1459,9 @@ HWTEST2_F(ExecuteCommandListTests, givenCommandQueueHavingTwoB2BCommandListsThen commandList1->initialize(device, NEO::EngineGroupType::Compute, 0u); commandList1->setCommandListPerThreadScratchSize(0u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); EXPECT_EQ(true, csr->getMediaVFEStateDirty()); EXPECT_EQ(true, csr->getGSBAStateDirty()); @@ -1474,7 +1498,9 @@ HWTEST2_F(ExecuteCommandListTests, givenCommandQueueHavingTwoB2BCommandListsThen auto commandList1 = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); commandList1->setCommandListPerThreadScratchSize(0u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); ASSERT_NE(nullptr, commandQueue); @@ -1516,7 +1542,9 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->setCommandListPerThreadScratchSize(512u); commandList1->setCommandListPerThreadScratchSize(0u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); commandQueue->executeCommandLists(1, &commandListHandle0, nullptr, false); EXPECT_EQ(512u, csr->getScratchSpaceController()->getPerThreadScratchSpaceSize()); @@ -1537,8 +1565,10 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->reset(); commandList0->setCommandListPerThreadScratchSize(0u); + commandList0->close(); commandList1->reset(); commandList1->setCommandListPerThreadScratchSize(0u); + commandList1->close(); auto commandQueue1 = whiteboxCast(CommandQueue::create(productFamily, device, @@ -1590,7 +1620,9 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->setCommandListPerThreadScratchSize(0u); commandList1->setCommandListPerThreadScratchSize(512u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); commandQueue->executeCommandLists(1, &commandListHandle0, nullptr, false); EXPECT_EQ(0u, csr->getScratchSpaceController()->getPerThreadScratchSpaceSize()); @@ -1611,8 +1643,10 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->reset(); commandList0->setCommandListPerThreadScratchSize(512u); + commandList0->close(); commandList1->reset(); commandList1->setCommandListPerThreadScratchSize(0u); + commandList1->close(); auto commandQueue1 = whiteboxCast(CommandQueue::create(productFamily, device, @@ -1664,7 +1698,9 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->setCommandListPerThreadScratchSize(512u); commandList1->setCommandListPerThreadScratchSize(512u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); commandQueue->executeCommandLists(1, &commandListHandle0, nullptr, false); EXPECT_EQ(512u, csr->getScratchSpaceController()->getPerThreadScratchSpaceSize()); @@ -1685,8 +1721,10 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->reset(); commandList0->setCommandListPerThreadScratchSize(1024u); + commandList0->close(); commandList1->reset(); commandList1->setCommandListPerThreadScratchSize(1024u); + commandList1->close(); auto commandQueue1 = whiteboxCast(CommandQueue::create(productFamily, device, @@ -1738,7 +1776,9 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->setCommandListPerThreadScratchSize(0u); commandList1->setCommandListPerThreadScratchSize(512u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); commandQueue->executeCommandLists(1, &commandListHandle0, nullptr, false); EXPECT_EQ(0u, csr->getScratchSpaceController()->getPerThreadScratchSpaceSize()); @@ -1759,8 +1799,10 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->reset(); commandList0->setCommandListPerThreadScratchSize(1024u); + commandList0->close(); commandList1->reset(); commandList1->setCommandListPerThreadScratchSize(2048u); + commandList1->close(); auto commandQueue1 = whiteboxCast(CommandQueue::create(productFamily, device, @@ -1810,7 +1852,9 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->setCommandListPerThreadPrivateScratchSize(0u); commandList1->setCommandListPerThreadPrivateScratchSize(512u); auto commandListHandle0 = commandList0->toHandle(); + commandList0->close(); auto commandListHandle1 = commandList1->toHandle(); + commandList1->close(); commandQueue->executeCommandLists(1, &commandListHandle0, nullptr, false); EXPECT_EQ(0u, csr->getScratchSpaceController()->getPerThreadPrivateScratchSize()); @@ -1829,8 +1873,10 @@ HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandLists commandList0->reset(); commandList0->setCommandListPerThreadPrivateScratchSize(1024u); + commandList0->close(); commandList1->reset(); commandList1->setCommandListPerThreadPrivateScratchSize(2048u); + commandList1->close(); auto commandQueue1 = whiteboxCast(CommandQueue::create(productFamily, device, @@ -1877,6 +1923,7 @@ HWTEST_F(ExecuteCommandListTests, givenDirectSubmissionEnabledWhenExecutingCmdLi auto commandList = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); commandList->setCommandListPerThreadPrivateScratchSize(0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); @@ -1920,6 +1967,7 @@ HWTEST_F(ExecuteCommandListTests, givenDirectSubmissionEnabledAndDebugFlagSetWhe auto commandList = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); commandList->setCommandListPerThreadPrivateScratchSize(0u); auto commandListHandle = commandList->toHandle(); + commandList->close(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp index 940f91f373..1fc5b42d82 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp @@ -129,6 +129,8 @@ HWTEST_TEMPLATED_F(AubCsrTest, givenAubCsrWhenCallingExecuteCommandListsThenPoll ASSERT_NE(nullptr, commandList); auto commandListHandle = commandList->toHandle(); + commandList->close(); + queue->executeCommandLists(1, &commandListHandle, nullptr, false); EXPECT_EQ(aubCsr->pollForCompletionCalled, 1u); @@ -324,6 +326,8 @@ HWTEST2_F(MultiTileCommandQueueSynchronizeTest, givenMultiplePartitionCountWhenC commandList->partitionCount = 2; ze_command_list_handle_t cmdListHandle = commandList->toHandle(); + commandList->close(); + returnValue = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); @@ -364,6 +368,8 @@ HWTEST2_F(MultiTileCommandQueueSynchronizeTest, givenCsrHasMultipleActivePartiti ASSERT_NE(nullptr, commandList); ze_command_list_handle_t cmdListHandle = commandList->toHandle(); + commandList->close(); + commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); @@ -393,6 +399,8 @@ HWTEST_F(CommandQueueSynchronizeTest, givenSingleTileCsrWhenExecutingMultiTileCo commandList->partitionCount = 2; ze_command_list_handle_t cmdListHandle = commandList->toHandle(); + commandList->close(); + returnValue = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); EXPECT_EQ(returnValue, ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE); @@ -443,6 +451,7 @@ HWTEST_F(CommandQueueSynchronizeTest, givenSynchronousCommandQueueWhenTagUpdateF DebugManagerStateRestore restore; NEO::DebugManager.flags.UpdateTaskCountFromWait.set(3); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); size_t expectedSize = sizeof(MI_BATCH_BUFFER_START); if (neoDevice->getDefaultEngine().commandStreamReceiver->isAnyDirectSubmissionEnabled()) { @@ -473,6 +482,8 @@ HWTEST_F(CommandQueueSynchronizeTest, givenSynchronousCommandQueueWhenTagUpdateF // 1st execute provides all preamble commands ze_command_list_handle_t cmdListHandle = commandList->toHandle(); + commandList->close(); + returnValue = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, false); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); @@ -757,6 +768,7 @@ HWTEST2_F(DeviceWithDualStorage, givenCmdListWithAppendedKernelAndUsmTransferAnd CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchKernelArguments, nullptr, 0, nullptr, launchParams, false); auto deviceImp = static_cast(device); + commandList->close(); auto pageFaultCmdQueue = whiteboxCast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp index 2fcaf03f8f..93eae8df4c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp @@ -282,6 +282,8 @@ HWTEST_F(CommandQueueCommandsSingleTile, givenCommandQueueWhenExecutingCommandLi std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + auto status = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); auto globalFence = csr.getGlobalFenceAllocation(); @@ -312,6 +314,8 @@ HWTEST_F(CommandQueueCommandsSingleTile, givenCommandQueueWhenExecutingCommandLi std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + auto status = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); auto kernelArgsBufferAllocation = csr.getKernelArgsBufferAllocation(); @@ -357,6 +361,8 @@ HWTEST2_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenExecuti ASSERT_NE(nullptr, commandQueue); std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); + commandList->close(); + auto commandListHandle = commandList->toHandle(); auto workPartitionAllocation = csr.getWorkPartitionAllocation(); csr.expectedGa = workPartitionAllocation; @@ -446,7 +452,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDebugModeToTreatIndirectAllocatio std::end(commandList->getCmdContainer().getResidencyContainer()), gpuAlloc); EXPECT_EQ(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); - + commandList->close(); auto commandListHandle = commandList->toHandle(); EXPECT_FALSE(gpuAlloc->isResident(csr.getOsContext().getContextId())); @@ -510,7 +516,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir std::end(commandList->getCmdContainer().getResidencyContainer()), gpuAlloc); EXPECT_EQ(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); - + commandList->close(); auto commandListHandle = commandList->toHandle(); EXPECT_FALSE(gpuAlloc->isResident(csr.getOsContext().getContextId())); @@ -710,7 +716,7 @@ HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWhenExecu auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, l0Device, csr, &desc, false, false, false, returnValue)); auto commandList = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, l0Device, NEO::EngineGroupType::Compute, 0u, returnValue))); auto commandListHandle = commandList->toHandle(); - + commandList->close(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); GenCmdList cmdList; @@ -761,7 +767,7 @@ HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWithFabri auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, l0Device, csr, &desc, false, false, false, returnValue)); auto commandList = std::unique_ptr(whiteboxCast(CommandList::create(productFamily, l0Device, NEO::EngineGroupType::Compute, 0u, returnValue))); auto commandListHandle = commandList->toHandle(); - + commandList->close(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); GenCmdList cmdList; @@ -804,6 +810,8 @@ HWTEST2_F(CommandQueueIndirectAllocations, givenCtxWithIndirectAccessWhenExecuti ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); auto cmdListHandle = commandList->toHandle(); + commandList->close(); + auto ctx = typename MockCommandQueueHandleIndirectAllocs::CommandListExecutionContext{&cmdListHandle, 1, csr->getPreemptionMode(), @@ -826,6 +834,7 @@ HWTEST2_F(CommandQueueIndirectAllocations, givenCtxWitNohIndirectAccessWhenExecu commandQueue->initialize(false, false, false); ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); + commandList->close(); auto cmdListHandle = commandList.get()->toHandle(); auto ctx = typename MockCommandQueueHandleIndirectAllocs::CommandListExecutionContext{&cmdListHandle, @@ -1083,6 +1092,7 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron CmdListKernelLaunchParams launchParams = {}; commandListA->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, launchParams); + commandListA->close(); auto commandListBB = std::make_unique>>(); commandListBB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); @@ -1090,6 +1100,7 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron launchParams.isCooperative = true; commandListBB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); commandListBB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); + commandListBB->close(); auto commandListAB = std::make_unique>>(); commandListAB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); @@ -1099,6 +1110,7 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron launchParams.isCooperative = true; commandListAB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); + commandListAB->close(); auto commandListBA = std::make_unique>>(); commandListBA->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); @@ -1106,6 +1118,7 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron launchParams.isCooperative = false; commandListBA->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, launchParams); + commandListBA->close(); auto commandListBAB = std::make_unique>>(); commandListBAB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); @@ -1118,6 +1131,7 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron launchParams.isCooperative = true; commandListBAB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); + commandListBAB->close(); auto commandListAAB = std::make_unique>>(); commandListAAB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); @@ -1128,9 +1142,11 @@ HWTEST2_F(CommandQueueTest, whenExecuteCommandListsIsCalledThenCorrectSizeOfFron launchParams.isCooperative = true; commandListAAB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); + commandListAAB->close(); auto commandListEmpty = std::make_unique>>(); commandListEmpty->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); + commandListEmpty->close(); size_t singleFrontEndCmdSize = commandQueue->estimateFrontEndCmdSize(); @@ -1226,6 +1242,7 @@ HWTEST2_F(CommandQueueTest, givenRegularKernelScheduledAsCooperativeWhenExecuteC CmdListKernelLaunchParams launchParams = {}; launchParams.isCooperative = true; commandList->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, launchParams); + commandList->close(); EXPECT_EQ(-1, csr->getStreamProperties().frontEndState.computeDispatchAllWalkerEnable.value); @@ -1269,12 +1286,14 @@ HWTEST2_F(CommandQueueTest, givenTwoCommandQueuesUsingOneCsrWhenExecuteCommandLi CmdListKernelLaunchParams launchParams = {}; commandListA->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, launchParams); + commandListA->close(); auto commandListB = std::make_unique>>(); commandListB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); launchParams.isCooperative = true; commandListB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, launchParams); + commandListB->close(); ze_command_list_handle_t commandListsA[] = {commandListA->toHandle()}; ze_command_list_handle_t commandListsB[] = {commandListB->toHandle()}; diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp index 5bb0fb8702..003beed6de 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp @@ -29,8 +29,10 @@ namespace L0 { namespace ult { -struct CommandQueueExecuteCommandLists : public Test { - void SetUp() override { +struct CommandQueueExecuteCommandListsFixture : DeviceFixture { + void setUp() { + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + DeviceFixture::setUp(); ze_result_t returnValue; @@ -43,7 +45,7 @@ struct CommandQueueExecuteCommandLists : public Test { EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); } - void TearDown() override { + void tearDown() { auto tagAddress = device->getNEODevice()->getDefaultEngine().commandStreamReceiver->getTagAddress(); *tagAddress = std::numeric_limits::max(); @@ -58,13 +60,19 @@ struct CommandQueueExecuteCommandLists : public Test { template void twoCommandListCommandPreemptionTest(bool preemptionCmdProgramming); + DebugManagerStateRestore restorer; + const static uint32_t numCommandLists = 2; ze_command_list_handle_t commandLists[numCommandLists]; }; -struct MultiDeviceCommandQueueExecuteCommandLists : public Test { - void SetUp() override { +using CommandQueueExecuteCommandLists = Test; + +struct MultiDeviceCommandQueueExecuteCommandListsFixture : public MultiDeviceFixture { + void setUp() { DebugManager.flags.EnableWalkerPartition.set(1); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); + numRootDevices = 1u; MultiDeviceFixture::setUp(); @@ -86,7 +94,7 @@ struct MultiDeviceCommandQueueExecuteCommandLists : public TestgetPartitionCount()); } - void TearDown() override { + void tearDown() { for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(commandLists[i]); commandList->destroy(); @@ -100,6 +108,8 @@ struct MultiDeviceCommandQueueExecuteCommandLists : public Test; + HWTEST_F(CommandQueueExecuteCommandLists, whenACommandListExecutedRequiresUncachedMOCSThenSuccessisReturned) { using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; @@ -660,7 +670,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsImplicitScalingDisabled, givenCommandLi } template -void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool preemptionCmdProgramming) { +void CommandQueueExecuteCommandListsFixture::twoCommandListCommandPreemptionTest(bool preemptionCmdProgramming) { ze_command_queue_desc_t desc = {}; desc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; @@ -1002,9 +1012,10 @@ HWTEST_F(CommandQueueExecuteCommandLists, GivenCopyCommandQueueWhenExecutingCopy commandQueue->destroy(); } -struct CommandQueueExecuteCommandListSWTagsTests : public Test { - void SetUp() override { +struct CommandQueueExecuteCommandListSWTagsTestsFixture : public DeviceFixture { + void setUp() { DebugManager.flags.EnableSWTags.set(true); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); DeviceFixture::setUp(); ze_result_t returnValue; @@ -1025,7 +1036,7 @@ struct CommandQueueExecuteCommandListSWTagsTests : public Test { ASSERT_NE(nullptr, commandQueue); } - void TearDown() override { + void tearDown() { commandQueue->destroy(); for (auto i = 0u; i < numCommandLists; i++) { @@ -1042,6 +1053,8 @@ struct CommandQueueExecuteCommandListSWTagsTests : public Test { L0::ult::CommandQueue *commandQueue; }; +using CommandQueueExecuteCommandListSWTagsTests = Test; + HWTEST_F(CommandQueueExecuteCommandListSWTagsTests, givenEnableSWTagsWhenExecutingCommandListThenHeapAddressesAreInserted) { using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; using PARSE = typename FamilyType::PARSE; diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp index 8019d5a441..dc16beee95 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp @@ -32,6 +32,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, GivenSynchronousModeWhenExe ze_result_t returnValue; ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; + CommandList::fromHandle(commandLists[0])->close(); mockCmdQ->executeCommandLists(1, commandLists, nullptr, true); EXPECT_EQ(mockCmdQ->synchronizedCalled, 1u); CommandList::fromHandle(commandLists[0])->destroy(); @@ -49,7 +50,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, GivenSynchronousModeAndDevi ze_result_t returnValue; ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; - + CommandList::fromHandle(commandLists[0])->close(); const auto result = mockCmdQ->executeCommandLists(1, commandLists, nullptr, true); EXPECT_EQ(mockCmdQ->synchronizedCalled, 1u); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, result); @@ -66,6 +67,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, GivenAsynchronousModeWhenEx ze_result_t returnValue; ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; + CommandList::fromHandle(commandLists[0])->close(); mockCmdQ->executeCommandLists(1, commandLists, nullptr, true); EXPECT_EQ(mockCmdQ->synchronizedCalled, 0u); CommandList::fromHandle(commandLists[0])->destroy(); @@ -93,6 +95,8 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, whenUsingFenceThenLastPipeC CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle(), CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + CommandList::fromHandle(commandLists[0])->close(); + CommandList::fromHandle(commandLists[1])->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, fenceHandle, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -143,6 +147,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, givenTwoCommandQueuesUsingS ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandQueue); + CommandList::fromHandle(commandList)->close(); auto usedSpaceBefore = commandQueue->commandStream.getUsed(); returnValue = commandQueue->executeCommandLists(1, &commandList, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); @@ -205,6 +210,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, givenTwoCommandQueuesUsingS ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandQueue); + CommandList::fromHandle(commandList)->close(); auto usedSpaceBefore = commandQueue->commandStream.getUsed(); returnValue = commandQueue->executeCommandLists(1, &commandList, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); diff --git a/level_zero/core/test/unit_tests/sources/context/test_context.cpp b/level_zero/core/test/unit_tests/sources/context/test_context.cpp index b4c1cfe255..40893760b8 100644 --- a/level_zero/core/test/unit_tests/sources/context/test_context.cpp +++ b/level_zero/core/test/unit_tests/sources/context/test_context.cpp @@ -626,6 +626,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, res); @@ -728,6 +729,8 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); EXPECT_EQ(ZE_RESULT_SUCCESS, res); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 6d6b364f93..06abc6a4ea 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -99,6 +99,10 @@ HWTEST_F(L0DebuggerPerContextAddressSpaceTest, givenDebuggingEnabledWhenCommandL ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + for (auto i = 0u; i < numCommandLists; i++) { + auto commandList = CommandList::fromHandle(commandLists[i]); + commandList->close(); + } auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -449,6 +453,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionEnabledForRegularCo auto commandList = CommandList::fromHandle(commandLists[0]); result = commandList->appendMemoryFill(dstPtr, reinterpret_cast(&pattern), sizeof(pattern), 4096u, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); + commandList->close(); result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -484,6 +489,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledForRegularC auto commandList = CommandList::fromHandle(commandLists[0]); result = commandList->appendMemoryFill(dstPtr, reinterpret_cast(&pattern), sizeof(pattern), 4096u, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); + commandList->close(); result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp index 24443bfcde..911844d0cc 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp @@ -368,6 +368,7 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenUseCsrImmediateSubmissionEnabledForReg auto commandList = CommandList::fromHandle(commandLists[0]); auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); + commandList->close(); result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -437,12 +438,13 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenInternalCmdQIsUsed ze_command_queue_desc_t queueDesc = {}; std::unique_ptr, Deleter> commandQueue(new MockCommandQueueHw(device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc)); - commandQueue->initialize(false, true, false); + commandQueue->initialize(false, true, true); EXPECT_TRUE(commandQueue->internalUsage); ze_result_t returnValue; ze_command_list_handle_t commandLists[] = { CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -472,7 +474,6 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenInternalCmdQIsUsed EXPECT_EQ(0u, getMockDebuggerL0Hw()->captureStateBaseAddressCount); EXPECT_EQ(0u, getMockDebuggerL0Hw()->getSbaTrackingCommandsSizeCount); - auto commandList = CommandList::fromHandle(commandLists[0]); commandList->destroy(); } @@ -505,6 +506,7 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenCommandListIsExecut char dest[8]; auto result = commandList->appendMemoryCopy(dest, src, 8, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); + commandList->close(); result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp index f9fd1a97ca..0577b764ea 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp @@ -139,6 +139,7 @@ HWTEST2_F(L0DebuggerPerContextAddressSpaceTest, givenDebuggingEnabledAndRequired ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; CommandList::fromHandle(commandLists[0])->setCommandListPerThreadScratchSize(4096); + CommandList::fromHandle(commandLists[0])->close(); uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); @@ -190,6 +191,8 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledAndDebuggerLogsWhenCommandQueueIs ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; const uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); + commandList->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -203,7 +206,6 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledAndDebuggerLogsWhenCommandQueueIs pos = output.find("Debugger: SBA ssh"); EXPECT_NE(std::string::npos, pos); - auto commandList = CommandList::fromHandle(commandLists[0]); commandList->destroy(); commandQueue->destroy(); @@ -226,6 +228,8 @@ HWTEST2_F(L0DebuggerSimpleTest, givenNullL0DebuggerAndDebuggerLogsWhenCommandQue ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; const uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); + commandList->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -236,7 +240,6 @@ HWTEST2_F(L0DebuggerSimpleTest, givenNullL0DebuggerAndDebuggerLogsWhenCommandQue size_t pos = output.find("Debugger: SBA"); EXPECT_EQ(std::string::npos, pos); - auto commandList = CommandList::fromHandle(commandLists[0]); commandList->destroy(); commandQueue->destroy(); @@ -257,6 +260,8 @@ HWTEST2_F(L0DebuggerTest, givenL0DebuggerAndDebuggerLogsDisabledWhenCommandQueue ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; const uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); + commandList->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -267,7 +272,6 @@ HWTEST2_F(L0DebuggerTest, givenL0DebuggerAndDebuggerLogsDisabledWhenCommandQueue size_t pos = output.find("Debugger: SBA"); EXPECT_EQ(std::string::npos, pos); - auto commandList = CommandList::fromHandle(commandLists[0]); commandList->destroy(); commandQueue->destroy(); @@ -316,6 +320,8 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenCommandListIsExecutedThenSbaB ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); + commandList->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -330,7 +336,6 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenCommandListIsExecutedThenSbaB } EXPECT_TRUE(sbaFound); - auto commandList = CommandList::fromHandle(commandLists[0]); commandList->destroy(); } @@ -392,6 +397,8 @@ HWTEST2_F(L0DebuggerSingleAddressSpace, givenDebuggingEnabledWhenCommandListIsEx ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + auto commandList = CommandList::fromHandle(commandLists[0]); + commandList->close(); auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp index 45ab1083b8..5470359b32 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp @@ -39,6 +39,10 @@ HWTEST2_F(CommandQueueDebugCommandsTest, givenDebuggingEnabledWhenCommandListIsE ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, deviceL0, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + for (auto i = 0u; i < numCommandLists; i++) { + auto commandList = CommandList::fromHandle(commandLists[i]); + commandList->close(); + } auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -88,6 +92,10 @@ HWTEST2_F(CommandQueueDebugCommandsTest, givenDebuggingEnabledWhenCommandListIsE ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, deviceL0, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + for (auto i = 0u; i < numCommandLists; i++) { + auto commandList = CommandList::fromHandle(commandLists[i]); + commandList->close(); + } auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -168,7 +176,7 @@ HWTEST2_F(SLDebuggerInternalUsageTest, givenDebuggingEnabledWhenInternalCmdQIsUs device->setPreemptionMode(NEO::PreemptionMode::Disabled); std::unique_ptr, Deleter> commandQueue(new MockCommandQueueHw(deviceL0, device->getDefaultEngine().commandStreamReceiver, &queueDesc)); - commandQueue->initialize(false, true, false); + commandQueue->initialize(false, true, true); EXPECT_TRUE(commandQueue->internalUsage); ze_result_t returnValue; ze_command_list_handle_t commandLists[] = { diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp index 68974f374f..168ba2f139 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp @@ -140,6 +140,8 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenForceMemoryPrefetchForKmdMigra ze_command_list_handle_t commandListHandle = CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle(); auto commandList = CommandList::fromHandle(commandListHandle); + commandList->close(); + auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, false, returnValue); result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, true); @@ -425,6 +427,7 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr CmdListKernelLaunchParams launchParams = {}; result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); + commandList->close(); result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, true); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -463,7 +466,7 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr ze_command_list_handle_t commandListHandle = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)->toHandle(); auto commandList = CommandList::fromHandle(commandListHandle); - auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, false, returnValue); + auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, true, returnValue); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp index 146c1287a1..d61b9f3462 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp @@ -40,6 +40,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenCommandQueueWhenExecutingCommandListsT ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); auto globalFence = csr.getGlobalFenceAllocation(); @@ -66,6 +68,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenCommandQueueWhenExecutingCommandListsT ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); auto globalFence = csr->getGlobalFenceAllocation(); @@ -95,6 +99,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenCommandQueueWhenExecutingCommandListsF ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); auto commandListHandle = commandList->toHandle(); + commandList->close(); + commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); auto usedSpaceAfter1stExecute = commandQueue->commandStream.getUsed(); commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false); diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.cpp index f518f5c534..8b7072408b 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -80,6 +80,7 @@ void CommandListStatePrefetchXeHpcCore::checkIfCommandBufferIsExhaustedWhenPrefe using MI_BATCH_BUFFER_END = typename XeHpcCoreFamily::MI_BATCH_BUFFER_END; DebugManagerStateRestore restore; + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); auto pCommandList = std::make_unique>>(); auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp index 04efcea3c2..581e5a50e2 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp @@ -25,6 +25,7 @@ HWTEST2_F(CommandListTests, givenDG2WithBSteppingWhenCreatingCommandListThenAddi DebugManagerStateRestore dbgRestorer; DebugManager.flags.EnableStateBaseAddressTracking.set(0); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); ze_result_t returnValue; auto &hwInfo = *neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp index deefe74351..d2bcca9c36 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp @@ -34,6 +34,7 @@ HWTEST2_F(CommandListCreate, WhenCreatingCommandListThenBindingTablePoolAllocAdd DebugManagerStateRestore dbgRestorer; DebugManager.flags.EnableStateBaseAddressTracking.set(0); + DebugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0); ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdqueue_enqueuecommandlist_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdqueue_enqueuecommandlist_xe_hpg_core.cpp index d30a0ece20..0d1a06952a 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdqueue_enqueuecommandlist_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdqueue_enqueuecommandlist_xe_hpg_core.cpp @@ -38,6 +38,8 @@ XE_HPG_CORETEST_F(CommandQueueExecuteCommandListsXeHpgCore, WhenExecutingCmdList ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + CommandList::fromHandle(commandLists[0])->close(); + auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -82,6 +84,8 @@ XE_HPG_CORETEST_F(CommandQueueExecuteCommandListsXeHpgCore, WhenExecutingCmdList ze_command_list_handle_t commandLists[] = { CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()}; uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]); + CommandList::fromHandle(commandLists[0])->close(); + auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result);