[libcu++] Add debugger pretty-printers for cuda event types - #10578
Open
owevertonguedes wants to merge 1 commit into
Open
[libcu++] Add debugger pretty-printers for cuda event types#10578owevertonguedes wants to merge 1 commit into
owevertonguedes wants to merge 1 commit into
Conversation
Add GDB and LLDB pretty-printers for cuda::event_ref, cuda::event and cuda::timed_event, register them with the existing debugger entry points, and add a test scenario under libcudacxx/test/debugging/event. Each printer shows the public type name and a single `handle` child holding the native cudaEvent_t. The handle is stored in the private event_ref base, so the GDB printer walks recognized base subobjects to reach it, which matters for the two levels of inheritance behind timed_event. The printers only read stored state and make no CUDA runtime or driver calls. The scenario covers a non-null event_ref, an owning event, a timed_event, a typedef alias, a null reference, no_init event and timed_event, an array of event references, and a reference printed before and after reassignment. It uses opaque fake handles and releases the owning ones before destruction, so it runs without a GPU and without the CUDA driver.
Contributor
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (9)
📝 WalkthroughSummary by CodeRabbit
WalkthroughChangesCUDA event debugger printers
Assessment against linked issues
Possibly related PRs
Suggested reviewers: Comment |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
closes #10094
Adds GDB and LLDB pretty-printers for
cuda::event_ref,cuda::eventandcuda::timed_event, following the pattern established by thecuda::std::array,cuda::std::complexandcuda::std::tupleprinters.Today a
cuda::timed_eventprints as its raw layout, with the ABI inline namespace and the nested base subobjects:With this change:
libcudacxx/share/libcudacxx/gdb/event.py— recognizes exactly the three public class names after stripping typedefs and top-level qualifiers, reusing the existing helper that removes the ABI inline namespace. The handle is stored in the privateevent_refbase, so the printer walks recognized base subobjects to find__event_. That is what makestimed_eventwork, since it reaches the handle through two levels of inheritance.libcudacxx/share/libcudacxx/lldb/event.py— synthetic-children provider exposing the same singlehandlechild, with a strict canonical-type recognizer.libcudacxx/test/debugging/event/— harness test with 10 cases: a non-nullevent_ref, an owningevent, atimed_event, a typedef alias, a null reference,no_initeventandtimed_event, event references nested in acuda::std::array(printer composition), and a reference printed before and after reassignment.The printers only read stored state and make no CUDA runtime or driver calls. I kept the output to the handle to match the scope of the issue and the other printers in this series. If you would like more fields, such as the device, the flags, or completion status, I am happy to add them.
The scenario needs no GPU and no CUDA driver. It uses opaque fake handles, and the two owning objects release their handle before destruction so no destructor ever passes a fake handle to the driver. I checked that rather than assuming it: the test binary runs to completion with exit status 0 in an environment where
libcuda.so.1is not present at all.Testing notes: validated locally with gdb 15.1 (embedded Python 3.12.3), lldb 21.1.8, nvcc 12.9.86 and g++ 13.3.0:
Both goldens match the harness output on a clean run. I also checked that the tests fail for the right reasons: dropping the module from the registration tuple fails every case for that debugger, and restricting the GDB base traversal to a single level fails exactly the two
timed_eventcases and nothing else. One limitation worth naming: the before/after reassignment case proves the printers report the updated value rather than a stale one, but it does not isolate the LLDBupdate()refresh, since the case still passes with that refresh moved into the constructor.Checklist