Skip to content

Commit

Permalink
[BE] Add fix suggestions for ops not in core ATen opset error (pytorc…
Browse files Browse the repository at this point in the history
…h#7213)

* [BE] Add fix suggestions for ops not in core ATen opset error

Summary: As titled.

Test Plan: Eye balling

Reviewers:

Subscribers:

Tasks:

Tags:

* Improve wording

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
larryliu0820 authored Dec 6, 2024
1 parent 97a7452 commit 3ea5b77
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion exir/verification/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,17 @@ def check_valid_op(self, op):
# NOTE(qihan): whether view_copy operators are marked as canonical is still under
# discussion.
raise SpecViolationError(
f"Operator {op.__module__}.{op.__name__} is not Aten Canonical."
f"""
Operator {op.__module__}.{op.__name__} is not in Core ATen opset (https://pytorch.org/docs/stable/torch.compiler_ir.html#core-aten-ir)."
There are a few things to try:
1. You can proceed with `to_edge(compile_config=EdgeCompileConfig(_core_aten_ops_exception_list=[torch.ops.{str(op)}]))`.
Please make sure that the backend(s) you are planning to lower to is able to handle {str(op)}, or you have a corresponding kernel linked to your runtime.
2. Sometimes inference and training gives slightly different op set. Try adding `with torch.no_grad():` context manager if you are export for inference only.
3. If the error persists after 2, this is likely caused by torch.export() + core ATen decomposition producing unexpected operators for your model.
If you believe this operator should be included into core ATen opset, please create an issue in https://github.com/pytorch/pytorch/issues and add `module: core aten` tag.
"""
)

ret = _EXIRATenDialectVerifier
Expand Down

0 comments on commit 3ea5b77

Please sign in to comment.