Skip to content

Commit 3ea5b77

Browse files
authored
[BE] Add fix suggestions for ops not in core ATen opset error (#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:
1 parent 97a7452 commit 3ea5b77

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

exir/verification/verifier.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,17 @@ def check_valid_op(self, op):
121121
# NOTE(qihan): whether view_copy operators are marked as canonical is still under
122122
# discussion.
123123
raise SpecViolationError(
124-
f"Operator {op.__module__}.{op.__name__} is not Aten Canonical."
124+
f"""
125+
Operator {op.__module__}.{op.__name__} is not in Core ATen opset (https://pytorch.org/docs/stable/torch.compiler_ir.html#core-aten-ir)."
126+
There are a few things to try:
127+
1. You can proceed with `to_edge(compile_config=EdgeCompileConfig(_core_aten_ops_exception_list=[torch.ops.{str(op)}]))`.
128+
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.
129+
130+
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.
131+
132+
3. If the error persists after 2, this is likely caused by torch.export() + core ATen decomposition producing unexpected operators for your model.
133+
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.
134+
"""
125135
)
126136

127137
ret = _EXIRATenDialectVerifier

0 commit comments

Comments
 (0)