Skip to content

Commit 9817e30

Browse files
committed
Remove usages of 'to_edge_with_preserve_ops'
Pull Request resolved: #12471 Replace with to_edge. ghstack-source-id: 296587498 @exported-using-ghexport Differential Revision: [D78311705](https://our.internmc.facebook.com/intern/diff/D78311705/)
1 parent ac5c521 commit 9817e30

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

backends/cadence/aot/compiler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
)
3535
from executorch.exir.passes import ToOutVarPass
3636
from executorch.exir.passes.sym_shape_eval_pass import HintBasedSymShapeEvalPass
37-
from executorch.exir.program._program import to_edge_with_preserved_ops
37+
from executorch.exir.program._program import to_edge
3838
from torch._inductor.decomposition import remove_decompositions
3939

4040
from torch.export.exported_program import ExportedProgram
@@ -219,9 +219,9 @@ def quantize_pt2(
219219
torch.ops.aten.angle.default,
220220
torch.ops.aten.rms_norm.default,
221221
]
222-
TO_EDGE_PRESERVE_OPS: tuple[torch._ops.OpOverload, ...] = (
222+
TO_EDGE_PRESERVE_OPS: list[torch._ops.OpOverload, ...] = [
223223
torch.ops.aten.rms_norm.default,
224-
)
224+
]
225225

226226

227227
def _lower_ep_to_edge(
@@ -233,18 +233,18 @@ def _lower_ep_to_edge(
233233
"""
234234
Lower an ExportedProgram to an EdgeProgramManager (in edge IR).
235235
"""
236-
# Call to_edge_with_preserved_ops to convert the graph to edge IR.
236+
# Call to_edge to convert the graph to edge IR.
237237
# Note: dim_order is skipped (https://github.com/pytorch/executorch/issues/3704)
238-
edge_prog_manager = to_edge_with_preserved_ops(
238+
edge_prog_manager = to_edge(
239239
expo_program,
240240
compile_config=EdgeCompileConfig(
241241
_skip_dim_order=True,
242242
# Allow specific non-core aten ops in the IR.
243243
_core_aten_ops_exception_list=TO_EDGE_OP_EXCEPTION_LIST
244244
+ (core_aten_exceptions or []),
245+
_preserve_ops=TO_EDGE_PRESERVE_OPS,
245246
),
246247
constant_methods=constant_methods,
247-
preserve_ops=TO_EDGE_PRESERVE_OPS,
248248
)
249249

250250
if dump_graphs:

examples/apple/coreml/llama/export.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from executorch.exir.passes import MemoryPlanningPass
2828
from executorch.exir.passes.quant_fusion_pass import QuantFusionPass
2929
from executorch.exir.passes.sym_shape_eval_pass import ConstraintBasedSymShapeEvalPass
30-
from executorch.exir.program._program import to_edge_with_preserved_ops
30+
from executorch.exir.program._program import to_edge
3131
from executorch.extension.export_util.utils import save_pte_program
3232

3333

@@ -196,17 +196,17 @@ def main() -> None:
196196
print("Exported program")
197197
print(ep)
198198

199-
edge_manager = to_edge_with_preserved_ops(
199+
edge_manager = to_edge(
200200
ep,
201-
preserve_ops=[
202-
torch.ops.aten.scaled_dot_product_attention.default,
203-
# preserve norm op for numerical stability
204-
torch.ops.aten.linalg_vector_norm.default,
205-
torch.ops.aten.reciprocal.default,
206-
],
207201
compile_config=EdgeCompileConfig(
208202
_check_ir_validity=False,
209203
_skip_dim_order=True,
204+
_preserve_ops=[
205+
torch.ops.aten.scaled_dot_product_attention.default,
206+
# preserve norm op for numerical stability
207+
torch.ops.aten.linalg_vector_norm.default,
208+
torch.ops.aten.reciprocal.default,
209+
],
210210
),
211211
)
212212
print("Edge program")

0 commit comments

Comments
 (0)