Update how Dynamo decides to graph break on an OpOverloadPacket (#112200)
Summary:
Previously, under config.only_allow_pt2_compliant_ops, Dynamo graph
breaks when it see an OpOverloadPacket where any overloads are not
PT2 compliant. This is potentially brittle: if someone (unlikely) adds
a new overload for a custom operator, then this would cause a
previously non-graph-breaking call to the OpOverloadPacket to graph break.
In this PR:
- When Dynamo is about to write a call to an operator to the FX graph,
we check if it is PT2 compliant.
- For OpOverload, we check to see if the tag is on it
- For OpOverloadPacket, we do overload resolution and check to see if
the tag is on the OpOverload that it resolves to.
X-link: https://github.com/pytorch/pytorch/pull/112200
Approved by: https://github.com/bdhirsh
Reviewed By: ZainRizvi
Differential Revision: D50873052
Pulled By: zou3519
fbshipit-source-id: c95b9797185f4bfc9edd2eb2e48f73b8dd56154f