Skip to content
Merged
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
9 changes: 6 additions & 3 deletions backends/cadence/aot/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
EdgeProgramManager,
ExecutorchBackendConfig,
ExecutorchProgramManager,
to_edge,
)
from executorch.exir.pass_base import PassResult
from executorch.exir.passes import ToOutVarPass
from executorch.exir.passes.sym_shape_eval_pass import HintBasedSymShapeEvalPass
from executorch.exir.program._program import to_edge_with_preserved_ops
from torch._inductor.decomposition import remove_decompositions
from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e

Expand Down Expand Up @@ -80,6 +80,7 @@ def convert_pt2(
torch.ops.aten.layer_norm.default,
torch.ops.aten.linear.default,
torch.ops.aten.matmul.default,
torch.ops.aten.rms_norm.default,
]
# Remove decompositions for the ops we want to keep
# pyre-fixme[6]: For 1st argument expected `Dict[typing.Callable[..., typing.Any
Expand Down Expand Up @@ -201,9 +202,9 @@ def lower_ep_to_edge(
"""
Lower an ExportedProgram to an EdgeProgramManager (in edge IR).
"""
# Call to_edge to convert the graph to edge IR.
# Call to_edge_with_preserved_ops to convert the graph to edge IR.
# Note: dim_order is skipped (https://github.com/pytorch/executorch/issues/3704)
edge_prog_manager = to_edge(
edge_prog_manager = to_edge_with_preserved_ops(
expo_program,
compile_config=EdgeCompileConfig(
_skip_dim_order=True,
Expand All @@ -216,9 +217,11 @@ def lower_ep_to_edge(
torch.ops.aten.linalg_vector_norm.default,
torch.ops.aten.unfold.default,
torch.ops.aten.angle.default,
torch.ops.aten.rms_norm.default,
],
),
constant_methods=constant_methods,
preserve_ops=(torch.ops.aten.rms_norm.default,),
)

if dump_graphs:
Expand Down
4 changes: 0 additions & 4 deletions backends/cadence/aot/ops_registrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
"int in_zero_point, bool channel_last=False) -> (Tensor out)"
)
lib.define("linalg_vector_norm(Tensor X) -> (Tensor Y)")
lib.define("rms_norm(Tensor X, float eps, Tensor W) -> (Tensor Y)")
lib.define(
"transposed_im2row(Tensor input, int[2] kernel_size, int[2] dilation, int[2] padding, int[2] stride, "
"int[2] output_padding, Tensor in_zero_point, bool channel_last=False) -> (Tensor out)"
Expand Down Expand Up @@ -211,9 +210,6 @@
"fully_connected.out(Tensor input, Tensor weight, Tensor? bias=None, *, Tensor(a!) out) -> Tensor(a!)"
)
lib.define("linalg_vector_norm.out(Tensor X, *, Tensor(a!) out) -> Tensor(a!)")
lib.define(
"rms_norm.out(Tensor X, float eps, Tensor W, *, Tensor(a!) out) -> Tensor(a!)"
)
lib.define(
"quantized_fully_connected.out(Tensor src, Tensor weight, Tensor bias, int src_zero_point, "
"Tensor weight_zero_point, Tensor out_multiplier, Tensor out_shift, int out_zero_point, Tensor? offset, *, Tensor(a!) out) -> Tensor(a!)"
Expand Down