Fix prologue debug line info pointing to decorator instead of def line #746
+51
−3
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.
Fixes nvbug5811746.
The root cause is that, when a kernel function has decorator, the code object's
co_firstlinenopoints to the decorator line rather than thedefline. During IR lowering, prologue code has no explicit source location, soco_firstlinenois used as the default line number. This caused prologue code to incorrectly reference the decorator line in DWARF debug information.The problem can be reproduced with the following code example,
This PR added
_adjust_line_if_prologue()method inlowering.pythat redirects any line number less than thedefline to thedefline. This ensures prologue instructions are associated with the function definition rather than decorators.Before Fix -
.debug_linetable:After Fix -
.debug_linetable:Also added a new test
test_prologue_line_numberwhich passes with the fix, fails without.