Commit graph

47917 commits

Author SHA1 Message Date
zengk95
2acd2317b8 [mergebot] Create land time check options (#77943)
This adds land time checks before we try to merge. What this does is:
1. Merge changes into latest master, check out a new branch, push, and have a workflow that runs jobs from trunk (and maybe pull)
2. Wait for all checks in the landtime workflow to finish by using the GH API (graphql doesn't have this method from what I can see)
3. push the changes in

Test Plan:
Tested this in canary with a new workflow that passes and lint, tested what happens if i break the new workflow by exiting with 1, the normal flow, and some other flows.

Tested it breaking when land checks fail:
https://github.com/pytorch/pytorch-canary/pull/113#issuecomment-1165941716

Test that it works:
https://github.com/pytorch/pytorch-canary/pull/114#issuecomment-1165922791

Test that normal validations like PR is broken:
https://github.com/pytorch/pytorch-canary/pull/113#issuecomment-1165930037

Test that normal merge works:
https://github.com/pytorch/pytorch-canary/pull/113#issuecomment-1166751288

Test that force merge works:
https://github.com/pytorch/pytorch-canary/pull/113#issuecomment-1167507356
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77943
Approved by: https://github.com/janeyx99
2022-06-27 22:28:12 +00:00
Jiewen Tan
79c2dfcd8e [c10d] Make send/recv as custom ops (#79779)
Summary:
This patch makes send/recv as custom ops such that it's dispatcher
passable. It's one part of the effort to route comm ops to the dispatcher
such that tracing mechanisms that relies on the dispatcher can trace them,
e.g., LazyTensor and AOTAutograd.

Test Plan:
python test/distributed/test_c10d_nccl.py -k test_send_recv
...and other existing distributed tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79779
Approved by: https://github.com/mrshenli, https://github.com/wanchaol
2022-06-27 22:07:17 +00:00
erjia
3ec9d34f21 Fix distributed store to use add for the counter of DL shared seed (#80348)
In order to get the result of `_shared_seed_recv_cnt` properly, switch from `store.get` to `store.add(key, 0)`.

See the comment from distributed team for the reason:
590d3e5774/torch/distributed/distributed_c10d.py (L242-L246)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80348
Approved by: https://github.com/VitalyFedyunin, https://github.com/NivekT
2022-06-27 21:59:17 +00:00
Erjia Guan
3d218e1c87 Raise warning for unpickable local function (#547) (#80232)
Summary:
X-link: https://github.com/pytorch/data/pull/547

Fixes https://github.com/pytorch/data/issues/538
- Improve the validation function to raise warning about unpickable function when either lambda or local function is provided to DataPipe.
- The inner function from functools.partial object is extracted as well for validation
- Mimic the behavior of pickle module for local lambda function: It would only raise Error for the local function rather than lambda function. So, we will raise warning about local function not lambda function.
```py

>>> import pickle
>>> def fn():
...     lf = lambda x: x
...     pickle.dumps(lf)
>>> pickle.dumps(fn)
AttributeError: Can't pickle local object 'fn.<locals>.<lambda>'
```

This Diff also fixes the Error introduced by https://github.com/pytorch/pytorch/pull/79344

Test Plan:
CI on PyTorch and TorchData
Manually validated the tests from TorchVision

Differential Revision: D37417556

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80232
Approved by: https://github.com/NivekT
2022-06-27 21:47:09 +00:00
anjali411
f68f77610a Add __all__ to torch.nn.quantized, fx.passes, ao.nn and amp submodules (#80376)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80376
Approved by: https://github.com/albanD
2022-06-27 21:36:27 +00:00
Svetlana Karslioglu
7394de4e1e Add a note on CUDA 11.6 (#80363)
Fixes #79876

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80363
Approved by: https://github.com/atalman
2022-06-27 21:34:24 +00:00
Nicola De Cao
27fc9fcd13 More stable computation of KL between two Bernoulli distributions (#79944)
Fixes #20164

@neerajprad here the new PR with the updated master

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79944
Approved by: https://github.com/neerajprad
2022-06-27 21:31:45 +00:00
PyTorch MergeBot
be71f663f6 StringUtils: Avoid unnecessary allocation in ReplaceAll (#79915)
When the replacement string is smaller than the search string,
`ReplaceAll` can operate in-place on the original string and so
avoid an extra allocation and some string copies.

As suggested in https://github.com/pytorch/pytorch/pull/76976#discussion_r902036461
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79915
Approved by: https://github.com/ezyang
2022-06-27 21:28:04 +00:00
anjali411
3bcc19b29a Add __all__ to various submodules in torch.fx, distributions, distributed, package (#80367)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80367
Approved by: https://github.com/albanD
2022-06-27 21:27:30 +00:00
Edward Z. Yang
02730c1e79 Add merge rules for distributions per https://pytorch.org/docs/stable/community/persons_of_interest.html (#80344)
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80344
Approved by: https://github.com/janeyx99
2022-06-27 21:13:28 +00:00
Andrew M. James
9e3677f85d Add support for BSR <-> Strided Conversion (#80354)
Supersedes #78303

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80354
Approved by: https://github.com/cpuhrsch
2022-06-27 21:09:09 +00:00
Khushi Agrawal
8f7d4fa157 [fix] primTorch test: atanh (#80365)
As per https://github.com/pytorch/pytorch/pull/80210#discussion_r907398643

Thanks, @IvanYashchuk for pointing it out :)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80365
Approved by: https://github.com/mruberry
2022-06-27 21:07:29 +00:00
qqaatw
7a8d6c9b1d [ONNX] Fix onnx logical functions' dtype (#79339)
Part of #79263

Before: output bool is casted back to input's dtype.
After: no longer casted back.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79339
Approved by: https://github.com/BowenBao
2022-06-27 20:50:41 +00:00
Will Constable
f72d867b70 Add torch.nn.functional.threshold ref (#79808)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79808
Approved by: https://github.com/mruberry
2022-06-27 20:30:42 +00:00
Allen Goodman
ab8797d69b torch.special.spherical_bessel_j0 (#78912)
```Python
spherical_bessel_j0(input, *, out=None) -> Tensor
```

Spherical Bessel function of the first kind of order $0$.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78912
Approved by: https://github.com/mruberry
2022-06-27 20:14:46 +00:00
Teddy Koker
0468dafeaa Fix Tensor.scatter_add_ doc (#80223)
Current documentation writes "Adds all values from the tensor `other` into `self`" when the actual argument of the values is named `src`. Fixed by renaming `other` to `src`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80223
Approved by: https://github.com/mikaylagawarecki
2022-06-27 19:57:53 +00:00
PyTorch MergeBot
4e33c8c6bb switched over to using faketensor in proxytensor (#79634)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79634
Approved by: https://github.com/albanD
2022-06-27 19:55:47 +00:00
Allen Goodman
f563f25efd torch.special.gamma (#78904)
```Python
gamma(input, *, out=None) -> Tensor
```

Gamma function $\Gamma\left(\text{input}\right)$.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78904
Approved by: https://github.com/mruberry
2022-06-27 19:36:17 +00:00
Michael Suo
d67ce755ad [ci] only upload summarized test stats for PRs (#80295)
We are uploading too many tests which is stressing out Rockset. We do
not really use granular per-test statistics for PRs, so change to
uploading summary information for PRs.

We will still be uploading per-test stats from master.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80295
Approved by: https://github.com/seemethere, https://github.com/malfet, https://github.com/janeyx99
2022-06-27 18:40:39 +00:00
PyTorch MergeBot
8878bc7bfe Revert "[ci] only upload summarized test stats for PRs (#80295)"
This reverts commit 5d595182c7.

Reverted https://github.com/pytorch/pytorch/pull/80295 on behalf of https://github.com/suo due to reverting and relanding with a small bugfix
2022-06-27 18:33:05 +00:00
Edward Z. Yang
f3a5e364a0 Add dynamo test configuration (#80342)
This test configuration runs PyTorch's test suite under torchdynamo.
Once stabilized, we will make this default and remove this particular
CI job.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80342
Approved by: https://github.com/anijain2305
2022-06-27 18:31:03 +00:00
Michael Suo
5d595182c7 [ci] only upload summarized test stats for PRs (#80295)
We are uploading too many tests which is stressing out Rockset. We do
not really use granular per-test statistics for PRs, so change to
uploading summary information for PRs.

We will still be uploading per-test stats from master.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80295
Approved by: https://github.com/seemethere, https://github.com/malfet
2022-06-27 18:24:15 +00:00
kshitij12345
f2587849db [chalf] roll, fftshift, ifftshift (#79970)
Ref: #74537
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79970
Approved by: https://github.com/peterbell10, https://github.com/anjali411
2022-06-27 17:53:56 +00:00
Ivan Yashchuk
471c833043 Fix div(scalar, tensor) case for nvFuser (#80341)
This PR fixes a typo in nvFuser for `div(scalar, tensor)` unlocking the tests for `_refs.true_divide` and `_refs.sigmoid`.

Same PR with a C++ test to the nvFuser devel branch: https://github.com/csarofeen/pytorch/pull/1778.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80341
Approved by: https://github.com/ngimel
2022-06-27 17:25:24 +00:00
Pearu Peterson
cde365a7cd Validate Sparse Compressed tensor inputs (#79385)
The validation includes regular tensor inputs, batched tensor inputs, as well as hybrid tensor inputs.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79385
Approved by: https://github.com/nikitaved, https://github.com/cpuhrsch
2022-06-27 17:19:54 +00:00
PyTorch MergeBot
9db3c517de Add __all__ for torch.nn.modules, torch.distributed.elastic, torch.nn.utils submodules (#80240)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80240
Approved by: https://github.com/rohan-varma
2022-06-27 17:11:12 +00:00
Christian Puhrsch
2258db5da3 TensorImpl:::size_custom to support NestedTensor.size (#80236)
This allows subclasses such as NestedTensorImpl to provide special behavior for `int64_t size(int64_t d)` that'll also be accessible by our Python frontend.

It follows the same pattern as sizes_custom.

Currently getting CI before asking for a review.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80236
Approved by: https://github.com/ezyang
2022-06-27 17:07:42 +00:00
kshitij12345
4300f64ad0 [composite compliance] embedding_bag (#79986)
Ref: #69991
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79986
Approved by: https://github.com/zou3519
2022-06-27 16:41:11 +00:00
Michael Suo
590d3e5774 [ci] skip slow gradcheck jobs (#80311)
Skip to restore the CI while we investigate
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80311
Approved by: https://github.com/janeyx99
2022-06-27 15:29:03 +00:00
Andrew Gu
7794254851 [Checkpoint Wrapper] Fix assert (#80283)
f11cce309b/test/distributed/fsdp/test_checkpoint_wrapper.py (L103-L109)

The second assert is re-asserting the same thing as the first assert, so `functional_reentrant` and `wrapper_reentrant` are unused. This PR fixes the second assert to assert that `functional_reentrant` and `wrapper_reentrant` are equal.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80283
Approved by: https://github.com/rohan-varma
2022-06-27 15:19:39 +00:00
kshitij12345
1b18c2e93c [composite compliance] fill (#80277)
Ref: #69991

Probably started working since : https://github.com/pytorch/pytorch/pull/78026
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80277
Approved by: https://github.com/zou3519
2022-06-27 15:13:56 +00:00
asl3
777c12f2df [quant] Modify APoT nonuniform quantization workflow (#80075)
### Summary:
This PR updates the design of APoT Observer, Quantizer, and Tensor to be more consistent with their uniform counterparts in the PyTorch framework. APoT Observer now calculates alpha as the max between the absolute values of the max and min values in the input tensor. APoT Quantizer is modified so its instance methods quantize_APoT and dequantize_APoT are called by their global method counterparts. APoT Tensor is modified to account for the new method definition of the `quantize_APoT` from APoT Quantizer.

### Test Plan:
Run APoT Observer class unit tests with: `python pytorch/test/quantization/core/experimental/test_nonuniform_observer.py`
Run APoT Quantize class unit tests with: `python pytorch/test/quantization/core/experimental/test_quantizer.py`
Run APoT Tensor class unit tests with: `python pytorch/test/quantization/core/experimental/test_quantized_tensor.py`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80075
Approved by: https://github.com/jerryzh168
2022-06-27 14:54:06 +00:00
Alexander Grund
71d9592a72 Only sync CUDA if the operation is run on GPU (#80328)
This fixes test failures when PyTorch is build without CUDA

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

I used the same is_cuda check that is used in test_nn.py

CC @ailzhang after #58564
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80328
Approved by: https://github.com/mruberry
2022-06-27 14:49:39 +00:00
Alexander Grund
3b8589ac44 Copy Tensor for tests to avoid in-place transform modifying the original tensor (#80331)
Fixes #48591

CC @mruberry  after #60256
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80331
Approved by: https://github.com/mruberry
2022-06-27 14:47:52 +00:00
Ryan Spring
1d0d506e97 Add Div reference (#77936)
Add Prims:
-  trunc
-  Replace _wrap_scalar with scalar_tensor

Add Reference:
-  copysign
- div
- floor_divide
- trunc_divide

Other:
* Add support for `variant_test_name` in _find_referenced_opinfo
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77936
Approved by: https://github.com/mruberry
2022-06-27 14:46:17 +00:00
Yifan Shen
09f79e94ac support nested_tensor * scalar (#80284)
In transformer, the scale step in attention has a `nested_tensor / scalar` operation. There are two ways to support that:
1. directly support `nested_tensor / scalar`:
* pro: straightforward, good UX
* con: is dispatching `mul(nested tensor, regular tensor)` a good practice?
2. let user manually convert `scalar` to `nested_scalar = torch.nested_tensor([broadcast_scalar])`
* pro: dispatcher only has to deal with `mul(nested tensor, nested tensor)`
* con: confusing manual conversions, bad UX
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80284
Approved by: https://github.com/cpuhrsch
2022-06-27 14:15:05 +00:00
asl3
0eee81aaad [quant] Modify APoT qparam quantization levels calculation (#80303)
### Summary:
This PR updates an error in the the computation for APoT quantization levels to match the formula defined in the APoT paper: https://arxiv.org/pdf/1909.13144.pdf.

### Test Plan:
Run unit tests with:` python pytorch/test/quantization/core/experimental/test_nonuniform_observer.py`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80303
Approved by: https://github.com/dzdang
2022-06-27 13:34:05 +00:00
Ezgi Çiçek
044c9a650b Avoid unnecessary copy of rvalue ref shared ptr in SharedPtrWrapper (#79697)
Differential Revision: D37206550

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79697
Approved by: https://github.com/zhxchen17
2022-06-27 12:53:48 +00:00
Nikita Shulga
14813536a7 Disable AVX512 CPU dispatch by default (#80253)
As it can be slower, see https://github.com/pytorch/pytorch/issues/80252
Update trunk test matrix to test AVX512 config in `nogpu_AVX512` flavor.
Kill `nogpu_noAVX` as AVX support were replaced with AVX512 when https://github.com/pytorch/pytorch/pull/61903 were landed
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80253
Approved by: https://github.com/ngimel
2022-06-27 12:39:34 +00:00
Jiewen Tan
238eaf2094 [c10d] Make barrier as a custom op (#79777)
Summary:
This patch makes barrier as a custom op such that it's dispatcher
passable. It's one part of the effort to route comm ops to the dispatcher
such that tracing mechanisms that relies on the dispatcher can trace them,
e.g., LazyTensor and AOTAutograd.

Test Plan:
python test/distributed/test_c10d_nccl.py -k test_nccl_barrier
...and other existing distributed tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79777
Approved by: https://github.com/mrshenli, https://github.com/wanchaol
2022-06-27 10:57:36 +00:00
Jiewen Tan
dcd17357a4 [c10d] Make alltoall as a custom op (#79691)
Summary:
This patch makes alltoall as a custom op such that it's dispatcher
passable. It's one part of the effort to route comm ops to the dispatcher
such that tracing mechanisms that relies on the dispatcher can trace them,
e.g., LazyTensor and AOTAutograd.

Test Plan:
BACKEND=nccl WORLD_SIZE=2 python test/distributed/test_distributed_spawn.py -v TestDistBackendWithSpawn.test_all_to_all_cuda
    BACKEND=nccl WORLD_SIZE=2 python test/distributed/test_distributed_spawn.py -v TestDistBackendWithSpawn.test_all_to_all_cuda_complex
    BACKEND=nccl WORLD_SIZE=2 python test/distributed/test_distributed_spawn.py -v TestDistBackendWithSpawn.test_all_to_all_full_group_cuda
    and other existing distributed tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79691
Approved by: https://github.com/mrshenli, https://github.com/wanchaol
2022-06-27 10:57:36 +00:00
Mo Zhou
799d71378c cmake: Fix variable typo for USE_SYSTEM_PYBIND11. (#80272)
The correct variable name should be USE_SYSTEM_PYBIND11, as defined in
the root CMakeLists.txt. In cmake/Dependencies.cmake, it is incorrectly
written as USE_SYSTEM_BIND11, but cmake will not complain about this.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80272
Approved by: https://github.com/suo
2022-06-27 02:08:07 +00:00
Brian Hirsh
c2d395cf8e functionalization <> LTC integration (take 3) (#80251)
new PR for https://github.com/pytorch/pytorch/pull/75527.

It looks like there's a bug in the windows CI scripts that was causing
flaky failures, that disappear when I create a new PR. example failure:
https://github.com/pytorch/pytorch/runs/6999272635?check_suite_focus=true
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80251
Approved by: https://github.com/wconstab
2022-06-26 23:10:21 +00:00
Ti-Tai Wang
33761c80d2 [ONNX] Move no runtime tests out of runtime test cases (#80078)
- Moved no_runtime test cases from runtime script to no_runtime
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80078
Approved by: https://github.com/BowenBao
2022-06-26 18:46:25 +00:00
Kshiteej K
8a5cc940e3 [composite compliance] quantile, nanquantile (#80024)
Ref: #69991
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80024
Approved by: https://github.com/zou3519
2022-06-26 10:55:36 +00:00
Edward Z. Yang
4331bc436e Ensure torch._refs registrations also get triggered on import torch (#80270)
Fixes https://github.com/pytorch/pytorch/issues/79938

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80270
Approved by: https://github.com/ngimel
2022-06-26 02:23:03 +00:00
migeedz
443db9b58e Introduce Z3 types and utility functions for constraint generation (#80084)
Create Z3 types. In particular, dynamic dimensions, dynamic tensor type and tensor types up to size 4. Note that for Z3 decidability reasons, we are using uninterpreted functions for tensor types, which means we must explicitly define tensor constructors with a concrete size (for now, upto size 4).  We defer lifting this requirement to future work.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80084
Approved by: https://github.com/anijain2305
2022-06-25 22:27:33 +00:00
Nikita Shulga
f11cce309b [MPS] Add equal operator (#80195)
Which is, in essence is composite of `eq`->`all`->`item`
`native/mps/operators/Equal.cpp` is an almost verbatim copy of `native/cuda/Equal.cpp`

Fix codegen by generating MPSFunctions headers

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80195
Approved by: https://github.com/albanD
2022-06-25 12:40:52 +00:00
Renfei Chen
ee0e836189 [FX] OSS is_fx_tracing (#80255)
Summary:
Enable a flag in tracer to export the status of the tracing rather than checking the module call function.
Context: Feature_processor needs is_fx_tracing and currently this function is implemented by PyPer and cannot be OSS. We want to open source this function and implement it inside Fx Tracer

Test Plan: test in the stacked diff D37386855

Reviewed By: jamesr66a

Differential Revision: D37386820

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80255
Approved by: https://github.com/jamesr66a
2022-06-25 10:47:05 +00:00
Nikita Vedeneev
417677bf62 permute for COO sparse tensors (#79707)
As per title. Partial implementation of https://github.com/pytorch/pytorch/issues/78422.
We cannot satisfy the view semantics once operated over sparse dims.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79707
Approved by: https://github.com/cpuhrsch
2022-06-25 08:49:58 +00:00