Skip to content

Commit 0db8bdd

Browse files
committed
init
1 parent 31c276d commit 0db8bdd

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
@@ -1093,6 +1093,26 @@ def keep(op):
10931093
return list(filter(keep, preserve_ops))
10941094

10951095

1096+
def _can_skip_using_EDGE_DO_NOT_DECOMP(
1097+
partitioner: Dict[str, List[Partitioner]], aten_programs: Dict[str, ExportedProgram]
1098+
) -> bool:
1099+
# THe current design of using EDGE_DO_NOT_DECOMP to prevent decomposition
1100+
# has long standing issues. _remove_invalid_ops_for_not_decompose was a band-aid to
1101+
# fix some of the issues, but more issues are coming up over time, including a new issue with SDPA
1102+
# and contiguous views: https://fb.workplace.com/groups/pytorch.edge.users/permalink/1796069037930048/
1103+
# EDGE_DO_NOT_DECOMP is only needed by partitioners that specify check_op_support
1104+
# As a temp fix, we give a more reliable path for backends that do not specify check_op_support
1105+
can_skip_using_EDGE_DO_NOT_DECOMP = True
1106+
for name, program in aten_programs.items():
1107+
if partitioner is not None:
1108+
for curr_partitioner in partitioner.get(name, []):
1109+
curr_ops_no_decomp, check_op_support = (
1110+
curr_partitioner.ops_to_not_decompose(program)
1111+
)
1112+
if check_op_support is not None:
1113+
can_skip_using_EDGE_DO_NOT_DECOMP = False
1114+
return can_skip_using_EDGE_DO_NOT_DECOMP
1115+
10961116
def _gen_edge_manager_for_partitioners(
10971117
partitioner: Dict[str, List[Partitioner]],
10981118
aten_programs: Dict[str, ExportedProgram],

0 commit comments

Comments
 (0)