benchmark
63e957cc - Add torch function mode stack guard to dynamo (#133130)

Commit
1 year ago
Add torch function mode stack guard to dynamo (#133130) Summary: This PR adds a guard on the torch function mode stack state at the beginning of tracing. The way this is implemented is via a new leaf guard which is passed the initial stack state at construction and compares it to the stack state at the time the guard is run. Details: The stack state is extracted via popping all modes, appending them to a list, and pushing all modes back. This list is stored on the output graph and read during guard construction to pass to the stack mode guard. There the length and types of the modes are recorded. Next time the guard is run it compares this recorded state to the current mode stack state. To implement this in python a helper function was added to utils.py and this is used if cpp guards are not enabled. X-link: https://github.com/pytorch/pytorch/pull/133130 Approved by: https://github.com/anijain2305 Reviewed By: jeanschmidt Differential Revision: D61541459 Pulled By: mlazos fbshipit-source-id: cc5fa3b714aa35c2205ac8c0aef7037a56b0c090
Author
Parents
Loading