Commit Graph

33969 Commits

Author SHA1 Message Date
Elias Ellison
43f56e19a6 [NNC] Make NNC sanitize input names (#52786)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52786

Previously, NNC did not sanitize input names. I ran into this in the next PR when making subgraph creation preserve debug names caused a number of NNC cuda failures. I also previously ran into this with some masked_fill failures internally, which led me to disable the operator.

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D26696699

Pulled By: eellison

fbshipit-source-id: 7c3af4d559d58762fb8332666784a4d5cd6a4167
2021-03-01 21:22:16 -08:00
Elias Ellison
4b40141d2c Add support for linear in mkldnn fusion (#51484)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51484

This PR moves the linear weights of a frozen model to MKLDNN. When the weights are already in MKLDNN, just computing a single linear by converting the input and output from/to mkldnn provides large speedups. I benchmark'd the results of the top 200 shapes in predictor [here](https://www.internalfb.com/phabricator/paste/view/P171537854) (taken from aten::matmul), as well as verified that it sped up popular models. .

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D26696698

Pulled By: eellison

fbshipit-source-id: 53d03b9e6956e11b700ee58214e2266e2aa4106a
2021-03-01 21:22:13 -08:00
Elias Ellison
bfae3789ba Move conv to mkldnn (#51483)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51483

This PR moves the conv weights of a frozen model to MKLDNN, and AOT reorders the weights. When the weights are already in MKLDNN, just computing a single conv by converting the input and output from/to mkldnn provides large speedups. I benchmark'd the results of the top 200 shapes in predictor [here](https://www.internalfb.com/phabricator/paste/view/P171537938), as well as verified that it sped up popular models in torchvision.

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D26696703

Pulled By: eellison

fbshipit-source-id: 0b4441bee4f6e0890a4540fbca3bb5e58b8c5adf
2021-03-01 21:19:27 -08:00
Nikitha Malgi
7a60b7dc3e Add support to compare devices (#53045)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53045

Test Plan:
=====
python test/test_jit.py -k test_device_not_equal

Reviewed By: pbelevich

Differential Revision: D26737964

Pulled By: nikithamalgifb

fbshipit-source-id: 2205aa1f214a86282602168c364dca1363d2f7dd
2021-03-01 21:04:43 -08:00
Shen Li
a586c02962 Update and expose ZeroRedundancyOptimizer docs (#52937)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/52937

Test Plan: Imported from OSS

Reviewed By: blefaudeux

Differential Revision: D26696938

Pulled By: mrshenli

fbshipit-source-id: dafb00e5c9f0c0c602f471fdcb6416bde74f806b
2021-03-01 20:50:33 -08:00
Mikhail Zolotukhin
a176c73ed5 [TensorExpr] Reland: "PyBind: bind ExternalCalls." (#53063)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53063

The problem was that a derived class was marked with "py::nodelete",
while the base class wasn't. Now they both are marked correctly.

Test Plan: Imported from OSS

Reviewed By: bertmaher

Differential Revision: D26737877

Pulled By: ZolotukhinM

fbshipit-source-id: 17d9d430651c8f695fc7b6bf6784e7719e20a4d2
2021-03-01 20:44:10 -08:00
Mikhail Zolotukhin
e22da0a5c4 [TensorExpr] Add IRVerifier. (#52901)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52901

This PR implements IR Verifier and adds a call to it in `LoopNest`
constructors. Checks that were in expr/stmt constructors before are now
moved to the corresponding `::make` functions or to the verifier. They
didn't really help from the constructors anyway since an exception
thrown from there led to a segfault due to the fact our memory
management works (object was not fully created but was registered in the
kernel arena for destruction anyway).

Fixes #52778.

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D26682928

Pulled By: ZolotukhinM

fbshipit-source-id: c56524015cdffb1ed8bce4394509961a4071dcfa
2021-03-01 20:38:00 -08:00
Michael Suo
3bd779cec6 [rpc] make pickler/unpickler pluggable in RPC (#53050)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53050

As title. We would like to use alternative pickler/unpickler
implementations without changing the entire RPCPickler, to make it
possible to send objects over the wire that are coming from a
torch.package

Test Plan: Imported from OSS

Reviewed By: Lilyjjo

Differential Revision: D26734592

Pulled By: suo

fbshipit-source-id: d9d9fa62ee15bfcb00e09192030541b61df8c682
2021-03-01 18:40:56 -08:00
Michael Suo
83a93ee145 [package] Pull out _UnpicklerWrapper into PackageUnpickler (#53049)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53049

This makes our API symmetric--now we have an `Importer` aware Pickler
and Unpickler implementation that have similar interfaces.

Test Plan: Imported from OSS

Reviewed By: Lilyjjo

Differential Revision: D26734593

Pulled By: suo

fbshipit-source-id: 3479437cf6b98e0d6a8aa4907c75f0c61d5495d4
2021-03-01 18:40:52 -08:00
Michael Suo
ec128eadea [package] _custom_import_pickler -> _package_pickler (#53048)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53048

I am planning the custom pickler and unpicklers that we use as
semi-public interfaces for `torch.rpc` to consume. Some prefatory
movements here.

Test Plan: Imported from OSS

Reviewed By: Lilyjjo

Differential Revision: D26734594

Pulled By: suo

fbshipit-source-id: 105ae1161d90f24efc7070a8d80c6ac3d2111bea
2021-03-01 18:38:43 -08:00
Nikita Shulga
272dfc7bb9 Add MANIFEST.in (#52908)
Summary:
Do not build PyTorch if `setup.py` is called with  'sdist' option
Regenerate bundled license while sdist package is being built
Refactor `check_submodules` out of `build_deps` and check that submodules project are present during source package build stage.

Test that sdist package is configurable during `asan-build` step

Fixes https://github.com/pytorch/pytorch/issues/52843

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52908

Reviewed By: walterddr

Differential Revision: D26685176

Pulled By: malfet

fbshipit-source-id: 972a40ae36e194c0b4e0fc31c5e1af1e7a815185
2021-03-01 18:28:25 -08:00
Martin Yuan
b5ae8e69a7 [Lite Interpreter] Support features from to_backend (#52870)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52870

Add the missing parts to support to_backend modules by lite interpreter.
1. Add ISINSTANCE instruction support, which is used in to_backend for output type check.
2. Bypass lite interpreter's type parser by checking the qualified name. If it starts with "torch.jit", use the same type resolver as nn module (starting with "__torch__").

Tests
Mobile module is serialized and loaded in ```BackendTest.TestCompiler```. The results are compared to those from original torchscript module.

Test Plan: Imported from OSS

Reviewed By: raziel

Differential Revision: D26715351

Pulled By: iseeyuan

fbshipit-source-id: ad9d74ee81c6aa692ab9e5dd7a9003bae5d4f01f
2021-03-01 17:56:01 -08:00
Jane Xu
8467e5cad3 Remove ci-all and release branches running scheduled tests (#53069)
Summary:
The previous code allowed these tests to run every four hours on certain ci-all branches...which is really bad and resource intensive. This code removes that, but then disallows the 11.2 and 9.2 tests to be run on ci-all branches.

To debug CUDA 11.2 or 9.2 tests, one must now manually change the config to allow for them. (Look at https://github.com/pytorch/pytorch/issues/51888 and https://github.com/pytorch/pytorch/issues/51598 for examples of how to do that.)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53069

Reviewed By: H-Huang

Differential Revision: D26739738

Pulled By: janeyx99

fbshipit-source-id: 7577b9b2e876bac0e4e868ce2a1f3ffdb6aca597
2021-03-01 17:22:13 -08:00
kshitij12345
cfa41cea7e [numpy] torch.logit: promote integer inputs to float (#52028)
Summary:
Reference: https://github.com/pytorch/pytorch/issues/42515

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52028

Reviewed By: ngimel

Differential Revision: D26400552

Pulled By: mruberry

fbshipit-source-id: 5aec9c9755a7ae283aa52294517ea28f4b0fd3e7
2021-03-01 17:07:52 -08:00
Scott Wolchok
c7c03dd388 [PyTorch] Fix TORCH_CHECK_INDEX(false, ...) in IndexKernel (#53028)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53028

TORCH_CHECK (and variants) wrap the condition in C10_UNLIKELY, so this code is both prettier and better.
ghstack-source-id: 122755165

Test Plan: CI

Reviewed By: malfet

Differential Revision: D26522821

fbshipit-source-id: 70aa11f1859f979657a1f376f7039b5015c69321
2021-03-01 16:54:20 -08:00
Eli Uriegas
07ae4e9309 scripts: Add script to prep wheels for pypi (#53056)
Summary:
Adds a script so that we can take wheels directly from
download.pytorch.org and publish them to pypi

This is currently mainly used to prep windows binaries for publication to PyPI

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53056

Reviewed By: H-Huang

Differential Revision: D26738642

Pulled By: seemethere

fbshipit-source-id: 96777ed6c3f3454bddb4bc13121f727074312816
2021-03-01 16:46:44 -08:00
iramazanli
fd4722949d Fix the repeated entry in the Tensor Attributes doc (#52995)
Summary:
Fixes #{issue number}

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52995

Reviewed By: H-Huang

Differential Revision: D26732911

Pulled By: iramazanli

fbshipit-source-id: 86ab93f7f3540cf16dde02670e05cb56999b4929
2021-03-01 16:42:32 -08:00
Nikita Shulga
e2462745ba Update kineto submodule (#53039)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53039

Reviewed By: gdankel

Differential Revision: D26732608

Pulled By: malfet

fbshipit-source-id: 5c7f30d237f238fc69a6d2a18a0aee41a68f6f09
2021-03-01 15:43:57 -08:00
Jeff Yang
3993fb2bf9 fix(docs): indent in docstring of key_averages (#53006)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/52742

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53006

Reviewed By: H-Huang

Differential Revision: D26725101

Pulled By: albanD

fbshipit-source-id: 867be12b0ee363a3c0ddcaf8cb4f6354dd4aa901
2021-03-01 15:18:20 -08:00
Rohan Varma
b3bf08e67f Log nccl debug level in ProcessGroupNCCL (#52803)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52803

This is useful for double checking we have the expected nccl_debug
level when debugging problematic jobs.

New logs:

When default is warn:
```
NCCL_ASYNC_ERROR_HANDLING: 0
NCCL_BLOCKING_WAIT: 0
TIMEOUT(ms): 60000
USE_HIGH_PRIORITY_STREAM: 0
NCCL_DEBUG: WARN
```

off:

```
NCCL_ASYNC_ERROR_HANDLING: 0
NCCL_BLOCKING_WAIT: 0
TIMEOUT(ms): 1800000
USE_HIGH_PRIORITY_STREAM: 0
NCCL_DEBUG: N/A
```
ghstack-source-id: 122751110

Test Plan: CI

Reviewed By: pritamdamania87

Differential Revision: D26653699

fbshipit-source-id: 845cc1236f3838f4763c6dcf2a30d059b3d44f02
2021-03-01 14:57:22 -08:00
Ansha Yu
ec42c2d89c [pyper] fuse clip_ranges+gather_ranges (#52461)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52461

TODO: add tests

Test Plan:
Before:
7.10623 ms/iter
0.0849279 ms.    1.21267%. fb::clip_ranges (212 nodes)
0.254071 ms.    3.62783%. fb::gather_ranges (214 nodes)

After:
7.0654 ms/iter
0.300174 ms.     4.2739%. fb::clip_ranges_gather (264 nodes)

Reviewed By: hlu1

Differential Revision: D26523903

fbshipit-source-id: 9b2420c522232659b198cbe250d4454bbcd9297b
2021-03-01 14:50:39 -08:00
Jerry Zhang
991160ebd9 [quant][graphmode][fx] Add support for fp16 bmm pattern (#52808) (#53021)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53021

Add support for producing fp16 bmm pattern

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_bmm

Imported from OSS

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26725349

fbshipit-source-id: debee718fc33e562aff3f5664757bb52ee85f651
2021-03-01 14:45:55 -08:00
Edward Yang
b039dd15ce Delete defunct LegacyTHFunctions templates (#53016)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53016

We just checked in the generated files directly.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Reviewed By: bdhirsh

Differential Revision: D26724876

Pulled By: ezyang

fbshipit-source-id: 887d781cac47b7cf16ba2cd6079c63b8f186fe44
2021-03-01 14:41:45 -08:00
Benjamin Lefaudeux
812339ca3d [ZeroRedundancyOptimizer] Buckets as tensor view + minimize public interface (#52987)
Summary:
Updated version following  https://github.com/pytorch/pytorch/issues/52764 (including comments from Shen), but this one I expect to be able to land.
ZeroRedundancyOptimizer:
- bucket as tensor views, optional
- make a lot of attributes private
- minor unit test refactor
- adding coverage in the unit test for with and without bucket views

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52987

Reviewed By: mrshenli

Differential Revision: D26728851

Pulled By: blefaudeux

fbshipit-source-id: f8c745966719c9076c20a554ef56198fb838856c
2021-03-01 14:37:04 -08:00
Yi Wang
e10d2f477b Clang-format c10d/init.cpp (#53008)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53008

ghstack-source-id: 122722409

Test Plan: N/A

Reviewed By: rohan-varma

Differential Revision: D26720507

fbshipit-source-id: e3ddbcd9e430c8261cc5364795e4b55320e05c5c
2021-03-01 14:31:50 -08:00
Yi Wang
084839faa6 Clang-format test_c10d.py (#52978)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52978

ghstack-source-id: 122701029

Test Plan: N/A

Reviewed By: zhaojuanmao

Differential Revision: D26713240

fbshipit-source-id: 25301f794a68bee3d6a73d15986a96edab498310
2021-03-01 14:24:36 -08:00
Jerry Zhang
e00e42dbab [reland][quant][graphmode][fx][test][refactor] Refactoring binary op tests to split int8 and float16 tests (#52807) (#53020)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53020

Test Plan:
Imported from OSS

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26725351

fbshipit-source-id: 35086ab19087501e1c9fdef4f16993ee9f364d0d
2021-03-01 14:06:10 -08:00
Kyle Chen
a9f7ae5357 [ROCm] Enable test cases in test/test_dataloader.py for ROCm (#52766)
Summary:
Enabling test cases in test_dataloader.py for ROCm because they are passing now.

Signed-off-by: Kyle Chen <kylechen@amd.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52766

Reviewed By: H-Huang

Differential Revision: D26706402

Pulled By: ngimel

fbshipit-source-id: 63d4ea6d9b16f6244eb0f0f8f7a957bac8469111
2021-03-01 13:32:35 -08:00
Jerry Zhang
096bea5251 [reland][quant][graphmode][fx][fp16] Add fp16 support for {add|mul}{_relu} (#52714) (#53019)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53019

Test Plan:
python test/test_quantization.py TestQuantizedOps.test_add
python test/test_quantization.py TestQuantizedOps.test_mul
python test/test_quantization.py TestQuantizedOps.test_add_relu
python test/test_quantization.py TestQuantizedOps.test_mul_relu

Imported from OSS

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26725350

fbshipit-source-id: 2a89f5da6a21908f454f870521d2a4549fdd291e
2021-03-01 13:19:42 -08:00
Erjia Guan
89b1053413 [DataLoader] Move BufferedShuffle from Dataset to DataPipe (#52141)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52141

Remove BufferShuffleDataSet, as it's not being used anywhere within PyTorch (no usage on Github based on a search) and it's not included in the release of PyTorch 1.7.1.

Test Plan: Imported from OSS

Reviewed By: H-Huang

Differential Revision: D26710940

Pulled By: ejguan

fbshipit-source-id: 90023b4bfb105d6aa392753082100f9181ecebd0
2021-03-01 12:54:44 -08:00
Kyle Chen
f2657d2e4f [ROCm] Enable test cases in test_cuda.py for ROCm (#52739)
Summary:
Enabling four test cases in test_cuda.py for ROCm because they are passing.

Signed-off-by: Kyle Chen <kylechen@amd.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52739

Reviewed By: H-Huang

Differential Revision: D26706321

Pulled By: ngimel

fbshipit-source-id: 6907c548c4ac4e387f0eb7c646e8a01f0d036c8a
2021-03-01 12:54:40 -08:00
Kyle Chen
0a70ec45d1 [ROCm] Enable test cases in autocast_test_lists.py for ROCm (#52737)
Summary:
Enabling test cases in autocast_test_lists.py for ROCm because they are passing.

Signed-off-by: Kyle Chen <kylechen@amd.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52737

Reviewed By: H-Huang

Differential Revision: D26706346

Pulled By: ngimel

fbshipit-source-id: c1b3b3d8c0ef2a5b1f7e2bd061a749afbae16590
2021-03-01 12:51:56 -08:00
Facebook Community Bot
4daa81e267 Automated submodule update: FBGEMM (#52992)
Summary:
This is an automated pull request to update the first-party submodule for [pytorch/FBGEMM](https://github.com/pytorch/FBGEMM).

New submodule commit: a431ee37cb

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52992

Test Plan: Ensure that CI jobs succeed on GitHub before landing.

Reviewed By: dskhudia

Differential Revision: D26718007

fbshipit-source-id: 7b35ab2012b8b6300a6e78c8425f9e08864a9f68
2021-03-01 12:46:23 -08:00
Michael Carilli
e36576d153 Probable fix for out of place BinaryOpScalar bad values and/or IMAs on 11.2 (ci-all edition) (#52634)
Summary:
Should close https://github.com/pytorch/pytorch/issues/51992.

ci-all resubmit of https://github.com/pytorch/pytorch/pull/52591. The plot also thickened considerably since then. Every foreach functor, it turns out, has bad `r_args` accesses for certain code paths and instantiations.

Also, I noticed the [`n % kILP == 0`](2680ff7759/aten/src/ATen/native/cuda/ForeachFunctors.cuh (L87)) condition for vectorization in all functors is way too restrictive: it'll refuse to vectorize anything on any tensor whose overall numel is not a multiple of ILP. That's out of scope though.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52634

Reviewed By: H-Huang

Differential Revision: D26725991

Pulled By: izdeby

fbshipit-source-id: 4bade0ac186bf85527baddc1c44b2c2b8e3c9777
2021-03-01 12:41:24 -08:00
peter
8870c391e9 Update mkl to 2020.2.254 (#52964)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/52907

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52964

Reviewed By: H-Huang

Differential Revision: D26726464

Pulled By: seemethere

fbshipit-source-id: 8f3067292e6416e299b4b040c8fb73510134f02e
2021-03-01 11:13:57 -08:00
Nikolay Korovaiko
d4527b4e16 add a full pipeline test for a TypeCheck (#52933)
Summary:
This tests a simple failure mode for a TypeCheck when a shape changes.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52933

Reviewed By: H-Huang

Differential Revision: D26727583

Pulled By: Krovatkin

fbshipit-source-id: b277218af9572cd6f89f2ece044f7d84d4c10283
2021-03-01 10:58:08 -08:00
Bert Maher
7d060735ca Back out "[TensorExpr] PyBind: bind ExternalCalls."
Summary: Original commit changeset: e1ea3b3630d1

Test Plan: Broke tests, e.g. T85754010

Reviewed By: ZolotukhinM

Differential Revision: D26727166

fbshipit-source-id: 42d2090bc55ec2982a4a08c38278c80617d5398a
2021-03-01 10:51:06 -08:00
MY_
b22b082cc8 Fixed the error of generator in the RandomSampler. (#52956)
Summary:
In  `__iter__` of the `RandomSampler`, when `self.replacement` is `False` in the original code, `self.generator` is always used in the `torch.randperm` instead of the generator we set.

Fixes https://github.com/pytorch/pytorch/issues/52568

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52956

Reviewed By: mruberry

Differential Revision: D26724303

Pulled By: H-Huang

fbshipit-source-id: 86f2795c76f3548e31181fb077af046078a173cb
2021-03-01 10:05:43 -08:00
momohatt
3403babd94 [doc] Fix documentations of torch functions (#52982)
Summary:
This PR includes multiple small fixes of docstrings.

* Fix documentation for [`torch.atleast_2d`](https://pytorch.org/docs/master/generated/torch.atleast_2d.html) and [`torch.atleast_3d`](https://pytorch.org/docs/master/generated/torch.atleast_3d.html) by adding a new line before `Args::`.
* Fix indentation for [`torch.isfinite`](https://pytorch.org/docs/master/generated/torch.isfinite.html) and [`torch.isinf`](https://pytorch.org/docs/master/generated/torch.isinf.html). The "Arguments", "Parameters" and "Examples" sections need to be at the same level as the first description.
* Insert a new line after `Example::` where it is missing. This makes difference in the way the documentations are rendered: see [this](https://pytorch.org/docs/master/generated/torch.gt.html) (with a new line) and [this](https://pytorch.org/docs/master/generated/torch.triu_indices.html) (without). As the majority of the docs seems to follow the former style, this PR amends the latter cases.
* Fix the "Returns" section of [`torch.block_diag`](https://pytorch.org/docs/master/generated/torch.block_diag.html) and [`torch.cartesian_prod`](https://pytorch.org/docs/master/generated/torch.cartesian_prod.html). The second and the subsequent lines shouldn't be indented, as can be seen in the docstring of [`torch.vander`](https://pytorch.org/docs/master/generated/torch.vander.html).
* Fix variable names in the example of `torch.fft.(i)fftn`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52982

Reviewed By: mruberry

Differential Revision: D26724408

Pulled By: H-Huang

fbshipit-source-id: c65aa0621f7858b05fd16f497caacf6ea8eb33c9
2021-03-01 09:59:57 -08:00
Vitaly Fedyunin
6d29aa5486 Make lambda supported by Map DataPipe (#52856)
Summary:
Pickle lambda function with `dill` module. Tests are in `torchdata`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52856

Reviewed By: anjali411

Differential Revision: D26673337

Pulled By: VitalyFedyunin

fbshipit-source-id: c2a1b41b7c4cd824945a016d3c1637eb489da700
2021-03-01 09:22:45 -08:00
vfdev-5
66f07c0c12 Optimized bilinear interpolation using TensorIterator (#51653)
Summary:
Related to https://github.com/pytorch/pytorch/issues/10482

Description:

- Optimized bilinear interpolation for 1d, 2d, 3d cases using TensorIterator

<details>
<summary>
Interpolation 2d - 6 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[1, 3, 320, 320] | [256, 256] | True | False | 0.3938 | 0.0782 | 5.0339
[1, 3, 320, 320] | [512, 512] | True | False | 1.5585 | 0.4105 | 3.7965
[1, 3, 320, 320] | [256, 256] | False | False | 0.3481 | 0.0760 | 4.5780
[1, 3, 320, 320] | [512, 512] | False | False | 1.5848 | 0.4091 | 3.8734
[1, 3, 320, 320] | [256, 256] | False | True | 1.2058 | 1.2034 | 1.0020
[1, 3, 320, 320] | [512, 512] | False | True | 4.8691 | 4.8537 | 1.0032
[32, 128, 64, 64] | [32, 32] | False | True | 6.3915 | 6.4041 | 0.9980
[32, 128, 64, 64] | [128, 128] | False | True | 166.1769 | 164.5621 | 1.0098
[32, 128, 64, 64] | [32, 32] | True | False | 3.7194 | 2.4720 | 1.5046
[32, 128, 64, 64] | [128, 128] | True | False | 86.6704 | 52.3754 | 1.6548
[1, 3, 500, 500] | [256, 256] | True | False | 0.3270 | 0.0792 | 4.1307
[1, 3, 500, 500] | [800, 800] | True | False | 3.3116 | 0.5567 | 5.9482
[1, 3, 500, 500] | [256, 256] | False | False | 0.3763 | 0.0773 | 4.8700
[1, 3, 500, 500] | [800, 800] | False | False | 3.2577 | 0.5590 | 5.8279

</details>

<details>
<summary>
Interpolation 1d - 6 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[4, 512, 320] | 256 | True | False | 0.2795 | 0.1032 | 2.7089
[4, 512, 320] | 512 | True | False | 0.5533 | 0.1888 | 2.9303

</details>

<details>
<summary>
Interpolation 3d - 6 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[1, 3, 16, 320, 320] | [8, 256, 256] | True | False | 4.4105 | 2.1236 | 2.0769
[1, 3, 16, 320, 320] | [32, 512, 512] | True | False | 83.9426 | 42.6641 | 1.9675
[1, 3, 16, 320, 320] | [8, 256, 256] | False | True | 15.5736 | 15.5758 | 0.9999
[1, 3, 16, 320, 320] | [32, 512, 512] | False | True | 272.4795 | 273.2745 | 0.9971

</details>

<details>
<summary>
Interpolation 2d - 1 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[1, 3, 320, 320] | [256, 256] | True | False | 1.0240 | 0.4145 | 2.4705
[1, 3, 320, 320] | [512, 512] | True | False | 4.0771 | 1.3836 | 2.9467
[1, 3, 320, 320] | [256, 256] | False | False | 0.9771 | 0.3270 | 2.9878
[1, 3, 320, 320] | [512, 512] | False | False | 4.1732 | 1.2209 | 3.4180
[1, 3, 320, 320] | [256, 256] | False | True | 1.5466 | 1.5363 | 1.0067
[1, 3, 320, 320] | [512, 512] | False | True | 6.1555 | 6.1199 | 1.0058
[32, 128, 64, 64] | [32, 32] | False | True | 27.6362 | 27.5901 | 1.0017
[32, 128, 64, 64] | [128, 128] | False | True | 468.6442 | 465.5163 | 1.0067
[32, 128, 64, 64] | [32, 32] | True | False | 20.1495 | 10.0694 | 2.0011
[32, 128, 64, 64] | [128, 128] | True | False | 400.0401 | 204.0662 | 1.9603
[1, 3, 500, 500] | [256, 256] | True | False | 0.8956 | 0.3366 | 2.6606
[1, 3, 500, 500] | [800, 800] | True | False | 8.6554 | 2.9530 | 2.9310
[1, 3, 500, 500] | [256, 256] | False | False | 1.0921 | 0.3385 | 3.2263
[1, 3, 500, 500] | [800, 800] | False | False | 8.9594 | 2.9627 | 3.0241

</details>

<details>
<summary>
Interpolation 1d - 1 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[4, 512, 320] | 256 | True | False | 1.5233 | 0.5027 | 3.0301
[4, 512, 320] | 512 | True | False | 3.0302 | 0.9735 | 3.1128

</details>

<details>
<summary>
Interpolation 3d - 1 thread(s)
</summary>

In | Out | Is contiguous | Channels last | master | this PR | speed-up
---|---|---|---|---|---|---
[1, 3, 16, 320, 320] | [8, 256, 256] | True | False | 12.0477 | 11.3196 | 1.0643
[1, 3, 16, 320, 320] | [32, 512, 512] | True | False | 222.8618 | 209.9955 | 1.0613
[1, 3, 16, 320, 320] | [8, 256, 256] | False | True | 17.9883 | 17.9937 | 0.9997
[1, 3, 16, 320, 320] | [32, 512, 512] | False | True | 380.7244 | 380.1916 | 1.0014

</details>

<details>
<summary>
Versions and build configs
</summary>

PyTorch master: 1.9.0.dev20210223
PyTorch master build setting:
```
BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,
```

PR : 1.9.0a0+74b172b
PR build setting:
```
BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/usr/bin/g++-7, CXX_FLAGS=-O3 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_PYTORCH_QNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=1, USE_CUDNN=1, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=OFF, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=0, USE_OPENMP=ON,
```
</details>

This description is based on the benchmarks and the code from [here](https://github.com/vfdev-5/interpolate-tensoriterator/tree/master/step_six).

TL;DR
- Linear upsampling generic implementation using TensorIterator for Nd case (single loop function for 1d, 2d and 3d cases)
  - can be generalized to nearest, bicubic interpolation modes.
- works for channels first and last cases.

Joint work with Francisco Massa (fmassa).

Pull Request resolved: https://github.com/pytorch/pytorch/pull/51653

Reviewed By: malfet

Differential Revision: D26619437

Pulled By: fmassa

fbshipit-source-id: 7d435e23881c5b40a18bf0dbcab4906d5462025f
2021-03-01 09:13:31 -08:00
Vasiliy Kuznetsov
0d46926c63 ns for fx: remove subgraphs from user facing API (#52928)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52928

Changes the user facing API of `prepare_single_model_output` to
require a list of nodes instead of a list of subgraphs. This ensures
that how we define a subgraph is an implementation detail and is
not exposed to the user, keeping the eng cost of updating this
implementation later low.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
```

Imported from OSS

Reviewed By: raghuramank100

Differential Revision: D26693471

fbshipit-source-id: 67c2feb844556225e36f8d6d4023246939bcb445
2021-03-01 08:56:26 -08:00
Vasiliy Kuznetsov
87be8c1d7c ns for fx: clean up duplicate code in get_matching_activations_a_shadows_b (#52927)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52927

Refactor to use an existing util instead of duplicating code, no logic
change.

Test Plan:
CI

Imported from OSS

Reviewed By: raghuramank100

Differential Revision: D26693474

fbshipit-source-id: 06b7047eb9a762557b7f679347e424c0dd009aad
2021-03-01 08:56:22 -08:00
Vasiliy Kuznetsov
5b93cdace1 ns for fx: remove model_name from get_matching_activations API (#52926)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52926

Model name is already stored in the Loggers in the prepare call.
Removing the need to specify it again in the extract activations
functions, to simplify things.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
```

Imported from OSS

Reviewed By: raghuramank100

Differential Revision: D26693473

fbshipit-source-id: 52511cacc16f79fa09c78ccde78e7f439f4b315c
2021-03-01 08:56:18 -08:00
Vasiliy Kuznetsov
907ee5b290 ns for fx: docblock fixes (#52925)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52925

Cleans up some incorrect comments and docblocks in
`numeric_suite_core_apis.py`.

Test Plan:
CI

Imported from OSS

Reviewed By: raghuramank100

Differential Revision: D26693472

fbshipit-source-id: 17f3ff464c6ea01374bcc6ac5899da7034627152
2021-03-01 08:53:57 -08:00
Alban Desmaison
0569f638fe Update CODEOWNERS for torch.nn (#52942)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/52942

Reviewed By: H-Huang

Differential Revision: D26699633

Pulled By: albanD

fbshipit-source-id: cf8b213e9bb69fa4980dba380bd42deee40faf85
2021-03-01 07:50:03 -08:00
kshitij12345
a06cf5d8a4 [numpy] torch.{rad2deg, deg2rad}: promote integer inputs to float (#51853)
Summary:
Reference: https://github.com/pytorch/pytorch/issues/42515

Depends on https://github.com/pytorch/pytorch/issues/51283

Pull Request resolved: https://github.com/pytorch/pytorch/pull/51853

Reviewed By: albanD

Differential Revision: D26399743

Pulled By: mruberry

fbshipit-source-id: a6f0e12723e1451c6479d818752fe5d41788715d
2021-03-01 06:25:23 -08:00
kshitij12345
f5617b0932 [testing] Add Opinfo for torch.frac and minor fixes (#52660)
Summary:
Reference : https://github.com/pytorch/pytorch/issues/42515

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52660

Reviewed By: ailzhang

Differential Revision: D26618151

Pulled By: mruberry

fbshipit-source-id: cf0df38e46f44d3afff6e0015af5a840c661aa0e
2021-03-01 04:58:31 -08:00
Mike Ruberry
312b297b82 Revert D26626092: [quant][graphmode][fx][fp16] Add fp16 support for {add|mul}{_relu}
Test Plan: revert-hammer

Differential Revision:
D26626092 (2962fbb03c)

Original commit changeset: 91d040efa51e

fbshipit-source-id: cc6bcc0f451d6adcd7bf7572451e6e3cd6ad59d1
2021-03-01 04:52:47 -08:00
Mike Ruberry
03693c7e4a Revert D26655617: [quant][graphmode][fx][test][refactor] Refactoring binary op tests to split int8 and float16 tests
Test Plan: revert-hammer

Differential Revision:
D26655617 (f2f7fdba05)

Original commit changeset: c36edef09f52

fbshipit-source-id: 7a43cfc9385e45f4532168d2c3d9227da2f1967f
2021-03-01 04:52:44 -08:00