Debugger L0 Win: Attention event handling from UMD

Related-To: NEO-7261

Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2022-08-23 11:17:12 +00:00
committed by Compute-Runtime-Automation
parent 22fb71a268
commit 3212a71760
16 changed files with 423 additions and 109 deletions

View File

@@ -11,6 +11,8 @@
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/os_interface/windows/wddm_debug.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper.h"
#include "common/StateSaveAreaHeader.h"
namespace L0 {
@@ -112,6 +114,8 @@ void *DebugSessionWindows::asyncThreadFunction(void *arg) {
while (self->asyncThread.threadActive) {
self->readAndHandleEvent(100);
self->sendInterrupts();
self->generateEventsAndResumeStoppedThreads();
}
PRINT_DEBUGGER_INFO_LOG("Debugger async thread closing\n", "");
@@ -221,7 +225,38 @@ ze_result_t DebugSessionWindows::handleModuleCreateEvent(uint32_t seqNo, DBGUMD_
}
ze_result_t DebugSessionWindows::handleEuAttentionBitsEvent(DBGUMD_READ_EVENT_EU_ATTN_BIT_SET_PARAMS &euAttentionBitsParams) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_EU_ATTN_BIT_SET_PARAMS: hContextHandle=0x%llX LRCA=%d BitMaskSizeInBytes=%d BitmaskArrayPtr=0x%llX\n",
euAttentionBitsParams.hContextHandle, euAttentionBitsParams.LRCA,
euAttentionBitsParams.BitMaskSizeInBytes, euAttentionBitsParams.BitmaskArrayPtr);
auto hwInfo = connectedDevice->getHwInfo();
auto &l0HwHelper = L0HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto threadsWithAttention = l0HwHelper.getThreadsFromAttentionBitmask(hwInfo, 0u,
reinterpret_cast<uint8_t *>(euAttentionBitsParams.BitmaskArrayPtr),
euAttentionBitsParams.BitMaskSizeInBytes);
printBitmask(reinterpret_cast<uint8_t *>(euAttentionBitsParams.BitmaskArrayPtr), euAttentionBitsParams.BitMaskSizeInBytes);
PRINT_DEBUGGER_THREAD_LOG("ATTENTION received for thread count = %d\n", (int)threadsWithAttention.size());
uint64_t memoryHandle = DebugSessionWindows::invalidHandle;
{
std::unique_lock<std::mutex> lock(asyncThreadMutex);
if (allContexts.empty()) {
return ZE_RESULT_ERROR_UNINITIALIZED;
}
memoryHandle = *allContexts.begin();
}
for (auto &threadId : threadsWithAttention) {
PRINT_DEBUGGER_THREAD_LOG("ATTENTION event for thread: %s\n", EuThread::toString(threadId).c_str());
markPendingInterruptsOrAddToNewlyStoppedFromRaisedAttention(threadId, memoryHandle);
}
checkTriggerEventsForAttention();
return ZE_RESULT_SUCCESS;
}
ze_result_t DebugSessionWindows::handleAllocationDataEvent(uint32_t seqNo, DBGUMD_READ_EVENT_READ_ALLOCATION_DATA_PARAMS &allocationDataParams) {
@@ -533,10 +568,7 @@ ze_result_t DebugSessionWindows::writeGpuMemory(uint64_t memoryHandle, const cha
}
void DebugSessionWindows::enqueueApiEvent(zet_debug_event_t &debugEvent) {
}
bool DebugSessionWindows::readSystemRoutineIdent(EuThread *thread, uint64_t vmHandle, SIP::sr_ident &srMagic) {
return false;
pushApiEvent(debugEvent, 0, 0);
}
ze_result_t DebugSessionWindows::readSbaBuffer(EuThread::ThreadId threadId, NEO::SbaTrackedAddresses &sbaBuffer) {

View File

@@ -55,6 +55,9 @@ struct DebugSessionWindows : DebugSessionImp {
ze_result_t readElfSpace(const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer);
ze_result_t readSbaBuffer(EuThread::ThreadId, NEO::SbaTrackedAddresses &sbaBuffer) override;
uint64_t getContextStateSaveAreaGpuVa(uint64_t memoryHandle) override {
return this->stateSaveAreaVA.load();
}
void readStateSaveAreaHeader() override;
MOCKABLE_VIRTUAL ze_result_t readAndHandleEvent(uint64_t timeoutMs);
@@ -67,7 +70,6 @@ struct DebugSessionWindows : DebugSessionImp {
ze_result_t readAllocationDebugData(uint32_t seqNo, uint64_t umdDataBufferPtr, void *outBuf, size_t outBufSize);
void enqueueApiEvent(zet_debug_event_t &debugEvent) override;
bool readSystemRoutineIdent(EuThread *thread, uint64_t vmHandle, SIP::sr_ident &srMagic) override;
bool readModuleDebugArea() override;
void startAsyncThread() override;
void closeAsyncThread();