Skip to content

rocdbgapi: allow attaching with no forward progress requirement - #7657

Open
lancesix wants to merge 1 commit into
developfrom
users/lancesix/dbgapi/attach-no-fw-progress
Open

rocdbgapi: allow attaching with no forward progress requirement#7657
lancesix wants to merge 1 commit into
developfrom
users/lancesix/dbgapi/attach-no-fw-progress

Conversation

@lancesix

Copy link
Copy Markdown
Contributor

We could have made this the new default, but to maintain compatibility with existing debuggers, we make this behavior an opt-in and not a new default.

Suggested-by: Laurent Morichetti laurent.morichetti@amd.com

Motivation

When attaching to a process, we currently implicitly have forward progress requirement disabled. As a consequence, during the attach sequence, we have a few suspend-restore cycles, which are not necessary.

Technical Details

To fix this inefficiency, allow the client to attach with process requirement disabled.

Test Plan

Tested using ROCm/ROCgdb#182, as well as debug agent tests.

Test Result

Pass.

Submission Checklist

@lumachad

Copy link
Copy Markdown
Contributor

Looks like debug agent tripped on build:

[rocr-debug-agent] /__w/rocm-systems/rocm-systems/projects/rocr-debug-agent/src/debug_agent.cpp:1256:20: error: use of undeclared identifier 'PROCESS_ATTACH_FLAGS_NONE'
[rocr-debug-agent]  1256 |       &process_id, PROCESS_ATTACH_FLAGS_NONE));
[rocr-debug-agent]       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
[rocr-debug-agent] 1 error generated.

@lancesix
lancesix force-pushed the users/lancesix/dbgapi/attach-no-fw-progress branch from c9914c8 to e846754 Compare June 23, 2026 22:38
@@ -1078,7 +1078,7 @@ process_dbgapi_events (amd_dbgapi_process_id_t process_id, bool all_wavefronts,
/* TODO, we should have a RAII object to handle forward progress wave
creation mode override. */
DBGAPI_CHECK (amd_dbgapi_process_set_progress (
process_id, AMD_DBGAPI_PROGRESS_NO_FORWARD));
process_id, AMD_DBGAPI_PROCESS_ATTACH_FLAGS_NO_FORWARD_PROGRESS));

@palves palves Jun 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change looks wrong -- AMD_DBGAPI_PROCESS_ATTACH_FLAGS_NO_FORWARD_PROGRESS is for the amd_dbgapi_process_attach function, but here we're still calling amd_dbgapi_process_set_progress, so the old code was right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, this is clearly wrong, should be AMD_DBGAPI_PROCESS_ATTACH_FLAGS_NONE .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

but this is a amd_dbgapi_process_set_progress call, not amd_dbgapi_process_attach.

@@ -1253,7 +1253,7 @@ dbgapi_worker (int listen_fd, bool all_wavefronts, bool precise_memory,

DBGAPI_CHECK (amd_dbgapi_process_attach (
reinterpret_cast<amd_dbgapi_client_process_id_t> (&self_mem_fd),
&process_id));
&process_id, PROCESS_ATTACH_FLAGS_NONE));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be AMD_DBGAPI_PROCESS_ATTACH_FLAGS_NONE?

@@ -1944,6 +1950,17 @@ amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_process_get_info (
amd_dbgapi_process_id_t process_id, amd_dbgapi_process_info_t query,
size_t value_size, void *value) AMD_DBGAPI_VERSION_0_80;

/** Flags influencing the how the library attaches to a process.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"influencing the how the library" => "influencing how the library"


return str;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seeing yet another instance of this pattern made me want to refactor things so we can avoid it. See:

#7802

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 25 days and will be marked as stale.

If you would like to keep this PR open, please:

  • Add new commits
  • Add a comment explaining why it should remain open

This PR will be automatically closed in 5 days if no further activity occurs.

@github-actions github-actions Bot added the Stale PR has no activity for 25+ days label Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed due to inactivity (30 days with no updates).

If you'd like to continue working on this, feel free to reopen the PR or create a new one.

@github-actions github-actions Bot closed this Jul 26, 2026
@lancesix lancesix reopened this Jul 27, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
JIRA ID (on separate line)
ROCM-25757
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID (on separate line)
AIRUNTIME-2352
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
Forbidden Files ✅ Pass
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocdbgapi/src/logging.cpp, projects/rocdbgapi/src/logging.h, projects/rocdbgapi/src/process.cpp, projects/rocdbgapi/src/utils.h, projects/rocr-debug-agent/src/debug_agent.cpp; no test file found
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@github-actions github-actions Bot removed the Stale PR has no activity for 25+ days label Jul 28, 2026
When attaching to a process, we currently implicitly have forward
progress requirement disabled.  As a consequence, during the attach
sequence, we have a few suspend-restore cycles, which are not necessary.
To fix this inefficiency, allow the client to attach with process
requirement disabled.

We could have made this the new default, but to maintain compatibility
with existing debuggers, we make this behavior an opt-in and not a new
default.

Adjust the debug agent to use the updated API.

Suggested-by: Laurent Morichetti <laurent.morichetti@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants