pytorch/torch
Sanket Jayant Purandare 1f46284f9e Extended Module Tracker (#128508)
This is an extension of [ModuleTracker](https://github.com/pytorch/pytorch/blob/main/torch/utils/module_tracker.py) with added features and bug fixes.

1. Allows installing user-defined hooks to be called in pre-fw, post-fw, pre-bw and post-bw hooks of the ``ModTracker``.
2. Adds a function ``get_known_fqn`` that retrieves the fqn of the module as tracked by the ``ModTracker``.
3. Only registers the multi-grad hooks if we are in the forward pass. This is important because, a module's pre-fw and post-fw hooks get called in the backward during AC and we do not want to register multi-grad hooks in this case.
4. Sets the kwarg ``always_call=True`` for post-fw hooks, so that they are called post AC.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/128508
Approved by: https://github.com/wanchaol
2024-06-14 12:01:53 +00:00
..
_awaits
_C expose set_thread_name to Python and set thread names (#128448) 2024-06-13 16:38:23 +00:00
_C_flatbuffer Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_custom_op Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_decomp Introduce int_oo (#127693) 2024-06-13 04:08:20 +00:00
_dispatch Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_dynamo Add coloring to fx graph print out (#128476) 2024-06-13 23:39:04 +00:00
_export Do not generate -1* in SymPy expressions when canonicalising (#128411) 2024-06-13 16:49:59 +00:00
_functorch Add coloring to fx graph print out (#128476) 2024-06-13 23:39:04 +00:00
_higher_order_ops Revert "[checkpoint] Clean up selective activation checkpoint and make public (#125795)" 2024-06-14 01:14:59 +00:00
_inductor Improve codegen for ops.masked in triton (#128054) 2024-06-14 11:52:56 +00:00
_lazy Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_library [custom_op] don't invoke autograd.Function when unnecessary (#127976) 2024-06-13 23:38:23 +00:00
_logging Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_numpy Typo fixes: et al. (#127811) 2024-06-06 01:03:25 +00:00
_prims Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_prims_common [inductor] Fix lowering full with SymBool value (#128213) 2024-06-11 08:33:35 +00:00
_refs Add OpInfo entry for as_strided_copy (#127231) 2024-06-13 13:58:47 +00:00
_strobelight Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_subclasses Complete revamp of float/promotion sympy handling (#126905) 2024-06-09 06:20:25 +00:00
_vendor
amp Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
ao [quant][pt2e][quantizer] Support set_module_name_qconfig in X86InductorQuantizer (#126044) 2024-06-14 07:13:10 +00:00
autograd Fix docstring in autograd (#128657) 2024-06-14 02:18:59 +00:00
backends Revert "[cuDNN][SDPA] Remove TORCH_CUDNN_SDPA_ENABLED=1, enable cuDNN SDPA by default on H100 and 2nd on other archs >= sm80 (#125343)" 2024-06-12 18:47:52 +00:00
compiler Flip default value for mypy disallow_untyped_defs [4/11] (#127841) 2024-06-08 18:36:48 +00:00
contrib Flip default value for mypy disallow_untyped_defs [4/11] (#127841) 2024-06-08 18:36:48 +00:00
cpu correct avx512_vnni isa name. (#128318) 2024-06-12 16:12:49 +00:00
csrc Enable Wunused-function in torch_cpu (#128576) 2024-06-14 00:12:58 +00:00
cuda Document torch.cuda.profiler.start (#128098) 2024-06-14 01:44:18 +00:00
distributed Extended Module Tracker (#128508) 2024-06-14 12:01:53 +00:00
distributions [BE]: Update mypy to 1.10.0 (#127717) 2024-06-13 15:57:13 +00:00
export Add coloring to fx graph print out (#128476) 2024-06-13 23:39:04 +00:00
fft
func
futures Flip default value for mypy disallow_untyped_defs [7/11] (#127844) 2024-06-08 18:49:45 +00:00
fx [inductor] Fix nested indirect indexing case for index_propagation (#128378) 2024-06-14 10:07:06 +00:00
jit Document torch.jit.frontend.get_default_args (#128408) 2024-06-13 21:49:16 +00:00
legacy
lib [Split Build] Add option to create libtorch wheel and use it to build pytorch as a separate wheel (#126328) 2024-05-29 04:33:56 +00:00
linalg Added sorting notes for eig/eigvals (#127492) 2024-05-30 18:13:22 +00:00
masked Flip default value for mypy disallow_untyped_defs [7/11] (#127844) 2024-06-08 18:49:45 +00:00
monitor
mps Add support in Python API for the recommended max working set size. (#128289) 2024-06-12 16:03:57 +00:00
mtia [MTIA] Add set_device support (#128040) 2024-06-10 23:42:52 +00:00
multiprocessing expose set_thread_name to Python and set thread names (#128448) 2024-06-13 16:38:23 +00:00
nested Support apply_(callable) sugar for CPU NJTs (#125416) 2024-06-12 20:30:57 +00:00
nn [BE] enable UFMT for torch/nn/utils (#128595) 2024-06-13 18:34:57 +00:00
onnx Revert "[ONNX] Add upsample trilinear to skip decomp (#128259)" 2024-06-14 01:44:26 +00:00
optim [BE][Easy] export explicitly imported public submodules (#127703) 2024-06-12 05:52:18 +00:00
package Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
profiler Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
quantization Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
signal Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
sparse Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
special Fix global flake8 issues (#124771) 2024-04-26 15:35:53 +00:00
testing Add OpInfo entry for as_strided_copy (#127231) 2024-06-13 13:58:47 +00:00
utils Revert "[checkpoint] Clean up selective activation checkpoint and make public (#125795)" 2024-06-14 01:14:59 +00:00
xpu Flip default value for mypy disallow_untyped_defs [10/11] (#127847) 2024-06-08 18:50:06 +00:00
__config__.py Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
__future__.py
__init__.py [while_loop] expose it as torch.while_loop (#128562) 2024-06-13 23:44:10 +00:00
_appdirs.py
_classes.py Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_compile.py Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_custom_ops.py Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_deploy.py Flip default value for mypy disallow_untyped_defs [1/11] (#127838) 2024-06-08 18:16:33 +00:00
_guards.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
_jit_internal.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_linalg_utils.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_lobpcg.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
_lowrank.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
_meta_registrations.py Lift inductor lowerings for jagged <-> padded dense kernels (#125968) 2024-06-12 22:46:09 +00:00
_namedtensor_internals.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_ops.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_python_dispatcher.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_size_docs.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_sources.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_storage_docs.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_streambase.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_tensor_docs.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_tensor_str.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_tensor.py [BE] explicitly export subpackage torch.utils (#128342) 2024-06-13 04:39:16 +00:00
_torch_docs.py Update torch.nanmean() docstring to mention input dtype requirement (#128155) 2024-06-12 17:46:36 +00:00
_utils_internal.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_utils.py Revert "Deprecate torch._utils.is_compiling() and torch._dynamo.external_utils.is_compiling() (#127690)" 2024-06-10 20:44:42 +00:00
_VF.py
_vmap_internals.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
_weights_only_unpickler.py Flip default value for mypy disallow_untyped_defs [3/11] (#127840) 2024-06-08 18:28:01 +00:00
abi-check.cpp
CMakeLists.txt Reapply "distributed debug handlers (#126601)" (#127805) 2024-06-04 19:44:30 +00:00
custom_class_detail.h [codemod] c10:optional -> std::optional (#126135) 2024-05-14 19:35:51 +00:00
custom_class.h
extension.h
functional.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
hub.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
library.h [Reland] Verify types in custom op schemas (#126861) 2024-05-23 19:53:52 +00:00
library.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
overrides.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
py.typed
quasirandom.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
random.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
README.txt
return_types.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
script.h
serialization.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
storage.py Flip default value for mypy disallow_untyped_defs [9/11] (#127846) 2024-06-08 18:50:06 +00:00
torch_version.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
types.py [BE] enable UFMT for top-level files torch/*.py (#127707) 2024-06-12 20:15:05 +00:00
version.py.tpl

Note [TH abstraction violation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TH/THC provide some hpp headers, which are proper C++ headers rather than
C headers.  These headers serve double duty as *internal implementation
detail* headers, whose contents should largely not be used by external
clients.

Ideally, we would not install these headers at all; instead, you should
use public functions (in headers like `THTensor.h`, NOT `THTensor.hpp`)
to manipulate these structs.  However, there are a few places
in torch/csrc where we violate this abstraction.  They are marked with
a pointer to this note.  Each of those sites will have to be refactored
when we refactor the guts of THTensor and related structures.