Skip to content

Conversation

@xuhz
Copy link
Contributor

@xuhz xuhz commented Aug 14, 2025

we don't have a better solution in npu to set debugger q

  1. they have difficulty configuring active hw ctx
  2. need more thinking / discussion to disable hws during debug

before we have a better solution, we change to

  1. attach the debugger q before ctx runs
  2. cert checks the q only when it detects a control code hang

this is still a good/useful feature to debug a control code hang though. better than nothing.

@xuhz xuhz requested review from maxzhen and xdavidz August 14, 2025 00:25
@AMDGithubSCIMAdmin
Copy link

Can one of the admins verify this patch?

@maxzhen
Copy link
Collaborator

maxzhen commented Aug 14, 2025

ok to test

@maxzhen
Copy link
Collaborator

maxzhen commented Sep 24, 2025

retest this please

@xuhz xuhz requested a review from Copilot November 20, 2025 18:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses debugger queue attachment issues by moving the attachment point earlier in the lifecycle and commenting out detachment logic. The changes work around NPU limitations in configuring active hardware contexts during debugging.

Key changes:

  • Debugger queue attachment moved from handle_attach() to constructor initialization
  • Detachment logic commented out to prevent premature queue removal
  • Debug command submission logic improved with better synchronization and logging

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/shim/umq/tcp_server.cpp Moves debugger queue attachment to constructor and disables dynamic attach/detach handlers
src/shim/umq/hwctx.h Removes unnecessary blank line
src/shim/umq/dbg_hwq.cpp Fixes command submission synchronization and adds diagnostic logging
src/shim/umq/dbg_cmd.h Corrects duplicate macro value for DBG_PKT_INVALID

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// issue ioctl to attach the dbg hsa queue
std::map<uint32_t, size_t> buf_sizes;
buf_sizes[0] = 32; //we don't care size
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after '//' comment delimiter. Should be '// we don't care size'.

Suggested change
buf_sizes[0] = 32; //we don't care size
buf_sizes[0] = 32; // we don't care size

Copilot uses AI. Check for mistakes.
Comment on lines +298 to 306
#if 0
// issue ioctl to attach the dbg hsa queue
std::map<uint32_t, size_t> buf_sizes;
buf_sizes[uc_index] = 0; //we don't care size

m_dbg_umq.get_dbg_umq_bo()->config(m_hwctx, buf_sizes);
shim_debug("TCP server ioctl: debugger attach\n");
#endif

Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using #if 0 to comment out code is less maintainable than removing it entirely or using a feature flag. Consider removing this dead code or documenting why it's preserved with a TODO comment.

Suggested change
#if 0
// issue ioctl to attach the dbg hsa queue
std::map<uint32_t, size_t> buf_sizes;
buf_sizes[uc_index] = 0; //we don't care size
m_dbg_umq.get_dbg_umq_bo()->config(m_hwctx, buf_sizes);
shim_debug("TCP server ioctl: debugger attach\n");
#endif

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants