You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building a CUDA kernel with cuda-oxide, the resulting PTX (and complete program does not contain any debugging information for the device code, thus making debugging with cuda-gdb pretty hard.
Hey - funny timing, I was poking at this on a private branch over the last couple weeks and landed somewhere a bit different on the first step. Wanted to compare notes before either of us pushes further.
What I did as step 1: just LineTablesOnly, gated behind a debug_level flag on ExportBackendConfig that defaults to None. Reasoning is that it's what cuda-gdb line stepping and Nsight source-view actually consume - turns out you get ~all of the practical debugging value from just DIFile + DICompileUnit(emissionKind: LineTablesOnly) + DISubprogram + DILocation, no DISubroutineType, no types, no locals, way smaller surface for a first cut. The off-by-default config gate also means existing snapshot tests stay byte-identical, so it can land without coordinating with anyone else's work, and we get to iterate on the DI shape without flipping it on for every consumer.
Two structural things fell out of doing it that way, curious whether you'd push back. First, I put the builder + current scope on ModuleExportState (state.debug: Option) rather than threading (scope_ref, registry) through export_function → export_block → export_op — mostly because as soon as we add locals in a later phase, I didn't want to touch every emit helper's signature again. Second, I changed export_op to return whether it emitted an instruction and the caller appends !dbg !N, so the per-helper writeln!s stay intact - avoids the "clone output and diff" thing, which yeah, you flagged yourself. If you want, happy to chat about this
I opened #225 for the first useful piece of this: line-table debug metadata for device code.
The PR does not try to do full local-variable/type debug info yet. It focuses on making source-line mapping work end to end: Rust span -> LLVM !dbg -> PTX .file / .loc -> cuda-gdb source breakpoints and backtraces.
Quick manual smoke on vecadd is already working: cuda-gdb stops in device code and shows frames for both cuda-device/src/thread.rs and the user kernel in src/main.rs.
Activity
Barrow099 commentedon Jun 3, 2026
My attempt to add this information is ongoing in #106.
fbrv commentedon Jun 12, 2026
Hey - funny timing, I was poking at this on a private branch over the last couple weeks and landed somewhere a bit different on the first step. Wanted to compare notes before either of us pushes further.
What I did as step 1: just LineTablesOnly, gated behind a debug_level flag on ExportBackendConfig that defaults to None. Reasoning is that it's what cuda-gdb line stepping and Nsight source-view actually consume - turns out you get ~all of the practical debugging value from just DIFile + DICompileUnit(emissionKind: LineTablesOnly) + DISubprogram + DILocation, no DISubroutineType, no types, no locals, way smaller surface for a first cut. The off-by-default config gate also means existing snapshot tests stay byte-identical, so it can land without coordinating with anyone else's work, and we get to iterate on the DI shape without flipping it on for every consumer.
Two structural things fell out of doing it that way, curious whether you'd push back. First, I put the builder + current scope on ModuleExportState (state.debug: Option) rather than threading (scope_ref, registry) through export_function → export_block → export_op — mostly because as soon as we add locals in a later phase, I didn't want to touch every emit helper's signature again. Second, I changed export_op to return whether it emitted an instruction and the caller appends !dbg !N, so the per-helper writeln!s stay intact - avoids the "clone output and diff" thing, which yeah, you flagged yourself. If you want, happy to chat about this
nihalpasham commentedon Jun 15, 2026
I opened #225 for the first useful piece of this: line-table debug metadata for device code.
The PR does not try to do full local-variable/type debug info yet. It focuses on making source-line mapping work end to end: Rust span -> LLVM
!dbg-> PTX.file/.loc-> cuda-gdb source breakpoints and backtraces.Quick manual smoke on
vecaddis already working: cuda-gdb stops in device code and shows frames for bothcuda-device/src/thread.rsand the user kernel insrc/main.rs.nihalpasham commentedon Jun 15, 2026
Quick update: PR #225 should close the line-table/source-mapping part of this.
It makes cuda-oxide emit real device debug metadata when debug is enabled:
!dbg,DICompileUnit,DISubprogram,DILocation.target ..., debug,.file, and.locThis does not try to solve full variable/type inspection yet, so things like
info locals/print xare tracked separately in #226.fbrv commentedon Jun 15, 2026
Remove LLVM setup in CI (no longer required) (NVIDIA#105)