Skip to content

Tracking: full device debug metadata for variables and types #226

Open
4 of 4 issues completed
Open

Description

@nihalpasham

Summary

PR #225 adds the first useful device-debug tier: line tables. That gives cuda-gdb source breakpoints, stepping, and basic backtraces.

This issue tracks the larger follow-up: full debug metadata for variables, arguments, and Rust types.

Goal

Make debugger workflows like these possible for device code:

(cuda-gdb) info locals
(cuda-gdb) print idx
(cuda-gdb) print some_struct.field

Likely work

  • carry rustc Body::var_debug_info into the MIR/importer pipeline
  • preserve enough variable/place information through lowering
  • emit DILocalVariable for args and locals
  • emit a useful DIType tree for the first supported Rust type surface
  • emit llvm.dbg.value / equivalent variable location metadata
  • decide how this interacts with optimization, likely including an opt-skip or debug-preserving mode
  • add cuda-gdb validation for local/argument inspection

Non-goal

Line-table source mapping is not tracked here. That is handled by #225.

This issue is about variable/type inspection, not just file/line/column mapping.

Activity

  1. added
    enhancementNew feature or request
    debug infoDebug information in generated PTX/IR (line/source maps)
    llvm-exportTextual LLVM/NVVM IR exporter (llvm-export crate)
    codegenDevice code-generation pipeline (Rust MIR to IR to PTX)
    trackingUmbrella tracking issue
    IR-loweringLowering between dialects (dialect-mir to LLVM dialect)
    on Jun 15, 2026
  2. nihalpasham commented on Jun 16, 2026

    @nihalpasham
    CollaboratorAuthor

    Opened #233 as the first CUDA_OXIDE_DEBUG=full implementation slice.

    What #233 covers:

    rustc var_debug_info
      -> tagged MIR local alloca
      -> LLVM alloca + DILocalVariable + DIType + dbg.declare
      -> LLVM opt may salvage into #dbg_value
      -> cuda-gdb can inspect supported locals/args where locations survive
    

    A few choices from the implementation:

    • full debug skips Pliron mem2reg for now, because Pliron does not yet rewrite dbg.declare into dbg.value
    • LLVM opt -O2 stays enabled, since LLVM can salvage many debug locations itself
    • line-table mode strips only PTX .target ..., debug after llc so source breakpoints stay fast
    • full mode keeps PTX .target ..., debug because cuda-gdb needs it for local/argument inspection

    What remains here:

    • richer Rust type trees: ADTs, tuples, arrays, slices, closures
    • fragments/projections like fields, derefs, destructuring
    • precise lexical scopes
    • constants from var_debug_info
    • Pliron-side debug salvage so optimized passes can produce dbg.value directly
  3. changed the title [-]Track full device debug metadata for variables and types[/-] [+]Tracking: full device debug metadata for variables and types[/+] on Jun 24, 2026
  4. nihalpasham commented on Aug 21, 2026

    @nihalpasham
    CollaboratorAuthor

    cuda-devtools debugger-assessment follow-ups (validated against main 6c5458fe991bbde32c5bee74d87822aef1b5a691):

    Full variable/type debug children:

    Related line-table follow-ups (outside #226's stated scope; see #224/#225):

    External cuda-devtools dependency:

    The trap() versus breakpoint() API question is expected behavior, not an eighth issue: they intentionally match CUDA C++ __trap() and __brkpt().

  5. added this to the cuda oxide v0.5.0 milestone on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    IR-loweringLowering between dialects (dialect-mir to LLVM dialect)codegenDevice code-generation pipeline (Rust MIR to IR to PTX)debug infoDebug information in generated PTX/IR (line/source maps)enhancementNew feature or requestllvm-exportTextual LLVM/NVVM IR exporter (llvm-export crate)trackingUmbrella tracking issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions