feature: Add sync host event handling on windows

Resolves: NEO-13744
Signed-off-by: Jemale Lockett <jemale.lockett@intel.com>
This commit is contained in:
Jemale Lockett
2025-05-09 15:48:51 +00:00
committed by Compute-Runtime-Automation
parent fa1e3fd6a2
commit 8b508fd15f
10 changed files with 146 additions and 59 deletions

View File

@@ -351,7 +351,7 @@ struct MockDebugSession : public L0::DebugSessionImp {
return DebugSessionImp::readThreadScratchRegisters(thread, start, count, pRegisterValues);
}
void updateStoppedThreadsAndCheckTriggerEvents(const AttentionEventFields &attention, uint32_t tileIndex, std::vector<EuThread::ThreadId> &threadsWithAttention) override {}
ze_result_t updateStoppedThreadsAndCheckTriggerEvents(const AttentionEventFields &attention, uint32_t tileIndex, std::vector<EuThread::ThreadId> &threadsWithAttention) override { return ZE_RESULT_SUCCESS; }
void resumeAccidentallyStoppedThreads(const std::vector<EuThread::ThreadId> &threadIds) override {
resumeAccidentallyStoppedCalled++;
return DebugSessionImp::resumeAccidentallyStoppedThreads(threadIds);

View File

@@ -33,6 +33,7 @@ struct MockDebugSessionWindows : DebugSessionWindows {
using DebugSessionWindows::allModules;
using DebugSessionWindows::allThreads;
using DebugSessionWindows::asyncThread;
using DebugSessionWindows::attentionEventContext;
using DebugSessionWindows::calculateThreadSlotOffset;
using DebugSessionWindows::closeAsyncThread;
using DebugSessionWindows::debugArea;
@@ -2021,5 +2022,43 @@ TEST_F(DebugApiWindowsTest, GivenResumeImpCalledThenBitmaskIsCorrect) {
EXPECT_EQ(0u, bitmask[4]);
}
TEST_F(DebugApiWindowsTest, givenSyncHostEventReceivedThenEventIsHandledAndAttentionEventContextUpdated) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
session->allContexts = {};
session->allContexts.insert(0x01);
auto &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
mockWddm->numEvents = 1;
mockWddm->eventQueue[0].readEventType = DBGUMD_READ_EVENT_SYNC_HOST;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.SyncHostDataParams.hContextHandle = 0x12345;
EXPECT_EQ(ZE_RESULT_SUCCESS, session->readAndHandleEvent(100));
EXPECT_EQ(1u, session->attentionEventContext.size());
}
}
TEST_F(DebugApiWindowsTest, givenErrorCasesWhenHandlingSyncHostThenErrorIsReturned) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
session->allContexts = {};
auto &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
mockWddm->numEvents = 1;
mockWddm->eventQueue[0].readEventType = DBGUMD_READ_EVENT_SYNC_HOST;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.SyncHostDataParams.hContextHandle = 0x12345;
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, session->readAndHandleEvent(100));
}
}
} // namespace ult
} // namespace L0