Skip to content

[libcudacxx] Add GDB/LLDB pretty-printers for cuda::std::inplace_vector - #10564

Merged
Jacobfaib merged 7 commits into
NVIDIA:mainfrom
HenrikGharagyozyan:feature/cccl-inplace-vector-pretty-printers
Aug 3, 2026
Merged

Jacobfaib merged 7 commits into
NVIDIA:mainfrom
HenrikGharagyozyan:feature/cccl-inplace-vector-pretty-printers

Conversation

@HenrikGharagyozyan

Copy link
Copy Markdown
Contributor

Description

closes #10096

Adds debugger pretty-printers for cuda::std::inplace_vector, following the pattern from #10528. Unlike array, the element count is runtime state, and the container has three compile-time layouts the printers must handle:

  • capacity-0: the specialization has no data members at all — the printers report an empty container without reading any member;
  • trivial T: storage is a typed _Tp[_Capacity] array plus __size_;
  • non-trivial T: storage is a raw unsigned char[Capacity * sizeof(T)] array holding placement-constructed elements.

Both printers use one unified read path for the last two layouts — cast the storage address to T* and index only [0, __size_) — so uninitialized/destroyed slots past the constructed count are never read or displayed. GDB shows cuda::std::inplace_vector<int, 5> of size 3 = {…}; LLDB exposes [i] synthetic children.

Tests under libcudacxx/test/debugging/inplace_vector/ cover: empty (nonzero capacity), partially filled, full, capacity-0, before/after push_back, and nested inplace_vector<inplace_vector<int, 2>, 3> (whose outer container exercises the raw-storage layout and recursive printing).

Testing notes: same situation as #10563 — the GDB printer was validated end-to-end locally (gdb 15.1, host-compiled scenario, harness-generated golden verified on a clean re-run, including raw-memory checks that slots past __size_ are present in storage but excluded from output). I don't have lldb locally; the LLDB provider mirrors the array provider's structure and the gdb logic, and lldb.expected is written by analogy (all-integer values, so no float-format ambiguity). Happy to fix the lldb golden from the CI diff if it differs.

Merge-conflict note: like every PR in this printer series, this touches the shared registration lines (_PRINTERS/_FORMATTERS in gdb/__init__.py and lldb/__init__.py, and the add_subdirectory list in test/debugging/CMakeLists.txt), which will conflict textually with #10534/#10563 — resolution is the union of the added entries; I'll rebase promptly whenever a sibling lands.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added GDB and LLDB pretty-printing support for cuda::std::inplace_vector.
    • Debugger views now display vector sizes, capacities, and contents, including empty, nested, zero-capacity, and updated vectors.
  • Tests

    • Added comprehensive GDB and LLDB debugging coverage for inplace_vector scenarios.

Walkthrough

Adds GDB and LLDB pretty-printers for cuda::std::inplace_vector. Registers both modules and adds debugger tests for empty, partial, full, zero-capacity, nested, and updated vectors.

Changes

inplace_vector debugging

