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
torch/csrc/profiler/README.md - stubs, RecordFunction, Autograd interaction #108470
torch/csrc/profiler/README.md - stubs, RecordFunction, Autograd interaction #108470
Conversation
Technical details about the profiler. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/108470
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 1 Pending, 2 Unrelated FailuresAs of commit e249949 with merge base bde75eb (): UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Technical details about the profiler. ghstack-source-id: 1a8123894b5fe4237e33a97eb884d3a2312371b8 Pull Request resolved: #108470
Technical details about the profiler. [ghstack-poisoned]
Technical details about the profiler. ghstack-source-id: 3a69bad5dac53f14d2b2ed84c184b79d63d0f301 Pull Request resolved: #108470
@davidberard98 Thanks for putting this readme together. Is this PR currently a WIP or are you planning to commit it as is? |
@anupambhatnagar I was planning to land it as is - not sure I have a good enough understanding of the other parts to write about them clearly right now. |
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.
Overall looks great, added a few small comments. This is a great addition to the profiler docs, and a good start for further sections.
Also, wondering since RecordFunction is a C++ struct, should we annotate it as code? Like RecordFunction
?
torch/csrc/profiler/README.md
Outdated
The profiler instruments PyTorch to collect information about the model's execution. Its main features are: | ||
* Instrumenting op calls on the CPU side | ||
* Interfacing with [Kineto](https://github.com/pytorch/kineto/) to collect information from the GPU (or other accelerators) | ||
* Collecting python stacktraces |
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.
* Collecting python stacktraces | |
* Collecting python stack traces |
torch/csrc/profiler/README.md
Outdated
|
||
RecordFunction is used by the profiler to instrument CPU-side events. | ||
|
||
RecordFunction is a general method of instrumenting function calls in pytorch. It can be used for other general applications, e.g. see [Features for Large-Scale Deployments](https://pytorch.org/docs/stable/notes/large_scale_deployments.html). In PyTorch, it is already included at some important locations; notably, in the [dispatcher](https://github.com/pytorch/pytorch/blob/247c603da9b780534e25fb1d90b6e5a528b625b1/aten/src/ATen/core/dispatch/Dispatcher.h#L650), surrounding every op. |
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.
RecordFunction is a general method of instrumenting function calls in pytorch. It can be used for other general applications, e.g. see [Features for Large-Scale Deployments](https://pytorch.org/docs/stable/notes/large_scale_deployments.html). In PyTorch, it is already included at some important locations; notably, in the [dispatcher](https://github.com/pytorch/pytorch/blob/247c603da9b780534e25fb1d90b6e5a528b625b1/aten/src/ATen/core/dispatch/Dispatcher.h#L650), surrounding every op. | |
RecordFunction is a general method of instrumenting function calls in PyTorch. It can be used for other general applications, e.g. see [Features for Large-Scale Deployments](https://pytorch.org/docs/stable/notes/large_scale_deployments.html). In PyTorch, it is already included at some important locations; notably, in the [dispatcher](https://github.com/pytorch/pytorch/blob/247c603da9b780534e25fb1d90b6e5a528b625b1/aten/src/ATen/core/dispatch/Dispatcher.h#L650), surrounding every op. |
torch/csrc/profiler/README.md
Outdated
|
||
RecordFunction is a general method of instrumenting function calls in pytorch. It can be used for other general applications, e.g. see [Features for Large-Scale Deployments](https://pytorch.org/docs/stable/notes/large_scale_deployments.html). In PyTorch, it is already included at some important locations; notably, in the [dispatcher](https://github.com/pytorch/pytorch/blob/247c603da9b780534e25fb1d90b6e5a528b625b1/aten/src/ATen/core/dispatch/Dispatcher.h#L650), surrounding every op. | ||
|
||
Users (or PyTorch itself) can register callbacks that will be executed whenever a RecordFunction guard is encountered. The profiler uses this mechanism to record the start and end times for each op call, as well as user-provided RecordFunction anntations. The RecordFunction machinery is designed to have relatively low overhead, especially when there are no callbacks registered. Nevertheless, there can still be some overhead. |
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.
Users (or PyTorch itself) can register callbacks that will be executed whenever a RecordFunction guard is encountered. The profiler uses this mechanism to record the start and end times for each op call, as well as user-provided RecordFunction anntations. The RecordFunction machinery is designed to have relatively low overhead, especially when there are no callbacks registered. Nevertheless, there can still be some overhead. | |
Users (or PyTorch itself) can register callbacks that will be executed whenever a RecordFunction guard is encountered. The profiler uses this mechanism to record the start and end times for each op call, as well as user-provided RecordFunction annotations. The RecordFunction machinery is designed to have relatively low overhead, especially when there are no callbacks registered. Nevertheless, there can still be some overhead. |
…ograd interaction" Technical details about the profiler - stubs for the stuff I haven't had time to fill out yet, plus details about RecordFunction and the profiler's interaction with autograd. reviewers - see https://github.com/pytorch/pytorch/blob/06c41eea9e37b5799e4f14601c95fa7810297759/torch/csrc/profiler/README.md for rendered markdown [ghstack-poisoned]
Technical details about the profiler. ghstack-source-id: 3b9d5a61170fd9c493a3a51d72fbfca462c2f376 Pull Request resolved: #108470
…ograd interaction" Technical details about the profiler - stubs for the stuff I haven't had time to fill out yet, plus details about RecordFunction and the profiler's interaction with autograd. reviewers - see https://github.com/pytorch/pytorch/blob/06c41eea9e37b5799e4f14601c95fa7810297759/torch/csrc/profiler/README.md for rendered markdown [ghstack-poisoned]
Technical details about the profiler. ghstack-source-id: 100a8391c96b0fb76f078ad859fe2a4e74cbb17e Pull Request resolved: #108470
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Technical details about the profiler - stubs for the stuff I haven't had time to fill out yet, plus details about RecordFunction and the profiler's interaction with autograd.
reviewers - see https://github.com/pytorch/pytorch/blob/06c41eea9e37b5799e4f14601c95fa7810297759/torch/csrc/profiler/README.md for rendered markdown