38
38
from executorch .exir .debug_handle_utils import (
39
39
DEBUG_HANDLE_KEY ,
40
40
get_greatest_ancestor_node_identifier ,
41
+ UNSET_DEBUG_HANDLE ,
41
42
)
42
43
43
44
from executorch .exir .graph_module import bfs_trace_with_node_process
@@ -950,7 +951,7 @@ def propagate_back_debug_handle(
950
951
where op1_0 is from op1, op3_0 and op3_1 are from op3, op2 is removed by to_edge pipeline (e.g. RemoveNoopPass).
951
952
952
953
Then debug handle of op1 should be same as op1_0, and debug handle of op3 should be same as op3_0 and op3_1.
953
- The debug handle of op2 will be a non-existing debug handle in edge dialect program for further skipping.
954
+ The debug handle of op2 will be UNSET_DEBUG_HANDLE for further skipping.
954
955
955
956
Return: True if:
956
957
a. every debug handle in the edge dialect program has a corresponding node in the exported program
@@ -971,11 +972,6 @@ def propagate_back_debug_handle(
971
972
# number of nodes in the exported program that have matched entry in export_graph_node_id_to_debug_handle
972
973
n_matched_node = 0
973
974
974
- # debug handle for the node in the exported program but not in the edge dialect program
975
- debug_handle_for_removed_node = (
976
- max (export_graph_node_id_to_debug_handle .values ()) + 1
977
- )
978
-
979
975
def _find_n_match_node (node : torch .fx .Node ) -> None :
980
976
nonlocal n_matched_node
981
977
if node .name in ("output" , "placeholder" ):
@@ -991,7 +987,7 @@ def _equip_debug_handle(node: torch.fx.Node) -> None:
991
987
if node_id in export_graph_node_id_to_debug_handle :
992
988
node .meta [DEBUG_HANDLE_KEY ] = export_graph_node_id_to_debug_handle [node_id ]
993
989
else :
994
- node .meta [DEBUG_HANDLE_KEY ] = debug_handle_for_removed_node
990
+ node .meta [DEBUG_HANDLE_KEY ] = UNSET_DEBUG_HANDLE
995
991
996
992
bfs_trace_with_node_process (exported_program .graph_module , _find_n_match_node )
997
993
0 commit comments