Skip to content

Commit a21d569

Browse files
committed
init
1 parent f4d50a1 commit a21d569

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

exir/program/_program.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,26 @@ def keep(op):
10761076
return list(filter(keep, preserve_ops))
10771077

10781078

1079+
def _can_skip_using_EDGE_DO_NOT_DECOMP(
1080+
partitioner: Dict[str, List[Partitioner]], aten_programs: Dict[str, ExportedProgram]
1081+
) -> bool:
1082+
# THe current design of using EDGE_DO_NOT_DECOMP to prevent decomposition
1083+
# has long standing issues. _remove_invalid_ops_for_not_decompose was a band-aid to
1084+
# fix some of the issues, but more issues are coming up over time, including a new issue with SDPA
1085+
# and contiguous views: https://fb.workplace.com/groups/pytorch.edge.users/permalink/1796069037930048/
1086+
# EDGE_DO_NOT_DECOMP is only needed by partitioners that specify check_op_support
1087+
# As a temp fix, we give a more reliable path for backends that do not specify check_op_support
1088+
can_skip_using_EDGE_DO_NOT_DECOMP = True
1089+
for name, program in aten_programs.items():
1090+
if partitioner is not None:
1091+
for curr_partitioner in partitioner.get(name, []):
1092+
curr_ops_no_decomp, check_op_support = (
1093+
curr_partitioner.ops_to_not_decompose(program)
1094+
)
1095+
if check_op_support is not None:
1096+
can_skip_using_EDGE_DO_NOT_DECOMP = False
1097+
return can_skip_using_EDGE_DO_NOT_DECOMP
1098+
10791099
def _gen_edge_manager_for_partitioners(
10801100
partitioner: Dict[str, List[Partitioner]],
10811101
aten_programs: Dict[str, ExportedProgram],

0 commit comments

Comments
 (0)