Repository navigation
debug: describe AS1 device globals - #1128
Conversation
Reworked onto main's #1186 device-global declaration cache: debug identity rides DeviceGlobalDeclaration as an equality-checked field instead of a parallel record type, the promoted-key fingerprint keeps main's align component under the domain tag, and the encoder covers the TypedPointer debug type from #1126. Signed-off-by: nihalp <[email protected]>
…storage #1186 tightened classify_union_constant_storage so SharedRef union alternatives with different pointee types fail closed. That is right for SSA reconstruction, which mints the carrier field's own reference type and could claim validity for a pointee the program never wrote. But the device-static initializer gate shares the classifier while emitting only exact bytes plus one integer-width relocation slot; no typed reference is ever minted, and device code reads the storage through its own field types. Release builds hid the regression because optimized MIR folds the example's union load away; any unoptimized device build (including CUDA_OXIDE_DEBUG=full) materializes the static and failed to compile device_global's documented union { word: &'static u32, byte: &'static u8 } shape. Thread a UnionConstantUse through the classifier so the SSA path keeps the pointee-identity rejection and the physical-storage gate does not, and cover the SharedRef mixed-pointee shape at both call sites. Signed-off-by: nihalp <[email protected]>
a57bc93 to
c404327
Compare
|
Notes from the rebase onto post-#1186 main, for the record. The rework went beyond conflict resolution in three ways: 1. Latent #1186 regression found and fixed here. Full-debug builds of this PR's own The rejection is load-bearing on the SSA-reconstruction path (it mints a value of the carrier field's reference type) but was firing on the physical-storage path too, where no typed reference is ever created: the static lowers to raw bytes plus one integer relocation slot, and provenance rides the relocation symbolically ( 2. Structure folded into #1186 instead of duplicating it. #1186 independently landed 3. Small #1126 catch-up: Follow-ups noted, not blocking: (a) the mixed-union rejection on the SSA path is covered at unit level only; an end-to-end negative driving |
Summary
Ordinary Rust device statics now keep their source name and Rust type all the
way to the generated AS1 storage, so cuda-gdb can inspect them by their
qualified name.
Closes #1120.
Changes
Rust type through the full-debug pipeline.
so same-leaf statics and promoted constants cannot collide.
linkageName.Qualified lookup is the correctness boundary. Unqualified lookup is contextual
in cuda-gdb; AS3 shared and AS4 constant-memory debug metadata stay separate.
Testing
Importer, lowering, exporter, backend, strict Clippy, LLVM-verifier, and
debug-mode checks passed on
ac0282c4.Final head
a57bc934only formats the device-global example; the exactper-example formatter gate now passes.
CUDA 13.3 / RTX 5090:
debuginfo::GLOBAL_COUNTERis@global u64 = 0.Same-leaf and opposite-block controls keep distinct values, addresses,
relocations, and DIEs; repeated references deduplicate.
just checkpasses (affected suites and validators pass)Live GPU debugger regression exercised
New example added (existing device-global example extended)
Checklist
git commit -s)