mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
perf(debugger): Optimize single-stepping of eu threads
Single-stepping threads is based on resume() and THREAD_STOPPED events To speed up single-stepping, stopped threads must be discovered immediately after resume() is called. This change is adding ATT scan and event generation in resume() Related-To: NEO-7750 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
acececc214
commit
e8b4841577
@@ -1439,6 +1439,40 @@ int DebugSessionLinux::threadControl(const std::vector<EuThread::ThreadId> &thre
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DebugSessionLinux::checkStoppedThreadsAndGenerateEvents(const std::vector<EuThread::ThreadId> &threads, uint64_t memoryHandle, uint32_t deviceIndex) {
|
||||
std::unique_ptr<uint8_t[]> bitmask;
|
||||
size_t bitmaskSize;
|
||||
[[maybe_unused]] auto attReadResult = threadControl(threads, deviceIndex, ThreadControlCmd::Stopped, bitmask, bitmaskSize);
|
||||
DEBUG_BREAK_IF(attReadResult != 0);
|
||||
|
||||
auto hwInfo = connectedDevice->getHwInfo();
|
||||
auto &l0GfxCoreHelper = connectedDevice->getL0GfxCoreHelper();
|
||||
|
||||
auto threadsWithAttention = l0GfxCoreHelper.getThreadsFromAttentionBitmask(hwInfo, deviceIndex, bitmask.get(), bitmaskSize);
|
||||
std::vector<EuThread::ThreadId> stoppedThreadsToReport;
|
||||
stoppedThreadsToReport.reserve(threads.size());
|
||||
|
||||
const auto &threadsToCheck = threadsWithAttention.size() > 0 ? threadsWithAttention : threads;
|
||||
|
||||
for (auto &threadId : threadsToCheck) {
|
||||
SIP::sr_ident srMagic = {{0}};
|
||||
srMagic.count = 0;
|
||||
|
||||
if (readSystemRoutineIdent(allThreads[threadId].get(), memoryHandle, srMagic)) {
|
||||
bool wasStopped = allThreads[threadId]->isStopped();
|
||||
|
||||
if (allThreads[threadId]->verifyStopped(srMagic.count)) {
|
||||
allThreads[threadId]->stopThread(memoryHandle);
|
||||
if (!wasStopped) {
|
||||
stoppedThreadsToReport.push_back(threadId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateEventsForStoppedThreads(stoppedThreadsToReport);
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionLinux::resumeImp(const std::vector<EuThread::ThreadId> &threads, uint32_t deviceIndex) {
|
||||
std::unique_ptr<uint8_t[]> bitmask;
|
||||
size_t bitmaskSize;
|
||||
|
||||
@@ -186,6 +186,7 @@ struct DebugSessionLinux : DebugSessionImp {
|
||||
ze_result_t readEventImp(prelim_drm_i915_debug_event *drmDebugEvent);
|
||||
ze_result_t resumeImp(const std::vector<EuThread::ThreadId> &threads, uint32_t deviceIndex) override;
|
||||
ze_result_t interruptImp(uint32_t deviceIndex) override;
|
||||
void checkStoppedThreadsAndGenerateEvents(const std::vector<EuThread::ThreadId> &threads, uint64_t memoryHandle, uint32_t deviceIndex) override;
|
||||
|
||||
void enqueueApiEvent(zet_debug_event_t &debugEvent) override {
|
||||
pushApiEvent(debugEvent);
|
||||
|
||||
Reference in New Issue
Block a user