Skip to content

gdb/testsuite: add HIP graph-launch kernel debugging test#197

Merged
spatrang merged 1 commit into
amd-stagingfrom
users/spatrang/hip-graph-launch-tests
Jul 15, 2026
Merged

gdb/testsuite: add HIP graph-launch kernel debugging test#197
spatrang merged 1 commit into
amd-stagingfrom
users/spatrang/hip-graph-launch-tests

Conversation

@spatrang

@spatrang spatrang commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new gdb.rocm dejagnu test, hip-graph-launch, covering debugging of
kernels dispatched through a HIP graph (hipGraphLaunch) rather than a plain
kernel<<<>>>() launch. The program captures two kernels (add_one then
times_three) from a stream into a single graph, instantiates it, and replays
it 3 times; each replay computes out = (out + 1) * 3 (0 -> 3 -> 12 -> 39).

The test exercises the graph-specific debugger behavior:

  • pending breakpoints in graph-launched kernels resolve and hit,
  • both graph nodes stop in order on every replay (dispatch numbering / re-dispatch),
  • correct per-replay data is observed at each node,
  • symbol breakpoint + backtrace + kernel-argument inspection,
  • single-stepping inside a graph-launched kernel mutates device memory,
  • info dispatches reports the active dispatch and associates it with the kernel.

Test plan

Validated 22/22 assertions under both GCC and LLVM host compilers on gfx942
(MI300X), against:

  • locally built ROCgdb (gdb 18.0.50), and
  • nightly ROCm 7.14 rocgdb (gdb 16.3).

JIRA

AIROCGDB-580

@spatrang spatrang requested a review from a team as a code owner July 8, 2026 09:24
@spatrang spatrang marked this pull request as draft July 8, 2026 09:40
@spatrang spatrang marked this pull request as ready for review July 8, 2026 10:17
@spatrang spatrang force-pushed the users/spatrang/hip-graph-launch-tests branch from e542624 to d32f447 Compare July 10, 2026 10:19
@spatrang

Copy link
Copy Markdown
Contributor Author

Rebased onto latest amd-staging to pick up the record-full.c build fix and re-trigger CI.

@lancesix lancesix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just minor comments for now, will get a deeper review at a later time.

Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.cpp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.cpp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
@spatrang spatrang assigned spatrang and unassigned lancesix Jul 13, 2026
@spatrang spatrang force-pushed the users/spatrang/hip-graph-launch-tests branch from d32f447 to 448cbc2 Compare July 13, 2026 10:15
@spatrang

spatrang commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review comments :

  • Use the shared CHECK macro from rocm-test-utils.h instead of a local copy.
  • num_elems is now constexpr.
  • Keep the replay count in sync: the .exp passes -DNUM_REPLAYS=$num_replays and the source guards the define with #ifndef (per the nonstop-mode.exp pattern).

Also rebased onto latest amd-staging.

@spatrang spatrang removed their assignment Jul 13, 2026
@spatrang spatrang marked this pull request as draft July 13, 2026 14:58
@spatrang spatrang marked this pull request as ready for review July 13, 2026 14:58
@aktemur

aktemur commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Assigning to myself to reduce the load on @lancesix.
@lancesix, feel free to assign it back to yourself.

@aktemur aktemur assigned aktemur and unassigned lancesix Jul 15, 2026
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.cpp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
@aktemur aktemur assigned spatrang and unassigned aktemur Jul 15, 2026
@spatrang spatrang force-pushed the users/spatrang/hip-graph-launch-tests branch from 448cbc2 to 43d23bf Compare July 15, 2026 11:57
@spatrang

Copy link
Copy Markdown
Contributor Author

Addressed @aktemur's review comments (force-pushed):

  • Removed the backtrace, single-step, and info dispatches tests; kept only the graph-specific replay/ordering test.
  • Inlined continue_to_kernel into plain gdb_test calls and shortened the stop regexps.
  • clean_restart $::testfile and $inferior_exited_re for the exit match.
  • Declared variables at first use in the .cpp; removed a redundant comment.

@lancesix

Copy link
Copy Markdown
Collaborator

Assigning to myself to reduce the load on @lancesix. @lancesix, feel free to assign it back to yourself.

Thanks.

I had a quick pass at the current iteration, and that seems reasonable to me. Make that a +1 from me.

@aktemur aktemur left a comment

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.

LGTM. Thanks.

@spatrang spatrang assigned lancesix and unassigned spatrang Jul 15, 2026
@spatrang spatrang requested a review from lumachad July 15, 2026 14:17

@lumachad lumachad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some nits, but otherwise LGTM.

Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.cpp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.cpp
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
Comment thread gdb/testsuite/gdb.rocm/hip-graph-launch.exp Outdated
@lumachad lumachad assigned spatrang and unassigned lumachad Jul 15, 2026
Add gdb.rocm/hip-graph-launch test covering debugging of kernels
dispatched via hipGraphLaunch (stream-captured graph, replayed).
@spatrang spatrang force-pushed the users/spatrang/hip-graph-launch-tests branch from 43d23bf to 5fc817e Compare July 15, 2026 16:26
@spatrang

spatrang commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Addressed @lumachad's comments (force-pushed): clarified the "launch graph" execution path in both the .cpp and .exp headers (and near hipGraphLaunch), and cleaned up the bullet list (kept as a list, dropped trailing commas). Comment-only changes; retested 13/13 under GCC and LLVM.

@spatrang spatrang merged commit 0398a92 into amd-staging Jul 15, 2026
7 checks passed
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.

4 participants