Repository navigation
debug: keep generated kernel prologue off attribute lines - #1125
Merged
Merged
Conversation
Signed-off-by: nihalp <[email protected]>
Signed-off-by: nihalp <[email protected]>
nihalpasham
force-pushed
the
fix/debug-kernel-prologue-lineinfo
branch
from
August 28, 2026 11:31
63ce7c7 to
b1e74c2
Compare
nihalpasham
marked this pull request as ready for review
August 28, 2026 12:05
4 of 5 tasks
This was referenced Oct 30, 2026
nihalpasham
added a commit
that referenced
this pull request
Nov 3, 2026
…ine (#1677) ## What This PR Does Uses `llvm_export::artificial_debug_location()` for the synthetic `MirGotoOp` emitted when `mir-importer` replaces `__unroll_config` and `__nounroll_config` loop-hint markers, keeping `#[unroll]` and `#[nounroll]` attribute lines out of `--device-debug` line tables while preserving the attribute span on `MirUnrollHintOp` / `MirNoUnrollHintOp` for not-unrolled diagnostics. --- ### Why the Attribute Line Appeared in `--device-debug` `#[kernel]` and `#[device]` inject a `__unroll_config` / `__nounroll_config` marker call at the top of every annotated loop. `mir-importer` replaces that call with a hint op plus a `MirGotoOp`. Previously, the `MirGotoOp` inherited the marker call's source location (the attribute line), so under `--device-debug` (`-O0`), the unoptimized `bra.uni` emitted `.loc` pointing at the attribute line (38 of 38 loops in `unroll_smoke`). ```text BEFORE (cargo oxide build unroll_smoke --device-debug): $L__BB0_16: .loc 1 80 9 // main.rs:80:9 (the #[unroll] attribute line) bra.uni $L__BB0_17; AFTER (with artificial_debug_location() on the marker goto): $L__BB0_16: .loc 1 0 0 // artificial location (matches #1125 kernel metadata markers) bra.uni $L__BB0_17; ``` | `--device-debug` | Attribute lines with a `.loc`: before -> after | |:-----------------|:-----------------------------------------------| | `unroll_smoke` | `38 of 38` -> `0` | | `nounroll` | `8 of 8` -> `0` | --- ## Verification * **Regression (`examples/debug`)**: Adds `loop_hint_test` covering `#[unroll]`, `#[unroll(4)]`, `#[unroll(never)]`, and `#[nounroll]`; `verify-code-shape.sh` rejects any LLVM IR `!dbg` or PTX `.loc` on those attribute lines while verifying each loop body keeps its own line (`debug kernel-entry and loop-hint lineinfo shape: PASS`). * **GPU Execution (`RTX 5090`, `sm_120a`)**: `debug` runs clean under `compute-sanitizer --tool memcheck` (`0 errors`). * **Tests & CI Gates**: `cargo test -p mir-importer --all-targets` (`1,234/1,234 PASS`), `just fmt-check`, `cargo clippy`, and repository guards all pass. Closes #1676 Signed-off-by: Vyncint Ng <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Kernel-name breakpoints no longer treat
#[kernel]as executable source.Compiler-generated setup uses an artificial line, while the user's index call
keeps its real span.
Closes #1117.
Changes
attribute line.
Testing
Full macro/importer/exporter/lowering suites passed on
af66e381.Final head
63ce7c7epassescargo test -p cuda-device --all-targets,including all 29 thread-index compile-fail cases; the hosted check that
exposed the stale snapshots is now green.
The debug compile-only smoketest and PTX shape gate pass.
CUDA 13.3 / RTX 5090: the T01 shape stops on the first body expression; the
multi-attribute control stops on line 35, not lines 32/33.
just checkpasses (affected suites and targeted smoketest pass)Live GPU debugger regression exercised
New example added (existing debug example extended)
Checklist
git commit -s)