pytorch/torch
Kimish Patel ffc0c46092 [Quantization] Add metadata porting for nodes added by quantization (#107107)
Summary:
This diff adds adding metadata to q-dq nodes by inferring the
quatization intent from node annotations. Annotations on the node are
way for user to specify how a node or subgraph is supposed to be
quantized. We continue to use that information to copy metadata on Q/DQ
node from appropriate nodes.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D48488416](https://our.internmc.facebook.com/intern/diff/D48488416)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/107107
Approved by: https://github.com/jerryzh168
ghstack dependencies: #107105, #107106, #107899, #107900
2023-09-02 06:38:14 +00:00
..
_awaits
_C [RESUBMIT] Standardize on error types for distributed errors. (#108191) 2023-08-30 21:47:39 +00:00
_C_flatbuffer
_custom_op Extend impl_backward to be usable with torch.library operators (#106817) 2023-08-14 14:33:46 +00:00
_decomp Add refs/decomps for dot/vdot (#108194) 2023-08-31 15:30:23 +00:00
_dispatch Fix some fake mode confusion between inner/outer fake mode in export (#106515) 2023-08-04 15:42:23 +00:00
_dynamo [Quant] Add DQ duplication pass (#107900) 2023-09-02 06:20:03 +00:00
_export [export] Properly handle duplicated params. (#108415) 2023-09-01 19:44:32 +00:00
_functorch [inductor][ac] preserve recompute tags through pattern matching (#107742) 2023-08-25 03:48:26 +00:00
_higher_order_ops Make make_fx cond preserve node meta (#108356) 2023-09-01 22:43:55 +00:00
_inductor Refactorings for constant folding (#108450) 2023-09-02 03:49:05 +00:00
_lazy
_logging Added info for each artifact option, added a help option to TORCH_LOGS, and changed the error message (#107758) 2023-08-31 02:12:35 +00:00
_numpy [dynamo] Avoid recompilation when the PyTorch function accepts scalars (#108162) 2023-09-01 14:35:42 +00:00
_prims [activation checkpointing] Add default autocast keys to functional rng wrappers (#107934) 2023-08-25 18:22:02 +00:00
_prims_common Remove dynamo+nvfuser (#105789) 2023-08-08 22:29:32 +00:00
_refs Add refs/decomps for dot/vdot (#108194) 2023-08-31 15:30:23 +00:00
_subclasses dynamo: trace autograd.Function with tensor subclass input (#108093) 2023-09-01 02:12:38 +00:00
amp Allow float dtype when Autocast CPU Disabled (#107348) 2023-09-01 00:49:44 +00:00
ao [Quantization] Add metadata porting for nodes added by quantization (#107107) 2023-09-02 06:38:14 +00:00
autograd removing some redundant str splits (#106089) 2023-09-01 00:22:58 +00:00
backends [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
compiler
contrib [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
cpu Apply UFMT to low traffic torch modules (#106249) 2023-07-29 23:37:30 +00:00
csrc [NCCL][CUDA][CUDA Graphs] Flush enqueued work before starting a graph capture (#104487) 2023-09-01 05:42:08 +00:00
cuda [memory snapshots] _record_memory_history_legacy bug fix (#108260) 2023-08-30 22:33:04 +00:00
distributed [DTensor][random] add DTensor constructor: randn (#108285) 2023-09-01 20:28:41 +00:00
distributions [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
export print equalities (#108427) 2023-09-01 22:37:22 +00:00
fft
func [pt2] support vmap (#101707) 2023-08-09 03:39:33 +00:00
futures
fx Allow registering decomps for HigherOrderOp; add decomp for out_dtype (#108080) 2023-08-31 03:15:38 +00:00
jit removing some redundant str splits (#106089) 2023-09-01 00:22:58 +00:00
legacy
lib Revert "Remove some unnecessary <iostream> includes from headers (#106914)" 2023-08-29 02:22:33 +00:00
linalg Remove duplicate sentences in description of torch.linalg.eig (#108230) 2023-08-30 13:16:04 +00:00
masked [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
monitor
mps [MPS] Introduce torch.mps.Event() APIs (#102121) 2023-08-08 03:45:45 +00:00
multiprocessing Apply UFMT to low traffic torch modules (#106249) 2023-07-29 23:37:30 +00:00
nested
nn Add examples for nn.CosineEmbeddingLoss (#108215) 2023-08-31 20:01:24 +00:00
onnx [ONNX] Show sarif_report_path (#108398) 2023-09-01 19:11:52 +00:00
optim Implement "RAdamW" optimizer (#107507) 2023-08-28 20:50:25 +00:00
package removing some redundant str splits (#106089) 2023-09-01 00:22:58 +00:00
profiler [profiler] move _enable_dynamo_cache_lookup_profiler (#107720) 2023-08-23 23:41:35 +00:00
quantization Apply UFMT to low traffic torch modules (#106249) 2023-07-29 23:37:30 +00:00
signal [BE] Enable ruff's UP rules and autoformat optim/ (#105426) 2023-07-18 21:07:43 +00:00
sparse Add torch.sparse.as_sparse_gradcheck decorator of gradcheck that allows gradcheck input function to receive and return sparse tensors (#107150) 2023-08-26 07:24:31 +00:00
special
testing Flash Attention v2 (#105602) 2023-09-01 22:14:44 +00:00
utils [pytree] Allow register_pytree_node to take in 5 inputs (#108256) 2023-08-31 11:06:17 +00:00
__config__.py
__future__.py
__init__.py Break graph on manual_seed. (#107594) 2023-08-30 17:24:11 +00:00
_appdirs.py [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
_classes.py
_compile.py [dynamo] Reland #104317 - Lazy disable_dynamo API out-of-dynamo (#104664) 2023-07-06 00:48:02 +00:00
_custom_ops.py Extend impl_backward to be usable with torch.library operators (#106817) 2023-08-14 14:33:46 +00:00
_deploy.py
_guards.py [dynamo] Store originating source in the Guard object (#107634) 2023-08-22 02:16:31 +00:00
_jit_internal.py
_linalg_utils.py [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
_lobpcg.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
_lowrank.py [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
_meta_registrations.py Flash Attention v2 (#105602) 2023-09-01 22:14:44 +00:00
_namedtensor_internals.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
_ops.py Support cond and out_dtype for predispatch (#107941) 2023-08-25 17:37:16 +00:00
_python_dispatcher.py [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
_sources.py
_storage_docs.py
_tensor_docs.py Modify signature for tensor.tile in doc (#106295) 2023-08-01 19:51:52 +00:00
_tensor_str.py [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
_tensor.py [PyTorch][Tensor] Introduce tensor.dim_order (#106835) 2023-08-25 00:06:03 +00:00
_torch_docs.py Add optional is_coalesced argument to sparse coo tensor factory function. (#107638) 2023-08-26 07:24:29 +00:00
_utils_internal.py [Dynamo] Improve PT2 fbcode logging observability (#106932) 2023-08-11 20:46:04 +00:00
_utils.py Add optional is_coalesced argument to sparse coo tensor factory function. (#107638) 2023-08-26 07:24:29 +00:00
_VF.py
_vmap_internals.py
_weights_only_unpickler.py
abi-check.cpp
CMakeLists.txt Revert "[Reland] Upgrade NVTX to NVTX3 (#97582)" 2023-08-15 20:55:12 +00:00
custom_class_detail.h
custom_class.h Revert "Remove some unnecessary <iostream> includes from headers (#106914)" 2023-08-29 02:22:33 +00:00
extension.h reduce header file to boost cpp_wrapper build. (#107585) 2023-08-22 11:58:47 +00:00
functional.py fix torch.norm for custom device (#106198) 2023-08-02 06:25:52 +00:00
hub.py Default permissions for torch.hub downloads (#82869) 2023-08-24 15:48:24 +00:00
library.h
library.py Enable registering fallthroughs to (op, dk) from torch.library (#106086) 2023-07-28 19:37:59 +00:00
overrides.py Support is_mtia attribute. (#108307) (#108310) 2023-09-01 01:25:40 +00:00
py.typed
quasirandom.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
random.py Break graph on manual_seed. (#107594) 2023-08-30 17:24:11 +00:00
README.txt
return_types.py
script.h
serialization.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
storage.py [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
torch_version.py [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
types.py [BE]: Apply PYI autofixes to various types (#107521) 2023-08-20 02:42:21 +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.