Skip to content

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

Open
spatrang wants to merge 1 commit into
amd-stagingfrom
users/spatrang/hip-graph-launch-tests
Open

gdb/testsuite: add HIP graph-launch kernel debugging test#197
spatrang wants to merge 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
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 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.

#include <stdlib.h>
#include <hip/hip_runtime.h>

#define CHECK(cmd) \

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.

You should be able to #include "rocm-test-utils.h", and have the CHECK macro from there.

int
main ()
{
const unsigned int num_elems = 1;

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.

could even be constexpr.

}

# The C source uses "#define NUM_REPLAYS 3". Keep this in sync.
set num_replays 3

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.

If we really want to have them in sync, you could build with -DNUM_REPLAYS=$num_replays. This way, things would always be in sync.

See example of doing this in gdb.rocm/nonstop-mode.exp for example.

If we want to be able to build the cpp on its own (without running dejagnu), we can have

#ifndef NUM_REPLAYS
#define NUM_REPLAYS 3
#endif

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.

2 participants