L0 debugger - reports process ENTER/EXIT events for zeCommandQueues

- PROCESS_ENTRY - triggered by first zeCommandQueueCreate()
- PROCESS_EXIT  - triggered by last zeCommandQueueDestroy()

Resolves: NEO-6503

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-02-10 11:13:59 +00:00
committed by Compute-Runtime-Automation
parent dbe1779e4b
commit 60d6505932
11 changed files with 105 additions and 4 deletions

View File

@@ -57,15 +57,28 @@ class MockDebuggerL0Hw : public L0::DebuggerL0Hw<GfxFamily> {
}
return L0::DebuggerL0Hw<GfxFamily>::attachZebinModuleToSegmentAllocations(allocs, moduleHandle);
}
bool removeZebinModule(uint32_t moduleHandle) override {
removedZebinModuleHandle = moduleHandle;
return L0::DebuggerL0Hw<GfxFamily>::removeZebinModule(moduleHandle);
}
void notifyCommandQueueCreated() override {
commandQueueCreatedCount++;
L0::DebuggerL0Hw<GfxFamily>::notifyCommandQueueCreated();
}
void notifyCommandQueueDestroyed() override {
commandQueueDestroyedCount++;
L0::DebuggerL0Hw<GfxFamily>::notifyCommandQueueDestroyed();
}
uint32_t captureStateBaseAddressCount = 0;
uint32_t programSbaTrackingCommandsCount = 0;
uint32_t getSbaTrackingCommandsSizeCount = 0;
uint32_t registerElfCount = 0;
uint32_t commandQueueCreatedCount = 0;
uint32_t commandQueueDestroyedCount = 0;
const char *lastReceivedElf = nullptr;
uint32_t segmentCountWithAttachedModuleHandle = 0;

View File

@@ -12,6 +12,7 @@
#include "shared/test/common/mocks/linux/mock_drm_allocation.h"
#include "shared/test/common/test_macros/test.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
#include <algorithm>
@@ -219,5 +220,30 @@ TEST_F(L0DebuggerLinuxTest, givenModuleHandleWhenRemoveZebinModuleIsCalledThenHa
EXPECT_EQ(20u, drmMock->unregisteredHandle);
}
HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndCommandQueuesAreCreatedAndDestroyedThanDebuggerL0IsNotified) {
auto debuggerL0Hw = static_cast<MockDebuggerL0Hw<FamilyType> *>(device->getL0Debugger());
neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().ensureContextInitialized();
drmMock->ioctlCallsCount = 0;
ze_command_queue_desc_t queueDesc = {};
ze_result_t returnValue;
auto commandQueue1 = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue);
EXPECT_EQ(1u, drmMock->ioctlCallsCount);
EXPECT_EQ(1u, debuggerL0Hw->commandQueueCreatedCount);
auto commandQueue2 = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue);
EXPECT_EQ(1u, drmMock->ioctlCallsCount);
EXPECT_EQ(2u, debuggerL0Hw->commandQueueCreatedCount);
commandQueue1->destroy();
EXPECT_EQ(1u, drmMock->ioctlCallsCount);
EXPECT_EQ(1u, debuggerL0Hw->commandQueueDestroyedCount);
commandQueue2->destroy();
EXPECT_EQ(1u, drmMock->unregisterCalledCount);
EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount);
}
} // namespace ult
} // namespace L0