From c3f1b07183bd6952009c76d2a3c3476096db2ee5 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Mon, 16 May 2022 11:04:15 +0000 Subject: [PATCH] L0Debugger - add ULT for immediate cmdlist notification Resolves: NEO-6963 Signed-off-by: Mateusz Hoppe --- .../debugger/linux/test_l0_debugger_linux.cpp | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp index d9f0abe906..c32f963033 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp @@ -230,7 +230,7 @@ TEST_F(L0DebuggerLinuxTest, givenModuleHandleZeroWhenRemoveZebinModuleIsCalledTh EXPECT_EQ(0u, drmMock->unregisterCalledCount); } -HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndCommandQueuesAreCreatedAndDestroyedThanDebuggerL0IsNotified) { +HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenCommandQueuesAreCreatedAndDestroyedThenDebuggerL0IsNotified) { auto debuggerL0Hw = static_cast *>(device->getL0Debugger()); neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().ensureContextInitialized(); @@ -255,5 +255,36 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndCommandQueuesAreCreatedAnd EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount); } +HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenImmCommandListsCreatedAndDestroyedThenDebuggerL0IsNotified) { + auto debuggerL0Hw = static_cast *>(device->getL0Debugger()); + + neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().ensureContextInitialized(); + drmMock->ioctlCallsCount = 0; + + ze_command_queue_desc_t queueDesc = {}; + ze_result_t returnValue; + + ze_command_list_handle_t commandList1 = nullptr; + ze_command_list_handle_t commandList2 = nullptr; + + returnValue = device->createCommandListImmediate(&queueDesc, &commandList1); + EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); + EXPECT_EQ(1u, drmMock->ioctlCallsCount); + EXPECT_EQ(1u, debuggerL0Hw->commandQueueCreatedCount); + + returnValue = device->createCommandListImmediate(&queueDesc, &commandList2); + EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); + EXPECT_EQ(1u, drmMock->ioctlCallsCount); + EXPECT_EQ(2u, debuggerL0Hw->commandQueueCreatedCount); + + CommandList::fromHandle(commandList1)->destroy(); + EXPECT_EQ(1u, drmMock->ioctlCallsCount); + EXPECT_EQ(1u, debuggerL0Hw->commandQueueDestroyedCount); + + CommandList::fromHandle(commandList2)->destroy(); + EXPECT_EQ(1u, drmMock->unregisterCalledCount); + EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount); +} + } // namespace ult } // namespace L0