gdb/testsuite: add HIP graph-launch kernel debugging test#197
Conversation
e542624 to
d32f447
Compare
|
Rebased onto latest amd-staging to pick up the record-full.c build fix and re-trigger CI. |
lancesix
left a comment
There was a problem hiding this comment.
Just minor comments for now, will get a deeper review at a later time.
Add gdb.rocm/hip-graph-launch test covering debugging of kernels dispatched via hipGraphLaunch (stream-captured graph, replayed).
d32f447 to
448cbc2
Compare
|
Addressed review comments :
Also rebased onto latest amd-staging. |
| int *result_ptr, result; | ||
| hipStream_t stream; | ||
| hipGraph_t graph; | ||
| hipGraphExec_t graph_exec; |
There was a problem hiding this comment.
It's not a hard requirement, but the code style prefers to declare variables at the first time of definition. E.g. Decls above can be moved down, like so:
hipStream_t stream;
CHECK (hipStreamCreate (&stream));
...
hipGraph_t graph;
CHECK (hipStreamEndCapture (stream, &graph));
hipGraphExec_t graph_exec;
CHECK (hipGraphInstantiate (&graph_exec, graph, nullptr, nullptr, 0))
...
| return | ||
| } | ||
|
|
||
| # Line numbers of the breakpoint markers in the two kernels. |
There was a problem hiding this comment.
Nit: I think this comment can be removed. It's rather repeating the code.
| gdb_test "print out\[0\]" " = $val" \ | ||
| "add_one sees value from previous replay" | ||
|
|
||
| continue_to_kernel "times_three" $::times_three_line \ |
There was a problem hiding this comment.
It's mostly a personal taste: The proc continue_to_kernel is a wrapper around one gdb_test only. We can rather inline it and remove the proc. What we are testing would become clearer.
| # test description. | ||
| proc continue_to_kernel {kernel line desc} { | ||
| gdb_test "continue" \ | ||
| "Thread $::decimal .* hit Breakpoint $::decimal, with lane 0, $kernel \\(.*\\) at .*$::srcfile:$line.*" \ |
There was a problem hiding this comment.
If we want to make this shorter, this would also be ok, without losing quality of the test:
Breakpoint .* $kernel .*$::srcfile:$line.*
| clean_restart | ||
| gdb_load $::binfile |
| # After all replays the final result must be 39, and the program exits | ||
| # cleanly. | ||
| gdb_test "continue" \ | ||
| "result is $val.*\\\[Inferior 1 .* exited normally\\\]" \ |
There was a problem hiding this comment.
Can we use $inferior_exited_re here?
| clean_restart | ||
| gdb_load $::binfile |
There was a problem hiding this comment.
clearn_restart $::testfile
|
|
||
| gdb_breakpoint "add_one" -allow-pending | ||
| gdb_test "continue" \ | ||
| "Thread $::decimal .* hit Breakpoint $::decimal, with lane 0, add_one \\(.*\\) at .*$::srcfile:.*" \ |
There was a problem hiding this comment.
Nit: The shorter variant I gave above may be used.
| gdb_test "print out" " = \\(int \\*\\) $::hex" \ | ||
| "kernel argument is readable" |
There was a problem hiding this comment.
We can print and check the value of out[0], too. The value can be passed as an argument to the proc.
| test_breakpoint_by_name_and_backtrace | ||
| test_single_step | ||
| test_info_dispatches |
There was a problem hiding this comment.
I'm not sure what testing value we gain by these 3 tests. The first one tested being able to hit the breakpoint inside graph-launched kernels, that's understood. But the other 3 seem like they test debug info and basic debug functionality, for which there already exist tests. I don't see why it should matter to do these for graph-launched kernels. I'd be in favor of removing them for making this test file simpler and less expensive (such tests accumulate and the overall test time may increase to unpleasant levels over time).
Summary
Adds a new
gdb.rocmdejagnu test,hip-graph-launch, covering debugging ofkernels dispatched through a HIP graph (
hipGraphLaunch) rather than a plainkernel<<<>>>()launch. The program captures two kernels (add_onethentimes_three) from a stream into a single graph, instantiates it, and replaysit 3 times; each replay computes
out = (out + 1) * 3(0 -> 3 -> 12 -> 39).The test exercises the graph-specific debugger behavior:
info dispatchesreports 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:
JIRA
AIROCGDB-580