Commit Graph

35689 Commits

Author SHA1 Message Date
75651e3cc4 Add remaining ToCs to ToC lint (#56487)
Summary:
The lint was originally added in https://github.com/pytorch/pytorch/issues/54974, but at the time I didn't realize that these other Markdown files also each have a table of contents:

- `GLOSSARY.md`
- `torch/csrc/jit/OVERVIEW.md`
- `torch/csrc/jit/docs/serialization.md`
- `torch/fx/OVERVIEW.md`

This PR adds those files to the lint, and also changes the rule from using a fixed list of filenames to a `git grep` command that finds all Markdown files containing this magic comment:

```md

```

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

Test Plan: The "Lint / toc" job in GitHub Actions.

Reviewed By: janeyx99

Differential Revision: D27884885

Pulled By: samestep

fbshipit-source-id: 5462437502b17fba93abf5098e21754bf566a4fe
2021-04-20 10:28:47 -07:00
062e70590c Add OpInfo tests for torch.{dot, vdot, bmm, mv} (#56409)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56409

Reviewed By: nikithamalgifb

Differential Revision: D27870769

Pulled By: anjali411

fbshipit-source-id: a1a0e89856529a4739c7612c5b1e3c5ed2569126
2021-04-20 10:22:15 -07:00
e4faebca0d Automated submodule update: tensorpipe (#56259)
Summary:
This is an automated pull request to update the first-party submodule for [pytorch/tensorpipe](https://github.com/pytorch/tensorpipe).

New submodule commit: 416a9d8a4a

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

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

Reviewed By: pbelevich

Differential Revision: D27881993

Pulled By: beauby

fbshipit-source-id: e7d8cefe89c6fb09b59e3ef57da05a7ab0a3cb16
2021-04-20 09:38:05 -07:00
cyy
f74a346213 Fix torch.hub.load("pytorch/vision") fails to validate the master branch (#56138)
Summary:
We should iterate all pages of the branches API. Otherwise, even using "pytorch/vision" would fail to find master.

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

Reviewed By: heitorschueroff

Differential Revision: D27872346

Pulled By: ailzhang

fbshipit-source-id: 55881558f7980b1fb08b0d08ed6687a38df06edd
2021-04-20 09:33:25 -07:00
b2dae294b6 Fix distributed.test_jit_c10d flaky tests (#56410)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56410

Changes:
- Move create_tcp_store() helper function to common file
- Update test_jit_c10d to retry TCP Store creation in case allocated port becomes used

fixes https://github.com/pytorch/pytorch/issues/55053

Test Plan: Imported from OSS

Reviewed By: heitorschueroff

Differential Revision: D27869560

Pulled By: H-Huang

fbshipit-source-id: f4a6613049bb25e6f6f194214379a380968bb19c
2021-04-20 09:28:27 -07:00
0e0a5471ef Remove an unused variable in SoftmaxWithLossOp (#56321)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56321

Reviewed By: heitorschueroff

Differential Revision: D27854332

Pulled By: bdhirsh

fbshipit-source-id: 1a9dcfdc63412069cee4444a595c3460815d3c6c
2021-04-20 09:18:08 -07:00
4e0760f41a Remove is_variable from tests (#56305)
Summary:
`is_variable` spits out a deprecation warning during the build (if it's
still something that needs to be tested we can ignore deprecated
warnings for the whole test instead of this change).

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

Pulled By: driazati

Reviewed By: ezyang

Differential Revision: D27834218

fbshipit-source-id: c7bbea7e9d8099bac232a3a732a27e4cd7c7b950
2021-04-20 09:03:53 -07:00
eacf6f1b51 Updated the tech docs to be consistent with other two descriptions (#56338)
Summary:
Updated the Beta channel description to be consistent with other two channels (Stable, Prototype)

The screenshot attached is for reference before changes.

![Screenshot 2021-04-18 12-36-55](https://user-images.githubusercontent.com/20245964/115137303-0c077380-a043-11eb-9532-c46486e8a75a.png)

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

Reviewed By: heitorschueroff

Differential Revision: D27854350

Pulled By: bdhirsh

fbshipit-source-id: a21208c11242e84de313d5b11269264756bf9029
2021-04-20 09:00:42 -07:00
c61778355c Upgrade ShellCheck to v0.7.2 (#56445)
Summary:
[First ShellCheck release in over a year!](https://github.com/koalaman/shellcheck/releases/tag/v0.7.2) I'm thankful for doing https://github.com/pytorch/pytorch/issues/55109 at the beginning of this month, because otherwise `master` would have just suddenly started failing a few hours ago.

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

Test Plan:
CI. You can also run `shellcheck` locally; for instance, if you're on Mac and [installed it with Homebrew](https://github.com/koalaman/shellcheck/tree/v0.7.2#installing):
```sh
brew upgrade shellcheck
rm -r .extracted_scripts ; tools/extract_scripts.py --out=.extracted_scripts
tools/run_shellcheck.sh .jenkins/pytorch .extracted_scripts
```

Reviewed By: janeyx99

Differential Revision: D27874084

Pulled By: samestep

fbshipit-source-id: 3bd871a368fe03aecd559e2f55bce36af49cfa27
2021-04-20 07:58:22 -07:00
3d878dee45 Added out= variant for torch.linalg.lstsq (#54721)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54721

Test Plan: Imported from OSS

Reviewed By: ngimel

Differential Revision: D27874711

Pulled By: mruberry

fbshipit-source-id: 696ebb6eb0bad81988e9cb7a081388a3a5ab3e2c
2021-04-20 07:09:06 -07:00
43c747859c Use c10 backtrace generation in caffe2 (#56198)
Summary:
This cuts out caffe2's old backtrace generation in favor of the one already in c10.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56198

Pulled By: driazati

Reviewed By: nikithamalgifb

Differential Revision: D27868282

fbshipit-source-id: aa9b9691271eaa3f95baab48773ffefebd924ae2
2021-04-20 07:00:33 -07:00
63dac82444 Make grad mode error just a warning (#56401)
Summary:
Temporary fix to give people extra time to finish the deprecation.

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

Reviewed By: xw285cornell, drdarshan

Differential Revision: D27862196

Pulled By: albanD

fbshipit-source-id: ed460267f314a136941ba550b904dee0321eb0c6
2021-04-20 06:30:55 -07:00
0ea4eb745b [opinfo] torch.lerp: move remaining cases from tensor_methods to opinfo (#55665)
Summary:
Fixes : https://github.com/pytorch/pytorch/issues/54304
Reference: https://github.com/pytorch/pytorch/issues/54261

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

Reviewed By: bdhirsh

Differential Revision: D27845528

Pulled By: mruberry

fbshipit-source-id: 36bdf14c4923a83fb8e4f4d361467d9568784011
2021-04-20 02:01:34 -07:00
df8bb5a42b Add OpInfo for polygamma and remove torch_op_tests Infra (#51966)
Summary:
Reference: https://github.com/pytorch/pytorch/issues/42515

* OpInfo entry for Polygamma
* Removes infra of torch_op_tests

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

Reviewed By: bdhirsh

Differential Revision: D27851858

Pulled By: mruberry

fbshipit-source-id: 7f1d0273065e1df56a152f95a14513959af29a1b
2021-04-20 01:03:09 -07:00
a661e58731 Removed infos vector in torch.linalg.qr (#56248)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56248

`info` error code for QR decomposition only indicates wrong parameters,
when everything is implemented correctly it will never be nonzero so we
don't need to check it for CPU path.
For MAGMA `checkMagmaInternalError` is added that checks for failed
memory allocations internal to MAGMA.

Test Plan: Imported from OSS

Reviewed By: ngimel

Differential Revision: D27850414

Pulled By: mruberry

fbshipit-source-id: ddda1209008f879f24c9ad08739e10c28b194d18
2021-04-20 00:08:31 -07:00
c5c5230890 Pytorch resolve bug around incorrect rdzv handler resolution (#56386)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56386

The diff resolves bug around incorrect handler resolution:
_create_static_handler pointed towards etcd, and _create_etcd_handler pointed towards static.

Test Plan:
buck test mode/dev-nosan //caffe2/test/distributed:test_launcher

Added test_launcher to the ci/cd tests

Reviewed By: cbalioglu

Differential Revision: D27858897

fbshipit-source-id: 440155789958c091ce5755e7c9524e4bb704203a
2021-04-19 23:50:28 -07:00
7ae45403a1 [static runtime] support aten::__getitem__ natively (#55310)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55310

Test Plan:
Run on the dper generated local/local_ro model
```
./buck-out/opt/gen/caffe2/caffe2/fb/predictor/ptvsc2_predictor_bench --scripted_model=/data/users/ansha/tmp/adfinder/aug_1x/210616848_0.predictor.disagg.local.local_ro.pt --pt_inputs=/data/users/ansha/tmp/adfinder/aug_1x/210616848_0.predictor.disagg.input_data.container.pt --iters=1000 --warmup_iters=10000 --num_threads=1 --pt_enable_static_runtime=1 --pt_cleanup_activations=true --pt_enable_out_variant=1 --pt_optimize_memory=1 --compare_results=0 --do_profile=0 --adsfinder_compatibility=1
```

Reviewed By: hlu1

Differential Revision: D27569662

fbshipit-source-id: df68c2fdd95e39a30aec35ddbaf1f5df0bc3a3da
2021-04-19 23:08:19 -07:00
85f4025ad7 Port adaptive_max_pool3d to structured kernel (#56320)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56320

Test Plan: Imported from OSS

Reviewed By: ailzhang

Differential Revision: D27862931

Pulled By: SplitInfinity

fbshipit-source-id: 99fc79611a95ce934ed879f8ae6b0c26a645813b
2021-04-19 22:42:12 -07:00
0d4394778e Port adaptive_max_pool2d to structured kernel (#56317)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56317

Test Plan: Imported from OSS

Reviewed By: ailzhang

Differential Revision: D27862930

Pulled By: SplitInfinity

fbshipit-source-id: e2d199df0ebaf585698f26fcfda5a0301ba67ade
2021-04-19 22:41:05 -07:00
513e9e0927 Fix cxx11 abi (#55984)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/55829

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

Reviewed By: agolynski

Differential Revision: D27809478

Pulled By: seemethere

fbshipit-source-id: b00801e50c364b307009349594e396b934cc3a49
2021-04-19 22:20:10 -07:00
07653b7fe0 [SPMD] Remove ddp_gpu_size field from SyncBatchNorm (#55946)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55946

As `ddp_gpu_size` field of `SyncBatchNorm` will always be 1 for GPU modules, remove this field and the relevant code.
ghstack-source-id: 126883498

Test Plan: waitforbuildbot

Reviewed By: zhaojuanmao

Differential Revision: D27746021

fbshipit-source-id: b4518c07e6f0c6943fbd7a7548500a7d4337126c
2021-04-19 21:41:29 -07:00
023231a2ac [torch/distributed] Fix pydoc for torch.distributed.elastic.multiprocessing (replace Redirect with Std)
Summary: `Redirects` was renamed to `Std` in `torch.distributed.elastic.multiprocessing.api`. Pointed out by a user in https://github.com/pytorch/elastic/issues/147.

Test Plan: N/A just doc change

Reviewed By: tierex

Differential Revision: D27866614

fbshipit-source-id: 9fb901aae7ebe11cde13000a1c118de527f34400
2021-04-19 21:40:16 -07:00
94406f77f6 [quant][graphmode][fx] Add support for keeping output quantized for list and dict (#56391)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56391

Previously we only support keeping output quantized for tensor output, this PR adds support
for list and dict (values) as well

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D27860327

fbshipit-source-id: e770160ced47a7173abff5505ec620bd2b1a0b01
2021-04-19 21:37:11 -07:00
eqy
42f0fe1fe3 fix misaligned access #56325 (#56403)
Summary:
CC ngimel ptrblck
ref: https://github.com/pytorch/pytorch/issues/56325

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

Reviewed By: mruberry

Differential Revision: D27866625

Pulled By: ngimel

fbshipit-source-id: 9dff0e9749f8de57fac6a653f685c14854611a02
2021-04-19 20:12:03 -07:00
92d24e3060 Revert D27855386: [pytorch][PR] Support factory kwargs in torch.nn modules
Test Plan: revert-hammer

Differential Revision:
D27855386 (40483acc51)

Original commit changeset: dabd505d2a04

fbshipit-source-id: f5bf3120d87861b30a8e1bf11977ad7d27cd8500
2021-04-19 20:07:20 -07:00
b1282bc109 Use stack trace implementation in common/process on fbcode (#56400)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56400

See https://github.com/pytorch/pytorch/issues/56399

I don't have time to fix this properly, so this is just to stem the
bleeding.  Someone should go and figure out what it is that common/process
is doing better.
ghstack-source-id: 126868405

Test Plan:
I manually patched this into D27765125 and triggered a
exception and observed that everything symbolized good:

```
[9]   what():  new_refcount != 1INTERNAL ASSERT FAILED at "caffe2/c10/util/intrusive_ptr.h":234, please report a bug to PyTorch. intrusive_ptr: Cannot increase refcount after it reached zero.
Exception raised from retain_ at caffe2/c10/util/intrusive_ptr.h:234 (most recent call first):
# 0  c10::get_backtrace[abi:cxx11](unsigned long, unsigned long, bool)
# 1  c10::(anonymous namespace)::GetFetchStackTrace[abi:cxx11]()::$_0::operator()[abi:cxx11]() const
# 2  std::_Function_handler<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (), c10::(anonymous namespace)::Ge
tFetchStackTrace()::$_0>::_M_invoke(std::_Any_data const&)
# 3  std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > ()>::operator()() const
# 4  c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
# 5  c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocat
or<char> > const&)
# 6  c10::detail::torchInternalAssertFail(char const*, char const*, unsigned int, char const*, char const*)
# 7  c10::intrusive_ptr<c10d::ProcessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessGroup> >::retain_()
# 8  c10::intrusive_ptr<c10d::ProcessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessGroup> >::intrusive_ptr(c10::intrusiv
e_ptr<c10d::ProcessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessGroup> > const&)
# 9  c10::intrusive_ptr<c10d::ProcessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessGroup> >& c10::intrusive_ptr<c10d::Pr
ocessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessGroup> >::operator=<c10d::ProcessGroup, c10::detail::intrusive_target
_default_null_type<c10d::ProcessGroup> >(c10::intrusive_ptr<c10d::ProcessGroup, c10::detail::intrusive_target_default_null_type<c10d::ProcessG
roup> > const&) &
```

Reviewed By: driazati

Differential Revision: D27861908

fbshipit-source-id: 84c1dfb1ef28c460b020646f836c153562ad5c44
2021-04-19 19:30:11 -07:00
f096245610 AutoNonVariableTypeMode->InferenceMode in OSS. (#56421)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56421

Test Plan: Imported from OSS

Reviewed By: bertmaher

Differential Revision: D27866609

Pulled By: ailzhang

fbshipit-source-id: 040991a031c5511501b03cfe21a4a636586e120e
2021-04-19 18:07:41 -07:00
5b4c3a9da1 record Torch DP and DDP modules forward (#55578)
Summary:
Fixes #{issue number}

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

Reviewed By: gdankel

Differential Revision: D27862392

Pulled By: ilia-cher

fbshipit-source-id: 18545d23e35a97c8f760707fecb696a24d47dc0a
2021-04-19 17:52:59 -07:00
31677c5fcb [reland] .github: Add initial linux CI workflow (#56280)
Summary:
This reverts commit 6b5ed5ec454ecd8597ff0465305915dd1e09a805.

There'll also probably be fixes here, see diff from original PR: https://github.com/pytorch/pytorch/compare/f2abce0...ci-all/add-initial-linux-ci-gha

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

Reviewed By: walterddr

Differential Revision: D27826012

Pulled By: seemethere

fbshipit-source-id: 71cad1d7f840ede5025b1bb4a33d628aa74686d1
2021-04-19 17:36:09 -07:00
0917061f43 [vulkan][jit_pass] Add optimized_for_vulkan attribute on vulkan pass (#56414)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56414

Test Plan: Imported from OSS

Reviewed By: xta0

Differential Revision: D27865144

Pulled By: IvanKobzarev

fbshipit-source-id: c59f0eb2722f3fce0a91d9bd0b7cae3e0436c496
2021-04-19 17:27:59 -07:00
7adc04d7b5 Add more logging to debug test_reduce_sum_cuda_twice (#56406)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56406

Been hard to reproduce
https://github.com/pytorch/pytorch/issues/50840, adding some debug log to get a
better sense of the issue.
ghstack-source-id: 126874222

Test Plan: waitforbuildbot

Reviewed By: rohan-varma

Differential Revision: D27863328

fbshipit-source-id: e6f125b77cfb636b90598eb54395609654f5e139
2021-04-19 17:24:49 -07:00
0d94c04247 [NNC] Change fuseLoops API to return bool flag and not throw any exceptions (#56353)
Summary:
Partial fix for https://github.com/pytorch/pytorch/issues/56357

Changes the `fuseLoops` API to the following form:
```
static bool fuseLoops(const std::vector<For*>& loops, For** fused);
```

Also, adds a new API to check for loop-carried dependences:
```
static bool hasLoopCarriedDependence(For* loop);
```

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

Reviewed By: bertmaher

Differential Revision: D27856214

Pulled By: navahgar

fbshipit-source-id: 443557088692585657faee296602c547a00117dd
2021-04-19 17:20:40 -07:00
fe3f6f2da2 [iOS GPU][Kernel] Implement mean.dim using MPSReduce kernel (#56073)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56073

Implement the `mean.dim` operator for Metal backend. Currently, we don't support reducing the batch dimension.
ghstack-source-id: 126802129

Test Plan:
- Sandcastle
- CircleCI
- Unit tests

```
2021-03-23 13:01:29.663842-0700 PyTorchPlayground[64572:9575354] [bool test_mean_dim()],[1 5 2 2 ],[SUCCEED]
2021-03-23 13:01:29.666230-0700 PyTorchPlayground[64572:9575354] [bool test_mean_dim2()],[1 5 2 2 ],[SUCCEED]
```

Reviewed By: dhruvbird

Differential Revision: D27269394

fbshipit-source-id: fafcdde50ac457a8488c6170d0a8d3db1871439b
2021-04-19 16:34:16 -07:00
fa7534788b Fix typo in gradcheck.py (#56368)
Summary:
betwen -> between

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

Reviewed By: bdhirsh

Differential Revision: D27860450

Pulled By: albanD

fbshipit-source-id: 86ef7b62e228c15319683a8d72b404b5f527666e
2021-04-19 15:53:02 -07:00
34d0bd5b1d Fix TestTypeHints.test_doc_examples (#56388)
Summary:
https://github.com/pytorch/pytorch/issues/54268 removed `test_run_mypy` since now we're running `mypy` as its own job in GitHub Actions, but previously we used this `set_cwd` context manager in that test to ensure that we picked up the `mypy` config correctly. However, for some reason, we have not been doing that in `test_doc_examples`, which has been succeeding in CI for a while despite being broken.

Specifically, [`run_test.py` changes the working directory to `test/` before running test files](48aaea3359/test/run_test.py (L534-L535)), which is contrary to [what `CONTRIBUTING.md` instructs developers to do](48aaea3359/CONTRIBUTING.md (python-unit-testing)). As a result, in CI, `test/test_type_hints.py` has been passing in CI, but if you run it locally from the root of the repo, this you get this error:
```
F
======================================================================
FAIL: test_doc_examples (__main__.TestTypeHints)
Run documentation examples through mypy.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_type_hints.py", line 127, in test_doc_examples
    self.fail(f"mypy failed:\n{stdout}")
AssertionError: mypy failed:
test/generated_type_hints_smoketest.py:851: error: Name 'tensor' is not defined  [name-defined]
test/generated_type_hints_smoketest.py:853: error: Name 'tensor' is not defined  [name-defined]
Found 2 errors in 1 file (checked 1 source file)

----------------------------------------------------------------------
Ran 1 test in 1.416s

FAILED (failures=1)
```

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

Test Plan:
Before this PR, the first of the following two commands should fail (since that is essentially what is run in CI), but the second should fail:
```
python test/run_test.py -i test_type_hints
python test/test_type_hints.py
```
After this PR, both commands should succeed.

Reviewed By: driazati

Differential Revision: D27860173

Pulled By: samestep

fbshipit-source-id: efb82fffd7ccb04d0331824b40bdef7bbc319c98
2021-04-19 15:27:09 -07:00
2f5c352162 Fix protobuf warnings in caffe2 (#56186)
Summary:
This guards some deprecated usages of the Protobuf API behind an `#ifdef` (this is how onnx does it as well)
](https://our.intern.facebook.com/intern/diff/27803121/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56186

Pulled By: driazati

Reviewed By: bertmaher, dzhulgakov

Differential Revision: D27803121

fbshipit-source-id: 2d3a348ec1ab9879a0d8f2dff17c5444fd4baf2c
2021-04-19 15:19:53 -07:00
638617f9f8 Write mini dump on pybind exceptions (#55652)
Summary:
We register an [error handler](https://pybind11.readthedocs.io/en/stable/advanced/exceptions.html#registering-custom-translators) with pybind so that C++ exceptions are passed to Python and raised as runtime errors that can be `try...except`ed etc. Since these don't terminate the program (until Python does), they never fire the signal handler to write a minidump out with the crash information. This PR adds some logic in the exception translator to write out a minidump if enabled.
](https://our.intern.facebook.com/intern/diff/27830952/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55652

Pulled By: driazati

Reviewed By: bertmaher

Differential Revision: D27830952

fbshipit-source-id: 26e8f913e99dff971a4eb09eb87221c66f759763
2021-04-19 14:53:43 -07:00
a14178ed5c Remove useless code (#56230)
Summary:
Since we're using specific VS, we don't need to specify VC version.
In fact, the VC version is not used in CI now.

Why I make this change now?
I'm writing a robot to update the vs_install.ps1 (https://github.com/pytorch/pytorch/pull/56261/) every 2 weeks.
It will submit a PR to check if the latest VS is compatible with PyTorch automatically.

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

Reviewed By: bdhirsh

Differential Revision: D27856647

Pulled By: ezyang

fbshipit-source-id: b46f2bdf35ab5841fded470e23bbf7a01d5f60f4
2021-04-19 14:22:18 -07:00
04607a58f1 [pytorch] Fix compiler warnings from conv.h (#56181)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56181

Need to change to size_t vs size_t:

Reviewed By: ezyang

Differential Revision: D27800849

fbshipit-source-id: 25f744128eb8750c382dc967a99af3c9f16247d9
2021-04-19 14:13:02 -07:00
2c9972facf [iOS GPU][Kernel] Implement transpose in Metal shaders (#54522)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54522

Implement the transpose operator in metal shaders using textures.
ghstack-source-id: 126802125

Test Plan:
- Metal operator tests
```
2021-03-22 02:25:53.941006-0700 PyTorchPlayground[57924:9047121] [bool test_transpose()],[1 2 2 5 ],[SUCCEED]
2021-03-22 02:25:53.949834-0700 PyTorchPlayground[57924:9047121] [bool test_transpose2()],[1 2 58 28 28 ],[SUCCEED]
2021-03-22 03:12:19.786584-0700 PyTorchPlayground[58230:9066223] [bool test_transpose3()],[4 5 6 ],[SUCCEED]
```
- Sandcastle CI
- CircleCI

Reviewed By: SS-JIA

Differential Revision: D27225940

fbshipit-source-id: 14bfb96435a39aecf4f14bc5e2f7232421014328
2021-04-19 13:52:54 -07:00
e3900d2ba5 Add lint for unqualified noqa (#56272)
Summary:
As this diff shows, currently there are a couple hundred instances of raw `noqa` in the codebase, which just ignore all errors on a given line. That isn't great, so this PR changes all existing instances of that antipattern to qualify the `noqa` with respect to a specific error code, and adds a lint to prevent more of this from happening in the future.

Interestingly, some of the examples the `noqa` lint catches are genuine attempts to qualify the `noqa` with a specific error code, such as these two:
```
test/jit/test_misc.py:27:            print(f"{hello + ' ' + test}, I'm a {test}") # noqa E999
test/jit/test_misc.py:28:            print(f"format blank") # noqa F541
```
However, those are still wrong because they are [missing a colon](https://flake8.pycqa.org/en/3.9.1/user/violations.html#in-line-ignoring-errors), which actually causes the error code to be completely ignored:

- If you change them to anything else, the warnings will still be suppressed.
- If you add the necessary colons then it is revealed that `E261` was also being suppressed, unintentionally:
  ```
  test/jit/test_misc.py:27:57: E261 at least two spaces before inline comment
  test/jit/test_misc.py:28:35: E261 at least two spaces before inline comment
  ```

I did try using [flake8-noqa](https://pypi.org/project/flake8-noqa/) instead of a custom `git grep` lint, but it didn't seem to work. This PR is definitely missing some of the functionality that flake8-noqa is supposed to provide, though, so if someone can figure out how to use it, we should do that instead.

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

Test Plan:
CI should pass on the tip of this PR, and we know that the lint works because the following CI run (before this PR was finished) failed:

- https://github.com/pytorch/pytorch/runs/2365189927

Reviewed By: janeyx99

Differential Revision: D27830127

Pulled By: samestep

fbshipit-source-id: d6dcf4f945ebd18cd76c46a07f3b408296864fcb
2021-04-19 13:16:18 -07:00
7bcf95bbb6 [iOS GPU] Move the definition of fp16_t to MetalUtils.h (#54521)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54521

Move code around. No significant feature changes.
ghstack-source-id: 126802126

Test Plan:
- CircleCI
- Sandcastle

Reviewed By: SS-JIA

Differential Revision: D27225941

fbshipit-source-id: 8b5439b6bf5e24ea755cb1941d92fae26a8d5a06
2021-04-19 13:08:01 -07:00
40483acc51 Support factory kwargs in torch.nn modules (#54508)
Summary:
Continuation of https://github.com/pytorch/pytorch/pull/53144

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

Reviewed By: bdhirsh

Differential Revision: D27855386

Pulled By: jbschlosser

fbshipit-source-id: dabd505d2a04208e74b158570fb2859c736eea2c
2021-04-19 12:24:58 -07:00
ca6e5c7fc9 [NNC] added more python bindings for loopnest (#56213)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56213

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D27809000

Pulled By: huiguoo

fbshipit-source-id: 013a1ae74397650a958c4fdcd39b38a3c0ff17ef
2021-04-19 11:28:00 -07:00
d1b6383d65 Hide warnings for deprecated quantization APIs (#56291)
Summary:
These have a tracking task to actually fix them but in the meantime they
should not be clogging up everyone's build output (see #55952).
](https://our.intern.facebook.com/intern/diff/27830229/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56291

Pulled By: driazati

Reviewed By: bertmaher

Differential Revision: D27830229

fbshipit-source-id: f1e5d6e9b2c63d4a4ad99a1744a520f8c681c22b
2021-04-19 11:11:33 -07:00
48aaea3359 unified GlooStore and c10d store API (#56222)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56222

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

Test Plan: Imported from OSS

Reviewed By: rohan-varma

Differential Revision: D27785267

Pulled By: msaroufim

fbshipit-source-id: ce247f9226ecc971af8e1f08adeb835f64973e12
2021-04-19 10:57:18 -07:00
5748cc0d11 [Mobile GPU] Ban mutations in JIT passes (#56070)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56070

**Summary**

Currently, we're returning copies instead of alias on mobile GPU (Metal/Vulkan). As suggested by ailzhang , we could use the JIT pass - `RemoveTensorMutation` to ban mutations ahead of time. I've tested two scenarios as shown below. They both work fine on mobile.

- view

```
class Model (torch.nn.Module):
    def forward(self, x):
        y = x.view(-1)
        z = torch.tensor(2.0).float()
        y.add_(z)
        return x

m = Model()
x = torch.rand(2, 3)
y = m(x)
```
- transpose

```
class Model (torch.nn.Module):
    def forward(self, x):
        y = x.transpose(1, 2)
        z = torch.tensor(2.0).float()
        x.add_(z)
        return y

m = Model()
x = torch.rand(1, 2, 3)
y = m(x)
```

As we're adding more ops, we should add more tests to cover all the alias ops - https://github.com/pytorch/pytorch/blob/master/tools/autograd/gen_inplace_or_view_type.py#L31-L80

**Next step**

Synced offline with eellison. Since mutation removal is also being used in ONNX, Static runtime, some jit optimizations, Torch -> TVM, etc, instead of inventing something new, we would continue to make it better in cases where it fails.

Although this JIT pass could work for most of the mobile models, there are cases that it can't cover. What we're going to do next is to implement stub ops for GPU models to let them run on server side, such that users can compare results to see if there is any discrepancy.

ghstack-source-id: 126802123

Test Plan:
- Sandcastle
- CircleCI

Reviewed By: raziel

Differential Revision: D27692683

fbshipit-source-id: 9d1be8a6c0a276032b1907807a54fbe2afd882f9
2021-04-19 10:43:53 -07:00
98162cb0bb Enable AutoGradMode in InferenceMode. (#56107)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56107

Test Plan: Imported from OSS

Reviewed By: pbelevich, driazati

Differential Revision: D27807137

Pulled By: ailzhang

fbshipit-source-id: bfacf11ec5a431589cec73d6371cac81b425a115
2021-04-19 10:24:20 -07:00
8881f504f1 Remove the unused maximum and minimum functions in vec256_base (#56313)
Summary:
They are unused, unrelated to vectorization, and confusing for code
readers (each of them have 2 overloads that are actually used).

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

Reviewed By: bdhirsh

Differential Revision: D27854290

Pulled By: ezyang

fbshipit-source-id: 14945ceac39a3f19e5d0f8d762b17f8c2172b966
2021-04-19 10:00:52 -07:00
6409d34482 Sort glob of files to ensure it is deterministic (#55850)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55850

ghstack-source-id: 126339587

Test Plan: diff on top builds successfully on Sandcastle

Reviewed By: wconstab

Differential Revision: D27722254

fbshipit-source-id: 181ae1a874dbfc73688dcc5b7e9264d79abd44d3
2021-04-19 09:50:13 -07:00