Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions thunder/core/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ def visitor_transform(trace_from: Trace, visit: Callable, *, provenance: None |
scope = []
trc.push_scope(scope)

# Attribute recorded operations, including subsymbols, to the visited operation.
trc.set_current_source_location(bsym.source_filename, bsym.source_positions)
visit_type = visit(bsym)

if visit_type is VISIT_TYPE.INSERT_AFTER:
Expand All @@ -409,6 +411,7 @@ def visitor_transform(trace_from: Trace, visit: Callable, *, provenance: None |
trc.bound_symbols.append(bsym)

finally:
trc.set_current_source_location(None, None)
# Restores the trc's scope
trc.pop_scope()

Expand Down