Commit Graph

9 Commits

Author SHA1 Message Date
Taylor Robie
1a0e1db763 [Profiler] Compute unique IDs for Tensors (#85162)
This PR is largely based on https://github.com/pytorch/pytorch/pull/80266, with one major difference. #80266 assigned each unique {TensorImpl, StorageImpl} pair a unique ID, whereas this PR seeks to cluster the implicit graph formed by the pairs into disjoint groups and assign an ID to each disjoint group.

Differential Revision: [D39563859](https://our.internmc.facebook.com/intern/diff/D39563859/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85162
Approved by: https://github.com/chaekit
2022-09-25 17:43:49 +00:00
Taylor Robie
4dfaca6fb1 [Profiler] Clean up Tensor representation (#85161)
I want to start using `TensorMetadata` elsewhere in profiler so we have a common representation of Tensor. The main changes in this PR are:

1) Replace raw pointers with strong typedefs and create a custom type caster to handle moving them to Python.
2) Adding a `device()` method to handle reassembling type and index.

Differential Revision: [D39563965](https://our.internmc.facebook.com/intern/diff/D39563965/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85161
Approved by: https://github.com/chaekit
2022-09-23 19:12:49 +00:00
Taylor Robie
e296a82f23 [Profiler] Capture storage data pointer (#84276)
This is approximately a re-land of the storage half of https://github.com/pytorch/pytorch/pull/80266

I've directly represented and exposed storage impl rather than using it as a first guess for an ID. (Mostly for testing, which happened to save me as I was initially recording the wrong thing.)

Differential Revision: [D39136546](https://our.internmc.facebook.com/intern/diff/D39136546/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84276
Approved by: https://github.com/slgong-fb
2022-09-23 19:12:49 +00:00
Seonglyong Gong
ebd4e90ff7 [Profiler] add config option to remove 'Call stack' field from trace file (#84982)
Summary: `Call stack` field increases trace file size exponentially for Python stack tracing (need to be deprecated carefully). Added a config option to avoid this increase.

Test Plan:
`experimental_config=_ExperimentalConfig(no_callstack_trace=True),` will remove the field.
+ CI tests

Differential Revision: D39489828

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84982
Approved by: https://github.com/robieta
2022-09-15 06:41:33 +00:00
Taylor Robie
014a333df3 [Profiler][Minor] Extend Python bindings (#83622)
Adding some fields which are needed for memory profiling.

Differential Revision: [D38528382](https://our.internmc.facebook.com/intern/diff/D38528382/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83622
Approved by: https://github.com/Gamrix
2022-08-26 20:03:24 +00:00
PyTorch MergeBot
d5af2a70ba Revert "[TorchTidy] Adding support for unique tensor identifiers (#80266)"
This reverts commit b6ba41921d.

Reverted https://github.com/pytorch/pytorch/pull/80266 on behalf of https://github.com/malfet due to Broke number of trunk jobs, see b6ba41921d
2022-08-25 05:09:12 +00:00
John Clow
b6ba41921d [TorchTidy] Adding support for unique tensor identifiers (#80266)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80266
Approved by: https://github.com/robieta
2022-08-25 03:52:19 +00:00
Seonglyong Gong
fa241fd50e [Profiler] record nn.Module's parameters (#83209)
Summary:
Record nn.Module's parameters for detaild memory profiling:
- extend 'module_' in value cache  & NNModuleInfo to save parameters
- python binding and unit test case

Test Plan: buck run mode/opt //caffe2/test:profiler -- -r test_nnmodule

Differential Revision: D38379717

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83209
Approved by: https://github.com/robieta
2022-08-24 08:17:20 +00:00
Taylor Robie
1fa9a377d0 [Profiler] Start moving python bindings out of autograd (#82584)
A lot of profiler code still lives in autograd for historic reasons. However as we formalize and clean up profiler internals it makes sense to pull more and more into the profiler folders/namespace. For now I'm just moving some of the core config data structures and those related to `torch::profiler::impl::Result` to keep the scope manageable.

Differential Revision: [D37961462](https://our.internmc.facebook.com/intern/diff/D37961462/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D37961462/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82584
Approved by: https://github.com/albanD, https://github.com/Gamrix
2022-08-19 17:15:18 +00:00