Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions exir/passes/debug_handle_generator_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_control_flow_submodules_list(graph_module):
for node in current_graph_module.graph.nodes:
if "debug_handle" in node.meta:
max_handle = max(max_handle, node.meta["debug_handle"])
control_flow_submodules = get_control_flow_submodules_list(ep.graph_module)
control_flow_submodules = get_control_flow_submodules_list(current_graph_module)
queue.extend(control_flow_submodules)

queue = [ep.graph_module]
Expand All @@ -61,5 +61,5 @@ def get_control_flow_submodules_list(graph_module):
if node.meta.get("debug_handle", 0) in (0, None):
node.meta["debug_handle"] = max_handle + 1
max_handle += 1
control_flow_submodules = get_control_flow_submodules_list(ep.graph_module)
control_flow_submodules = get_control_flow_submodules_list(current_graph_module)
queue.extend(control_flow_submodules)
16 changes: 7 additions & 9 deletions exir/tests/test_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,16 +1018,13 @@ def forward(
torch.ones(2, 2),
)

graph_module = (
to_edge(
export(
f,
inputs,
)
ep = to_edge(
export(
f,
inputs,
)
.exported_program()
.graph_module
)
).exported_program()
graph_module = ep.graph_module

def check_debug_handle_metadata(graph_module: torch.fx.GraphModule) -> None:
queue = [graph_module]
Expand All @@ -1045,6 +1042,7 @@ def check_debug_handle_metadata(graph_module: torch.fx.GraphModule) -> None:

DebugHandleGeneratorPass()(graph_module)
check_debug_handle_metadata(graph_module)
generate_missing_debug_handles(ep)

# Check debug handle still preserved after ScalarToTensorPass
ScalarToTensorPass()(graph_module)
Expand Down
Loading