Skip to content

[libcudacxx] Fix complex pretty-printers for packed half layouts - #11222

Open
theo-ai-lab wants to merge 1 commit into
NVIDIA:mainfrom
theo-ai-lab:fix/libcudacxx-complex-packed-printers
Open

[libcudacxx] Fix complex pretty-printers for packed half layouts#11222
theo-ai-lab wants to merge 1 commit into
NVIDIA:mainfrom
theo-ai-lab:fix/libcudacxx-complex-packed-printers

Conversation

@theo-ai-lab

Copy link
Copy Markdown

Description

closes #11221

Fixes the GDB and LLDB pretty-printers for the packed libcu++ complex specializations:

  • cuda::std::complex<__half>
  • cuda::std::complex<__nv_bfloat16>

The generic complex layout stores __re_ and __im_, while these specializations store a packed __repr_ whose x and y children are the real and imaginary components. Both existing printers assumed the generic layout.

This change makes the printers layout-driven:

  • GDB uses __re_/__im_ when present and falls back to __repr_.x/__repr_.y.
  • LLDB reads non-synthetic object children, applies the same fallback, and clones the actual values as real and imag instead of synthesizing children by byte offset.
  • The debugger fixture and GDB/LLDB goldens now cover both packed layouts with exactly representable values.

Validation

  • Full pre-commit gate on the six changed files, including the repository secret scan, formatting, Ruff, mypy, and codespell.
  • Python bytecode compilation and focused mock-object tests for generic and packed GDB/LLDB paths.
  • Real LLDB execution against a host-side layout probe, confirming the packed children render as real and imag with the expected raw half/bfloat16 values.

This macOS host has no CUDA Toolkit or GDB, so the repository's Linux CUDA debugger CI remains the end-to-end validation for the CUDA-compiled GDB golden.

Checklist

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

Signed-off-by: theo-ai-lab <217547998+theo-ai-lab@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 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 Sep 4, 2026
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4d9bf91e-396d-4cd9-bdfd-6b99b94acf2e

📥 Commits

Reviewing files that changed from the base of the PR and between 486de1c and 53d5dab.

📒 Files selected for processing (6)
  • libcudacxx/share/libcudacxx/gdb/complex.py
  • libcudacxx/share/libcudacxx/lldb/complex.py
  • libcudacxx/test/debugging/complex/CMakeLists.txt
  • libcudacxx/test/debugging/complex/gdb.expected
  • libcudacxx/test/debugging/complex/lldb.expected
  • libcudacxx/test/debugging/complex/source.cu

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Improved debugger display of CUDA complex values using half-precision and bfloat16 components.
    • Added support for reading complex real and imaginary values across GDB and LLDB representations.
  • Tests

    • Added debugger coverage and expected output for cuda::std::complex values using half-precision and bfloat16 types.
    • Verified inspection of encoded real and imaginary component values in both supported debuggers.

Walkthrough

GDB and LLDB complex pretty-printers now support direct __re_/__im_ fields and packed __repr_.x/__repr_.y fields. Debugger tests cover __half and __nv_bfloat16 complex values.

Changes

Complex debugger support

Layer / File(s) Summary
Resolve direct and packed layouts
libcudacxx/share/libcudacxx/gdb/complex.py, libcudacxx/share/libcudacxx/lldb/complex.py
GDB and LLDB resolve direct components first, then use packed representation fields. LLDB clones resolved children instead of creating offset-based children.
Validate packed complex layouts
libcudacxx/test/debugging/complex/*
The debugger test program and expected outputs cover cuda::std::complex<__half> and cuda::std::complex<__nv_bfloat16> in GDB and LLDB.

Assessment against linked issues

Objective Addressed Explanation
Support direct __re_/__im_ and packed __repr_.x/__repr_.y layouts in both pretty-printers [#11221]

Suggested reviewers: jacobfaib

Merge Risk: ⚪ Minimal · up to 53d5d

The debugger formatters now display real and imaginary components for packed half and bfloat16 complex values, with matching debugger coverage. No merge-blocking risk is identified.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[BUG]: Complex debugger printers mishandle packed half layouts

1 participant