Commit Graph

46718 Commits

Author SHA1 Message Date
Brian Hirsh
2eea5eff62 functionalization: fix bug with multiple views of same base
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77129

Approved by: https://github.com/ezyang
2022-05-24 19:56:43 +00:00
Shunting Zhang
26d9386f67 Make string serialization of C++ FunctionSchema consistent with torchgen.model.FunctionSchema
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77926

There is a discrepency between the string representation of C++ FunctionSchema and torchgen.model.FunctionSchema.
The latter will not add parenthesis around the returned types if that a single item,
but the C++ FunctionSchema always add the parenthesis.

Make them consistent so we can convert one type to the other via its string representation and parse method.

Differential Revision: [D36535924](https://our.internmc.facebook.com/intern/diff/D36535924/)

Approved by: https://github.com/bdhirsh
2022-05-24 19:39:26 +00:00
Scott Wolchok
c083489f46 [kineto] Optimize getStepCallbacks for common case of no active callbacks
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77804

IIUC, the result of this function will be empty and unused if there are no sampled callbacks, which is the common case. We can accelerate this case by wrapping the result in an optional to save initializing an empty SmallVector.

Differential Revision: [D36497279](https://our.internmc.facebook.com/intern/diff/D36497279/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D36497279/)!

Approved by: https://github.com/robieta
2022-05-24 19:38:01 +00:00
Antonio Kim
02c4d877b4 Codegen Non-Native IR Nodes (#76535)
Add codegen infrastructure to generate IR nodes for non-native ops.

The proposed change is to add a `non_native` key to the `{backend}_native_functions.yaml` file that contains schema definitions similar to what is found in `native_functions.yaml`. e.g.
```
non_native:
    ...
    - func: expand(Tensor input, int[] size, bool is_scalar_expand) -> Tensor
    ...
```
these definitions are parsed into a `LazyIrSchema` that can be used for generating IR nodes using `GenLazyIR`.

Fixes #74628

CC: @wconstab @desertfire @henrytwo

Pull Request resolved: https://github.com/pytorch/pytorch/pull/76535
Approved by: https://github.com/wconstab
2022-05-24 19:29:23 +00:00
Eli Uriegas
13dcba8c07 ci: Remove runAttempt from s3 artifact upload
Reverts functionality to include the runAttempt in the artifact upload
prefix. This has proven to make it impossible to actually re-run tests
as test re-runs will try to pull from a prefix which doesn't actually
include artifacts

Signed-off-by: Eli Uriegas <eliuriegasfb.com>

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

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

Approved by: https://github.com/malfet
2022-05-24 19:12:04 +00:00
kshitij12345
ab5e6f0915 [chalf] enable testing for multiple ops (#78171)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78171
Approved by: https://github.com/ngimel
2022-05-24 19:11:10 +00:00
Catherine Lee
331629046d update xla commit - check for exist pr (#78156)
as in title, check for existing pr, if exists -> update that pr, if not exist -> make new pr
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78156
Approved by: https://github.com/malfet
2022-05-24 19:00:32 +00:00
Max Podkorytov
e4f5203386 print available modules in predictor error message (#78101)
Summary:
print available modules when throwing a module not found exception

I believe that improves UX

Differential Revision: D36580924

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78101
Approved by: https://github.com/mikeiovine
2022-05-24 18:47:06 +00:00
Brian Hirsh
3a921f2d26 as_strided support for functionalization; introduce as_strided_scatter
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77128

Approved by: https://github.com/ezyang
2022-05-24 18:20:31 +00:00
Brian Hirsh
7ddc1425ff functionalization fix for inplace comparison ops
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77125

Approved by: https://github.com/ezyang
2022-05-24 18:20:31 +00:00
Brian Hirsh
22d566acda functionalization fix for inplace_view ops
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77126

Approved by: https://github.com/ezyang
2022-05-24 18:20:30 +00:00
Jane Xu
70c511b5c8 [GHA] broaden upload test stats criteria (#78177)
Addresses bullet 2 of https://github.com/pytorch/pytorch/issues/78175
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78177
Approved by: https://github.com/suo
2022-05-24 17:59:41 +00:00
Michael Suo
a1f0e69519 [ci] improve upload test stats logging
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78179

Approved by: https://github.com/janeyx99
2022-05-24 17:32:20 +00:00
lezcano
0c8c39fa71 Fix derivatives of norm(p=inf)
Following up on https://github.com/pytorch/pytorch/pull/51099#discussion_r583323915, we fix these derivatives, as they were incorrect until now.

As described in the note, the better solution would be to use vectorised operations on the preprocessing operation when reducing on CPU. It's not clear how difficult that may be.

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

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

Approved by: https://github.com/ngimel
2022-05-24 17:16:16 +00:00
Kshiteej K
664bb4de49 [composite compliance] backward: cummin, cummax (#77872)
Reference : https://github.com/pytorch/pytorch/issues/69991
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77872
Approved by: https://github.com/zou3519
2022-05-24 17:10:09 +00:00
Scott Wolchok
80c4919bec [PyTorch] Stack-allocate boxed args for RecordFunction
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76266

Saving a heap allocation in this path improves performance.

Differential Revision: [D34090699](https://our.internmc.facebook.com/intern/diff/D34090699/)

Approved by: https://github.com/ezyang
2022-05-24 17:06:40 +00:00
Svetlana Karslioglu
e451259a60 Reorganize Community Section v1 (#77912)
- Change Notes to Guides
- Move the Community section to the top
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77912
Approved by: https://github.com/malfet
2022-05-24 16:38:24 +00:00
PyTorch MergeBot
821c711baf Revert "Move THPStorage definitions out of torch/csrc/generic (#78032)"
This reverts commit f012152836.

Reverted https://github.com/pytorch/pytorch/pull/78032 on behalf of https://github.com/suo due to This broke windows binary builds, see: f012152836
2022-05-24 16:37:35 +00:00
PyTorch MergeBot
ee4034ed0d Revert "masked logsumexp/logaddexp"
This reverts commit 49e15b578a.

Reverted https://github.com/pytorch/pytorch/pull/77876 on behalf of https://github.com/suo due to This broke master by adding a weird file, you attempted to delete it by committing on top of the head branch but that's not how ghstack works
2022-05-24 16:12:35 +00:00
Khushi Agrawal
6f4d200725 [complex32, jiterator] sin, asin (#77606)
Follows #74537 and #74748

cc @kshitij12345
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77606
Approved by: https://github.com/kshitij12345, https://github.com/ngimel
2022-05-24 16:08:44 +00:00
Natalia Gimelshein
4ea176ea57 expose fast get_current_stream (#78165)
Expose fast no-frills version of getting raw `cudaStream_t` in python (200 ns instead of 4 us)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78165
Approved by: https://github.com/SherlockNoMad, https://github.com/soumith, https://github.com/gchanan
2022-05-24 15:54:47 +00:00
George Qi
49e15b578a masked logsumexp/logaddexp
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77876

Approved by: https://github.com/cpuhrsch
2022-05-24 15:33:59 +00:00
Jane Xu
851885aedf .github - add pytorch dev infra team as codeowner (#78134)
@pytorch/pytorch-dev-infra should be a codeowner, to my understanding.

Trigger for this: we should get tagged on XLA PRs.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78134
Approved by: https://github.com/osalpekar, https://github.com/seemethere
2022-05-24 15:04:06 +00:00
sliorde
9b8abff4ac fix typo in docstring of Transformer.forward() (#78167)
Fixed the word "decode" to be "decoder".

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78167
Approved by: https://github.com/jbschlosser
2022-05-24 14:27:42 +00:00
kshitij12345
f9e346d5ac [opinfo] tranpose_conv, conv, adaptive_{max, avg}_pool unbatched samples (#73002)
As per title
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73002
Approved by: https://github.com/jbschlosser
2022-05-24 14:26:11 +00:00
swang392
2ac09cc6ce changed install_katex.sh to install_docs_reqs.sh, added install doxygen (#77907)
Fixes #77399

Increase CI stability by migrating a dependency to Docker to minimize risk of failure in installation. Installing doxygen in install_docs_reqs.sh instead of the cpp docs script.

**Test Plan**: cpp docs build passes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77907
Approved by: https://github.com/seemethere, https://github.com/janeyx99
2022-05-24 14:05:21 +00:00
Kurt Mohler
f012152836 Move THPStorage definitions out of torch/csrc/generic (#78032)
Fixes #77908

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78032
Approved by: https://github.com/ezyang
2022-05-24 13:42:14 +00:00
Mengwei Liu
9e806619cc [Codegen] Remove view operator check in NativeFunctionGroups and allow skipping native function generation (#78145)
Summary:
This PR adds two features:
* A boolean to turn off native function generation in codegen
* Relaxing `view` operator check for `NativeFunctionGroups`

Differential Revision: D36604646

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78145
Approved by: https://github.com/iseeyuan, https://github.com/bdhirsh
2022-05-24 05:48:30 +00:00
Nikita Shulga
6244daa6a9 [MPS] Fix torch.mps.is_available() (#78121)
By introducing `at:mps::is_available()` and changing `torch._C._is_mps_available` from property to memoizable callable

Also, if `_mtl_device` is released in MPSDevice destructor, shouldn't it be retained in the constructor

Looks like GitHubActions Mac runner does not have any Metal devices available, according to https://github.com/malfet/deleteme/runs/6560871657?check_suite_focus=true#step:3:15

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78121
Approved by: https://github.com/albanD
2022-05-24 05:10:38 +00:00
Nikita Shulga
c7ce4fcc61 [MPS] Initialize MPSDevice::_mtl_device property to nil (#78136)
This prevents `import torch` accidentally crash on machines with no metal devices

Should prevent crashes reported in https://github.com/pytorch/pytorch/pull/77662#issuecomment-1134637986 and https://github.com/pytorch/functorch/runs/6560056366?check_suite_focus=true

Backtrace to the crash:
```
(lldb) bt
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7202be57 libobjc.A.dylib`objc_msgSend + 23
    frame #1: 0x000000010fd9f524 libtorch_cpu.dylib`at::mps::HeapAllocator::MPSHeapAllocatorImpl::MPSHeapAllocatorImpl() + 436
    frame #2: 0x000000010fda011d libtorch_cpu.dylib`_GLOBAL__sub_I_MPSAllocator.mm + 125
    frame #3: 0x000000010ada81e3 dyld`ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 535
    frame #4: 0x000000010ada85ee dyld`ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40(lldb) up
frame #1: 0x000000010fd9f524 libtorch_cpu.dylib`at::mps::HeapAllocator::MPSHeapAllocatorImpl::MPSHeapAllocatorImpl() + 436
libtorch_cpu.dylib`at::mps::HeapAllocator::MPSHeapAllocatorImpl::MPSHeapAllocatorImpl:
->  0x10fd9f524 <+436>: movq   %rax, 0x1b0(%rbx)
    0x10fd9f52b <+443>: movw   $0x0, 0x1b8(%rbx)
    0x10fd9f534 <+452>: addq   $0x8, %rsp
    0x10fd9f538 <+456>: popq   %rbx
(lldb) disassemble
 ...
    0x10fd9f514 <+420>: movq   0xf19ad15(%rip), %rsi     ; "maxBufferLength"
    0x10fd9f51b <+427>: movq   %r14, %rdi
    0x10fd9f51e <+430>: callq  *0xeaa326c(%rip)          ; (void *)0x00007fff7202be40: objc_msgSend
```

which corresponds to `[m_device maxBufferLength]` call, where `m_device` is not initialized in
2ae3c59e4b/aten/src/ATen/mps/MPSAllocator.h (L171)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78136
Approved by: https://github.com/seemethere
2022-05-24 02:08:06 +00:00
Wanchao Liang
8eb62bd7ba [shard] make ShardedTensor a torch.Tensor subclass
This is the reland of PR https://github.com/pytorch/pytorch/pull/74695, which was reverted due to some internal failures.

It also removes the ShardedTensorInterface change, we will delay that
change later if we found there's a need to do that.

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

Approved by: https://github.com/pritamdamania87, https://github.com/fduwjj
2022-05-24 01:20:45 +00:00
PyTorch MergeBot
fb84f2223c Revert "[symint] Make TensorImpl::sizes_and_strides_ contain SymInt"
This reverts commit a7a818d9e2.

Reverted https://github.com/pytorch/pytorch/pull/77994 on behalf of https://github.com/seemethere due to Talked with @suo and we decided to revert because of broken [internal builds](https://www.internalfb.com/intern/sandcastle/job/678535557/). Also appears as though internal codegen might be broken as well.
2022-05-24 00:14:02 +00:00
Eddie Yan
c274f2ad52 [cuDNN V8 API] (reopen) Allow the number of kernels profiled under torch.backends.cudnn.benchmark = True to be limitedCudnnv8 benchmark limit (#77002)
(reopening due to botched merge)
The cuDNN V8 API (main support merged in https://github.com/pytorch/pytorch/pull/60755) potentially exposes many more kernels with benchmark=True. While these additional kernels can improve performance, it is often unnecessary to run every kernel returned by the heuristic and doing so may degrade the user experience by causing the first model iteration to be very slow. To alleviate this issue, this PR introduces torch.backends.cudnn.benchmark_limit. benchmark_limit specifies the maximum number of working cuDNN kernels to try for a given workload, with the default being 10 (similar to what TensorFlow does). benchmark_limit = 0 yields the current behavior of trying every kernel returned by the heuristic.

CC @ptrblck @ngimel @xwang233
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77002
Approved by: https://github.com/ngimel
2022-05-24 00:11:47 +00:00
PyTorch MergeBot
c50089712c Revert "Add index value checking to MaxUnpool2d and MaxUnpool3d (#70545)"
This reverts commit 53ef66bb59.

Reverted https://github.com/pytorch/pytorch/pull/70545 on behalf of https://github.com/malfet due to as it broke cuda-10.2 test on trunk, see 53ef66bb59
2022-05-23 23:58:43 +00:00
mikeiovine
2ae3c59e4b [SR] Remove linear/relu fusion
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77620

Apparently, this is not implemented in fbgemm, so it's strictly worse than using NNC.

Differential Revision: [D36431811](https://our.internmc.facebook.com/intern/diff/D36431811/)

Approved by: https://github.com/hlu1
2022-05-23 21:46:27 +00:00
Ryan Spring
bb4653e736 Add i0, i1, zeta refs (#78111)
Add reference implementations for i0, i1, zeta
Add prim operations for i0, i1, zeta
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78111
Approved by: https://github.com/mruberry
2022-05-23 21:33:56 +00:00
Catherine Lee
0bad87a932 xla hash auto update - add token to trigger workflows (#78094)
prs dont automatically trigger workflows because they were using the github bot token, so use merge bot token instead
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78094
Approved by: https://github.com/seemethere, https://github.com/janeyx99
2022-05-23 21:09:49 +00:00
Kurt Mohler
53ef66bb59 Add index value checking to MaxUnpool2d and MaxUnpool3d (#70545)
Fixes #68727

cc @mruberry @jbschlosser @walterddr @kshitij12345 @ngimel
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70545
Approved by: https://github.com/ngimel
2022-05-23 21:08:25 +00:00
Khushi Agrawal
a136408ada [complex32, jiterator] tan, atan (#77802)
Follows #74537 and #74748

cc @kshitij12345
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77802
Approved by: https://github.com/kshitij12345, https://github.com/ngimel
2022-05-23 21:01:19 +00:00
Michael Suo
623cfb2596 [skip ci] delete triage.yml
This is no longer used, so cleaning it up .

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

Approved by: https://github.com/seemethere, https://github.com/malfet
2022-05-23 20:39:47 +00:00
yuguo68
c186250d95 raise error when groups is not positive in Conv modules
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77919

Approved by: https://github.com/jbschlosser
2022-05-23 20:35:00 +00:00
Jane Xu
018982318c [GH1] Add builds as required status checks (#78086)
Third attempt of #77596
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78086
Approved by: https://github.com/suo, https://github.com/seemethere, https://github.com/malfet
2022-05-23 20:09:50 +00:00
Michael Suo
17ff484412 [ci] don't run distributed tests on mac
We already decided not to run these, but we forgot to actually do it I
guess?

[skip ci]

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

Approved by: https://github.com/janeyx99
2022-05-23 20:03:55 +00:00
Michael Suo
2c4312c5ba [ci] add retry to clean before checkout step
This was failing intermittently (e.g.
https://github.com/pytorch/pytorch/runs/6556614531?check_suite_focus=true).

I suspect it is due to this:
https://unix.stackexchange.com/questions/506319/why-am-i-getting-directory-not-empty-with-rm-rf

So adding a retry.

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

Approved by: https://github.com/malfet, https://github.com/seemethere
2022-05-23 19:01:05 +00:00
Ilya Persky
317d601e8d Fix docstring for nn.Hardswish (#70993)
Fixes nn.Hardswish's docstring problem reported at #70498.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70993
Approved by: https://github.com/jbschlosser
2022-05-23 18:52:19 +00:00
Horace He
ea5d01e629 [Primtorch] Tried porting leaky_relu into a ref (#78041)
Feels good to delete it from `torch._decomps`. This is mainly to clarify the process for me -

Seems like there's still some components missing of the `torch <-> refs` mapping? For example, seems like methods don't work yet for mapping from torch <-> refs, and neither do the meta tests? (cc: @ezyang).

If I replace the `torch` with `refs`, then the tests seem to pass.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78041
Approved by: https://github.com/mruberry
2022-05-23 18:00:21 +00:00
Justin Chu
652ecc9ad9 [ONNX] Fix typo when comparing DeviceObjType (#78085)
#77423 Introduced a typo in

1db9be70a7/torch/onnx/symbolic_opset9.py (L5012-L5017)

where the string `DeviceObjType` was replaced with `_C.DeviceObjType`. This PR reverts the changes to the strings.

**Tested:**

With torchvision,

```
pytest test/test_onnx.py::TestONNXExporter::test_mask_rcnn
pytest -n auto test/test_onnx.py::TestONNXExporter
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78085
Approved by: https://github.com/datumbox, https://github.com/BowenBao, https://github.com/ezyang
2022-05-23 17:29:36 +00:00
Jeff Daily
9aed30d3ad [ROCm] support benchmark flag for MIOpen (#77438)
Fixes #68172.  Generally, this corrects multiple flaky convolution unit test behavior seen on ROCm.

The MIOpen integration has been forcing benchmark=True when calling `torch._C._set_cudnn_benchmark(False)`, typically called by `torch.backends.cudnn.set_flags(enabled=True, benchmark=False)`.  We now add support for MIOpen immediate mode to avoid benchmarking during MIOpen solution selection.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77438
Approved by: https://github.com/ngimel, https://github.com/malfet
2022-05-23 17:10:24 +00:00
lamhoangtung
cac16e2ee2 Minor typo in contributing doc fixed (#70284)
Hi. While looking at the contributing doc for pytorch in master. I saw a typo about installing `ccache` via `conda`. This tiny PR fixed it.

Hope this could help someone copy-paste the command faster!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70284
Approved by: https://github.com/janeyx99
2022-05-23 15:43:25 +00:00
vitrioil
b2d1104471 Fixed numpy bool check (#77857)
Fixes #75704

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77857
Approved by: https://github.com/jbschlosser
2022-05-23 15:42:16 +00:00