Layer / File(s) Summary
GDB formatter
libcudacxx/share/libcudacxx/gdb/inplace_vector.py, libcudacxx/share/libcudacxx/gdb/__init__.py
Recognizes cuda::std::inplace_vector, displays size and capacity, yields constructed elements, handles zero capacity, and registers the printer.
LLDB formatter
libcudacxx/share/libcudacxx/lldb/inplace_vector.py, libcudacxx/share/libcudacxx/lldb/__init__.py
Recognizes vector types, reports size and capacity, exposes indexed synthetic children, handles zero capacity, and registers the formatter.
Debugger test coverage
libcudacxx/test/debugging/inplace_vector/*, libcudacxx/test/debugging/CMakeLists.txt
Adds build wiring, test scenarios, and expected GDB and LLDB output for empty, partial, full, zero-capacity, nested, and updated vectors.

Assessment against linked issues

Objective Addressed Explanation
Create GDB and LLDB pretty-printers under the specified paths [#10096] ✅
Add exhaustive debugger tests under libcudacxx/test/debugging/inplace_vector [#10096] ✅

Suggested reviewers: arhag23, miscco, jacobfaib


Comment @coderabbitai help to get the list of available commands.

(cuda::std::inplace_vector<int, 4>)
=============== inplace_vector.empty end ===============
=============== inplace_vector.partial begin ===============
(cuda::std::inplace_vector<int, 5>) ([0] = -7, [1] = 0, [2] = 42)

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.

We should be printing size and capacity here as well as the elements. The output should look like a std::vector, not like a std::array please.

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.

Fixed — both printers now show size and capacity. GDB matches libstdc++'s std::vector convention exactly (checked printers.py locally): X of length N, capacity M. LLDB adds a summary provider following the same registration pattern as buffer.py: size=N, capacity=M plus the existing synthetic children. Also rebased onto main to pick up #10563's registration changes. GDB side re-validated end-to-end locally against all 7 scenarios; LLDB golden updated by analogy as before, still unable to execute lldb locally.

@github-project-automation github-project-automation Bot moved this from In Review to In Progress in CCCL Jul 30, 2026
@HenrikGharagyozyan
HenrikGharagyozyan force-pushed the feature/cccl-inplace-vector-pretty-printers branch from a67b543 to bf9c57c Compare July 31, 2026 06:06
@HenrikGharagyozyan
HenrikGharagyozyan force-pushed the feature/cccl-inplace-vector-pretty-printers branch from bf9c57c to 497f9a1 Compare July 31, 2026 06:10

@Jacobfaib Jacobfaib 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 for the contribution!

@github-project-automation github-project-automation Bot moved this from In Progress to In Review in CCCL Jul 31, 2026
@Jacobfaib

Copy link
Copy Markdown
Contributor

/ok to test 497f9a1

@Jacobfaib
Jacobfaib enabled auto-merge (squash) July 31, 2026 11:55
@github-actions

This comment has been minimized.

auto-merge was automatically disabled July 31, 2026 13:57

Head branch was pushed to by a user without write access

@HenrikGharagyozyan
HenrikGharagyozyan force-pushed the feature/cccl-inplace-vector-pretty-printers branch from e505e0a to 4cb7fe1 Compare July 31, 2026 13:57
@HenrikGharagyozyan

Copy link
Copy Markdown
Contributor Author

@Jacobfaib the previous run's only failure was an AWS-credentials infra flake in the CTK13.0 MSVC14.29 build job (died in the sccache credential step before compiling anything — confirmed from the logs, unrelated to this PR). I pushed a fresh commit (4cb7fe1) to retrigger — could you /ok to test it when you get a chance?

@miscco

miscco commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

/ok to test f0eb401

@miscco

miscco commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

I pushed a fresh commit (4cb7fe1) to retrigger — could you /ok to test it when you get a chance?

Next time please just ping us, we can rerun the individual test case rather then restarting CI all over.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⏱️ CCCL compile-time benchmark comparison: Public headers compile-time bench

Result: 6 regression row(s), 2 improvement row(s) above threshold.

Run Value
Config public-headers-gcc13
Baseline origin/main
Preset all-dev
Targets cub.headers.base, thrust.cpp.cuda.headers.base, libcudacxx.test.public_headers
GPU / launch args rtx2080 / --cuda 13.3 --host gcc13

Artifacts: reports and traces

Direct file processing

-f file-processing exclusive --sort total

🔴 Direct file processing — Regressions
Rank Regression impact Selected Δ Baseline Current Event Matched traces
1 1.501287 1.501287 20.146055 21.647342 Processing Header File: libcudacxx/include/cuda/__device/physical_device.h 94
2 0.589791 0.589791 10.731443 11.321234 Processing Header File: libcudacxx/include/cuda/std/__iterator/concepts.h 436
3 0.579078 0.579078 11.156896 11.735974 Processing Header File: libcudacxx/include/cuda/std/__type_traits/type_list.h 475
4 0.229134 0.229134 3.941584 4.170718 Processing Header File: libcudacxx/include/cuda/std/__utility/pair.h 403
5 0.224086 0.224086 5.554515 5.778601 Processing Header File: libcudacxx/include/cuda/std/__iterator/iterator_traits.h 463
6 0.218825 0.218825 2.859223 3.078048 Processing Header File: libcudacxx/include/cuda/std/__ranges/concepts.h 404
🟢 Direct file processing — Improvements
Rank Improvement impact Selected Δ Baseline Current Event Matched traces
1 0.910079 -0.910079 9.682551 8.772472 Processing Header File: libcudacxx/include/cuda/std/__cccl/prologue.h 548
2 0.434356 -0.434356 3.368894 2.934538 Processing Header File: libcudacxx/include/cuda/std/__cccl/epilogue.h 548

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 41m: Pass: 100%/68 | Total: 2d 02h | Max: 2h 10m | Hits: 99%/317355

See results here.

@Jacobfaib
Jacobfaib merged commit 24769fc into NVIDIA:main Aug 3, 2026
92 of 93 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Aug 3, 2026
davebayer pushed a commit to davebayer/cccl that referenced this pull request Aug 4, 2026
…or (NVIDIA#10564)

* [libcudacxx] Add GDB/LLDB pretty-printers for cuda::std::inplace_vector

* [libcudacxx] Print inplace_vector length and capacity like std::vector

* Retrigger CI after AWS-credentials infra flake in MSVC build job

* [libcudacxx] Restore tuple printer registration lost in merge resolution
@HenrikGharagyozyan
HenrikGharagyozyan deleted the feature/cccl-inplace-vector-pretty-printers branch August 7, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[FEA]: Debugger pretty-printers: cuda::std::inplace_vector

3 participants