Repository navigation
fix(mir-importer): keep loop-hint marker branches off the attribute line - #1677
Merged
nihalpasham merged 2 commits intoNov 3, 2026
Merged
Conversation
Under full device debug, the branch that replaces each `#[unroll]`, `#[unroll(N)]`, `#[unroll(never)]` and `#[nounroll]` marker call kept the call's location, which is the attribute. The attribute line therefore landed in the loop's line table: all 38 such attributes in unroll_smoke and all 8 in nounroll had a `.loc` on a branch inside their loop. Line-tables builds were unaffected, since that branch does not survive optimization. Give the branch the artificial location, as NVIDIA#1125 does for the edges that replace the kernel metadata markers. The hint op keeps the attribute's location, which the not-unrolled warnings cite. The debug example gains `loop_hint_test`, one loop per marker spelling, and its verify-code-shape.sh now rejects any LLVM IR or PTX location on those attribute lines while requiring each loop body to keep its own. The script's LLVM IR and PTX helpers take the kernel name, so the kernel-entry and loop-hint contracts share them. Closes NVIDIA#1676. Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
Thanks, this is the right fix and matches how
At |
nihalpasham
approved these changes
Nov 3, 2026
Signed-off-by: nihalpasham <[email protected]>
nihalpasham
previously approved these changes
Nov 3, 2026
Collaborator
|
/ok to test 64c437c |
nihalpasham
approved these changes
Nov 3, 2026
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.
What This PR Does
Uses
llvm_export::artificial_debug_location()for the syntheticMirGotoOpemitted whenmir-importerreplaces__unroll_configand__nounroll_configloop-hint markers, keeping#[unroll]and#[nounroll]attribute lines out of--device-debugline tables while preserving the attribute span onMirUnrollHintOp/MirNoUnrollHintOpfor not-unrolled diagnostics.Why the Attribute Line Appeared in
--device-debug#[kernel]and#[device]inject a__unroll_config/__nounroll_configmarker call at the top of every annotated loop.mir-importerreplaces that call with a hint op plus aMirGotoOp. Previously, theMirGotoOpinherited the marker call's source location (the attribute line), so under--device-debug(-O0), the unoptimizedbra.uniemitted.locpointing at the attribute line (38 of 38 loops inunroll_smoke).--device-debug.loc: before -> afterunroll_smoke38 of 38->0nounroll8 of 8->0Verification
examples/debug): Addsloop_hint_testcovering#[unroll],#[unroll(4)],#[unroll(never)], and#[nounroll];verify-code-shape.shrejects any LLVM IR!dbgor PTX.locon those attribute lines while verifying each loop body keeps its own line (debug kernel-entry and loop-hint lineinfo shape: PASS).RTX 5090,sm_120a):debugruns clean undercompute-sanitizer --tool memcheck(0 errors).cargo test -p mir-importer --all-targets(1,234/1,234 PASS),just fmt-check,cargo clippy, and repository guards all pass.Closes #1676