Debugger access to SLM

Resolves: NEO-5998

Signed-off-by: Matias Cabral <matias.a.cabral@intel.com>
This commit is contained in:
Matias Cabral
2022-08-05 12:46:52 +00:00
committed by Compute-Runtime-Automation
parent 6811b1079f
commit c012034c19
10 changed files with 419 additions and 48 deletions

View File

@@ -7,6 +7,7 @@
#include "level_zero/tools/source/debug/linux/prelim/debug_session.h"
#include "shared/source/built_ins/sip.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/array_count.h"
@@ -1525,6 +1526,19 @@ ze_result_t DebugSessionLinux::readMemory(ze_device_thread_t thread, const zet_d
return status;
}
if (desc->type == ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT) {
status = readDefaultMemory(thread, desc, size, buffer);
} else {
auto threadId = convertToThreadId(thread);
status = readSLMMemory(threadId, desc, size, buffer);
}
return status;
}
ze_result_t DebugSessionLinux::readDefaultMemory(ze_device_thread_t thread, const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer) {
ze_result_t status;
bool isa = tryReadIsa(connectedDevice->getNEODevice()->getDeviceBitfield(), desc, size, buffer, status);
if (isa) {
return status;
@@ -1554,6 +1568,10 @@ ze_result_t DebugSessionLinux::writeMemory(ze_device_thread_t thread, const zet_
return status;
}
if (desc->type != ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
auto deviceBitfield = connectedDevice->getNEODevice()->getDeviceBitfield();
bool isa = tryWriteIsa(deviceBitfield, desc, size, buffer, status);

View File

@@ -265,6 +265,8 @@ struct DebugSessionLinux : DebugSessionImp {
bool tryReadIsa(NEO::DeviceBitfield deviceBitfield, const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer, ze_result_t &status);
virtual bool tryAccessIsa(NEO::DeviceBitfield deviceBitfield, const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer, bool write, ze_result_t &status);
ze_result_t accessDefaultMemForThreadAll(const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer, bool write);
ze_result_t readDefaultMemory(ze_device_thread_t thread, const zet_debug_memory_space_desc_t *desc,
size_t size, void *buffer);
MOCKABLE_VIRTUAL int threadControl(const std::vector<EuThread::ThreadId> &threads, uint32_t tile, ThreadControlCmd threadCmd, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize);