-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Add stack_trace on make_fx #155155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add stack_trace on make_fx #155155
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/155155
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 2 Cancelled Jobs, 2 Unrelated FailuresAs of commit 3291286 with merge base 1ccc57e ( NEW FAILURE - The following job has failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D75985427 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paraphrased from @zou3519: can we check that the stacktrace added here doesn't affect torch.compile node stacktraces, where dynamo generates the stacktrace, and then this codepath gets called in AOTAutograd?
pretty sure this code doesn't affect the torch.compile stacktraces because of the if "stack_trace" not in node.meta
conditional, but let's just check to make sure
Yep it's still there!
|
This pull request was exported from Phabricator. Differential Revision: D75985427 |
7985ed6
to
1aa6596
Compare
Summary: Pull Request resolved: pytorch#155155 Previosuly, we only add stack trace in `class _ModuleStackTracer(PythonKeyTracer)` for non-strict export. I moved this stack trace logic to the parent class `PythonKeyTracer`, this way the graph traced from Module using make_fx will have stack_trace as well. Motivation: we've observed some uses cases where users first use `make_fx` on the Module, and then run `export` on the resulting graph. If the result of `make_fx` doesn't have stack trace, the stack trace information is lost. Test Plan: ``` buck run test:test_export -- -r test_stack_trace ``` Rollback Plan: Reviewed By: angelayi Differential Revision: D75985427
frame.filename.endswith("fx/_symbolic_trace.py") | ||
or frame.filename.endswith("export/_trace.py") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frame.filename.endswith("fx/_symbolic_trace.py") | |
or frame.filename.endswith("export/_trace.py") | |
frame.filename.endswith(("fx/_symbolic_trace.py", "export/_trace.py")) |
More readable and more efficient (does trie based matching).
Summary: Previosuly, we only add stack trace in `class _ModuleStackTracer(PythonKeyTracer)` for non-strict export. I moved this stack trace logic to the parent class `PythonKeyTracer`, this way the graph traced from Module using make_fx will have stack_trace as well. Motivation: we've observed some uses cases where users first use `make_fx` on the Module, and then run `export` on the resulting graph. If the result of `make_fx` doesn't have stack trace, the stack trace information is lost. Test Plan: ``` buck run test:test_export -- -r test_stack_trace ``` Rollback Plan: Reviewed By: angelayi Differential Revision: D75985427
1aa6596
to
b62d804
Compare
This pull request was exported from Phabricator. Differential Revision: D75985427 |
Summary: Pull Request resolved: pytorch#155155 Previosuly, we only add stack trace in `class _ModuleStackTracer(PythonKeyTracer)` for non-strict export. I moved this stack trace logic to the parent class `PythonKeyTracer`, this way the graph traced from Module using make_fx will have stack_trace as well. Motivation: we've observed some uses cases where users first use `make_fx` on the Module, and then run `export` on the resulting graph. If the result of `make_fx` doesn't have stack trace, the stack trace information is lost. Test Plan: ``` buck run test:test_export -- -r test_stack_trace ``` Rollback Plan: Reviewed By: angelayi Differential Revision: D75985427
b62d804
to
7bb1fd7
Compare
Summary: Previosuly, we only add stack trace in `class _ModuleStackTracer(PythonKeyTracer)` for non-strict export. I moved this stack trace logic to the parent class `PythonKeyTracer`, this way the graph traced from Module using make_fx will have stack_trace as well. Motivation: we've observed some uses cases where users first use `make_fx` on the Module, and then run `export` on the resulting graph. If the result of `make_fx` doesn't have stack trace, the stack trace information is lost. Test Plan: ``` buck run test:test_export -- -r test_stack_trace ``` Rollback Plan: Reviewed By: angelayi Differential Revision: D75985427
7bb1fd7
to
3291286
Compare
This pull request was exported from Phabricator. Differential Revision: D75985427 |
Summary:
Previosuly, we only add stack trace in
class _ModuleStackTracer(PythonKeyTracer)
for non-strict export. I moved this stack trace logic to the parent classPythonKeyTracer
, this way the graph traced from Module using make_fx will have stack_trace as well.Motivation: we've observed some uses cases where users first use
make_fx
on the Module, and then runexport
on the resulting graph. If the result ofmake_fx
doesn't have stack trace, the stack trace information is lost.Test Plan:
Rollback Plan:
Differential Revision: D75985427
cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv