Commit graph

47460 commits

Author SHA1 Message Date
Antonio Kim
51b65cd765 Fix warning: cast from type const char* to type char* casts away qualifiers (#79520)
Do not cast `__FILE__` to `(char*)` in order to eliminate the prevalent `-Wcast-qual` warnings from showing up.

Fixes #79519

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79520
Approved by: https://github.com/malfet
2022-06-14 18:04:00 +00:00
Edward Z. Yang
95f9ca4931 Symbolic storage size
Signed-off-by: Edward Z. Yang <ezyangfb.com>

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

Approved by: https://github.com/albanD
2022-06-14 17:54:34 +00:00
Alban Desmaison
0a651a231d Add full support for serialization of MPS Tensors (#79465)
Fix https://github.com/pytorch/pytorch/issues/79384
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79465
Approved by: https://github.com/kulinseth, https://github.com/malfet
2022-06-14 17:54:30 +00:00
fduwjj
f4edbaa62f [PT-D] Use process group of the partial tensor so sub pg comm will be enabled during reshard
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79357

Approved by: https://github.com/wanchaol
2022-06-14 17:44:51 +00:00
PyTorch MergeBot
ce6ce74703 Revert "Add full support for serialization of MPS Tensors (#79465)"
This reverts commit 64c2a275c4.

Reverted https://github.com/pytorch/pytorch/pull/79465 on behalf of https://github.com/zengk95 due to this broke X linux-xenial-py3.7-clang7-onnx / test (default, 1, 2, linux.2xlarge). Not sure why since it passed on pull.
2022-06-14 16:42:36 +00:00
kshitij12345
31ada133cb [meta] nansum, nanmedian (and few minor clean-ups) (#79411)
meta support for `nansum` and `nanmedian`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79411
Approved by: https://github.com/anjali411
2022-06-14 16:21:13 +00:00
Michael Suo
6bce0f4ace [ci] remove PR_LABELS env var
This is unused, delete it

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

Approved by: https://github.com/janeyx99
2022-06-14 16:16:37 +00:00
Andrij David
48505356f5 Propagate map_location arg to torch.jit.load in torch.load (#78733)
Fixes #78331

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78733
Approved by: https://github.com/davidberard98
2022-06-14 16:04:45 +00:00
Svetlana Karslioglu
9d351b3ddd Update the governance page (#78850)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78850
Approved by: https://github.com/orionr, https://github.com/b0noI
2022-06-14 15:39:51 +00:00
Svetlana Karslioglu
5399fef644 Update persons of interest (#79076)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79076
Approved by: https://github.com/b0noI
2022-06-14 15:26:13 +00:00
Nikita Shulga
6cf085e8fc [MPS][BE]Do not use new/delete[] in chainViewOperation
`std::array` will do just fine

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

Approved by: https://github.com/albanD
2022-06-14 14:55:07 +00:00
Nikita Shulga
4dd3e3f409 [MPS] Fix getDefaultGenerator and copy_kernel_mps
Returning reference to stack memory is really bad

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

Approved by: https://github.com/albanD
2022-06-14 14:55:07 +00:00
Nikita Shulga
2f2fa9948d [MPS] Delete unused vars from OperationUtils.mm
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79514

Approved by: https://github.com/kulinseth, https://github.com/albanD
2022-06-14 14:55:04 +00:00
Alban Desmaison
64c2a275c4 Add full support for serialization of MPS Tensors (#79465)
Fix https://github.com/pytorch/pytorch/issues/79384
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79465
Approved by: https://github.com/kulinseth, https://github.com/malfet
2022-06-14 14:20:09 +00:00
PyTorch MergeBot
d7fc864f0d Revert "[primTorch] refs: lerp (#78473)"
This reverts commit a9f6a35a33.

Reverted https://github.com/pytorch/pytorch/pull/78473 on behalf of https://github.com/malfet due to Seems to broke Mac tests, see a9f6a35a33
2022-06-14 13:06:16 +00:00
titaiwang
44764f131b [ONNX] Move tests in test_onnx_export.py to test_pytorch_onnx_no_runtime.py (#78310)
Fixes #78308
This should be merged after
- #78116

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78310
Approved by: https://github.com/justinchuby, https://github.com/garymm
2022-06-14 06:08:29 +00:00
Michael Suo
d9fca126fc [ci] fix upload test stats job
don't upload test stats twice (!!)

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

Approved by: https://github.com/malfet
2022-06-14 05:19:07 +00:00
Kshiteej K
a9f6a35a33 [primTorch] refs: lerp (#78473)
As per title

TODO:
* [x] Add error inputs
* [x] Add reference inputs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78473
Approved by: https://github.com/ngimel, https://github.com/mruberry
2022-06-14 04:44:17 +00:00
Justin Chu
d3ef5c3fa3 [ONNX] Clean up __init__ in torch.onnx (#78446)
- Move definitions in `__init__` to internal classes and expose them by importing to init (prevent circular dependencies): https://github.com/pytorch/pytorch/wiki/torch.onnx-Namespacing
  - Context classes and enums are moved to `_exporter_states.py`
  - Exceptions are moved to `errors.py`
- Define `__all__` for torch.onnx. https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation
- Moved `utils.__IN_ONNX_EXPORT` to `GLOBALS.in_onnx_export`
- Deprecated `torch.onnx._export`

Precedes #78231

Using this as an aid for finding public functions:

```python
list(filter(lambda x: not x.startswith("_"), torch.onnx.utils.__dict__.keys()))
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78446
Approved by: https://github.com/BowenBao
2022-06-14 04:35:06 +00:00
Feng Yuan
ae8e5c702a hook XPU device in _get_available_device_type (#76167)
Signed-off-by: Feng Yuan <feng1.yuan@intel.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/76167
Approved by: https://github.com/ezyang
2022-06-14 04:34:21 +00:00
Nikita Shulga
8279567c46 Link LazyLinalg with cusolver statically when needed (#79324)
By copy-n-pasting the static linking logic from `libtorch_cuda` if
lazylinalg is not enabled

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79324
Approved by: https://github.com/atalman
2022-06-14 04:24:27 +00:00
John Clow
07a528cac7 Adding isDynamic Support to SizeNodes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77917

Approved by: https://github.com/Krovatkin
2022-06-14 03:27:57 +00:00
John Clow
498a34224b Adding helper function for getting DimensionNodes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77916

Approved by: https://github.com/Krovatkin
2022-06-14 03:27:57 +00:00
drisspg
28668b4850 Slicing Bug that was effecting Nested Tensor (#79445)
While working on nested tensor I was getting aborts thrown while running Pytest. For nested tensors `self_sizes` is initialized with an c10::nullopt. The operator * which gets the value from the optional is not instantiated so it throws via a c++ assert.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79445
Approved by: https://github.com/soulitzer
2022-06-14 03:22:52 +00:00
David Chen
f754d2501d Use custom AppendOnlyList for op_events to reduce the number of atomic operations (#78643)
Summary:
- Use atomic counter in Block storage constructor and offset within the block to calculate correlation_id.
- Implicitly deduce correlation id, no need to store it when profiling.

Test Plan:
Added test_profiler_correlation_id() in test_profiler.py to check the uniqueness of correlation id.

To run the test:
python test_profiler.py

Differential Revision: D36793803

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78643
Approved by: https://github.com/robieta
2022-06-14 03:17:09 +00:00
Kent Gauen
d9a6f76a9e Variable Name Clarity (#78478)
The current "output_height" and "output_width" names on lines 198 and 199 are not consistent with [lines 132 and 133 in Col2Im.h](3ee863cb7c/aten/src/ATen/native/cuda/Col2Im.cu (L126)). This was confusing to me, so this PR is a quick fix. This fix is also more consistent with [lines 122 and 132 from the same file](3ee863cb7c/aten/src/ATen/native/cuda/im2col.cuh (L108)).

Fixes no issue number.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78478
Approved by: https://github.com/ngimel
2022-06-14 03:07:53 +00:00
qqaatw
1a845579b6 [ONNX] Fix inconsistent rand dtype (#79193)
ONNX export of torch.rand produced different data type. This PR makes the type correct

Fixes #77845

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79193
Approved by: https://github.com/justinchuby, https://github.com/garymm
2022-06-14 03:06:39 +00:00
Sergii Dymchenko
4824222472 Migrate pull off linux-xenial-py3_7-clang7-asan (#79087)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79087
Approved by: https://github.com/seemethere, https://github.com/malfet
2022-06-14 02:38:21 +00:00
Rohan Varma
18305e30a7 [BE][FSDP] Enable multigpu unittests (#77947)
Enables FSDP testing on > 2 GPUs.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77947
Approved by: https://github.com/awgu
2022-06-14 02:36:14 +00:00
Sergii Dymchenko
1900b8acb2 Remove linux-xenial-py3_7-clang7-asan from merge rules (#79088)
This is to allow https://github.com/pytorch/pytorch/pull/79087 eventually merge cleanly.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79088
Approved by: https://github.com/janeyx99, https://github.com/malfet
2022-06-14 02:22:45 +00:00
Nikolay Korovaiko
d332724071 Python Bindings for SymInts (#78135)
This PR adds support for `SymInt`s in python. Namely,
* `THPVariable_size` now returns `sym_sizes()`
* python arg parser is modified to parse PyObjects into ints and `SymbolicIntNode`s
* pybind11 bindings for `SymbolicIntNode` are added, so size expressions can be traced
* a large number of tests added to demonstrate how to implement python symints.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78135
Approved by: https://github.com/ezyang
2022-06-14 02:17:59 +00:00
Jiewen Tan
e757cf40cc [c10d] Make broadcast as a custom op
Summary:
This patch makes broadcast 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_broadcast_ops
python test/distributed/test_c10d_gloo.py -k test_broadcast_basics
...and other existing distributed tests.

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

Approved by: https://github.com/pritamdamania87
2022-06-14 01:54:29 +00:00
Lin-Mao
f31f4a3ac2 Remove the construction of unused tensors (#79183)
Hi there, this statement, [`auto columns = at::empty({nInputPlane * kW * kH, outputHeight * outputWidth}, input.options());`](95b15c266b/aten/src/ATen/native/cuda/ConvolutionMM2d.cu (L154)), will construct a new tensor and allocate device memory for it. But I found this tensor will be only used([line185](95b15c266b/aten/src/ATen/native/cuda/ConvolutionMM2d.cu (L185)) and [line197](95b15c266b/aten/src/ATen/native/cuda/ConvolutionMM2d.cu (L197))) when [`requires_columns`](95b15c266b/aten/src/ATen/native/cuda/ConvolutionMM2d.cu (L156)) is true.

So we can declare an `at::Tensor columns;` variable(This will not allocate device memory for `columns`), and invoke `at::empty` to construct the tensor when `requires_columns` is true. As for the statement [`int64_t n = columns.size(1);`](95b15c266b/aten/src/ATen/native/cuda/ConvolutionMM2d.cu (L192)), the size can be calculated by the arguments of function `slow_conv2d_forward`.

I profiled the resnet50 in [`pytorch/benchmark`](https://github.com/pytorch/benchmark). I found there are lots of unused tensors in the device memory and they are gone after my optimization. It also works well on vgg16, yolov3, alexnet, etc.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79183
Approved by: https://github.com/ngimel
2022-06-14 01:28:20 +00:00
Taylor Robie
46fac97bff fix Python parent id
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79356

Approved by: https://github.com/davidchencsl
2022-06-14 01:24:38 +00:00
George Qi
05624bcf7b add sizes to slowpath
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79295

Approved by: https://github.com/ezyang
2022-06-14 01:19:59 +00:00
Rohan Varma
543919cfc8 Forward attributes to wrapped module
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78854

Approved by: https://github.com/albanD
2022-06-14 01:13:33 +00:00
Rohan Varma
44fe851feb [WIP] Fix non-reentrant hooks based checkpointing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78752

Approved by: https://github.com/albanD
2022-06-14 01:13:33 +00:00
Nikita Shulga
b8914aab1c Fix backward compat (#79484)
Add `segment_reduce_backward` and `_segment_reduce_backward` to list of ignored ops
After https://github.com/pytorch/pytorch/pull/78907 got reverted

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79484
Approved by: https://github.com/zengk95, https://github.com/osalpekar
2022-06-14 00:48:32 +00:00
anjali411
38e717dc87 Add docs for Python Registration
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78753

Approved by: https://github.com/ezyang, https://github.com/albanD
2022-06-13 23:21:23 +00:00
BowenBao
134459161d [ONNX] Improve shape inference supporting inferred values and unspecified optionals (#78999)
Extend to support the following in onnx shape inference:
* Utilizing inferred constant values. Provides more information than just shape and type of the input.
   E.g. Enables `onnx::Resize` when `scales` input are constructed by `onnx::Concat` of constants.
* `prim::Constant`, especially the one that represents `None`, which later represents unspecified optional input in ONNX.
   E.g. Enables `onnx::Resize` when the second optional input `roi` is not provided.

Fixes #69346
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78999
Approved by: https://github.com/justinchuby, https://github.com/garymm
2022-06-13 23:16:18 +00:00
PyTorch MergeBot
3b194fd532 Revert "Add offsets-based reduction to segment_reduce (CPU, CUDA)"
This reverts commit 1ec30a6647.

Reverted https://github.com/pytorch/pytorch/pull/78907 on behalf of https://github.com/osalpekar due to Caused Typecasting errors in PT Distributed and fx2trt builds internally
2022-06-13 22:37:25 +00:00
Tongliang Liao
88e2229a20 Use C++17 for RocksDB 7 header. (#75741)
Cannot simply enable this globally because gcc doesn't handle constexpr well when mixing 14/17 together:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101957

Resolve https://github.com/pytorch/pytorch/issues/75496
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75741
Approved by: https://github.com/malfet
2022-06-13 21:18:54 +00:00
Michael Andreas Dagitses
34b0285185 turn on -Werror=extra in Bazel
Summary:
These are mostly helpful warnings but we explicitly disable two of
them that are problematic in our codebase.

We also remove -Werror=type-limits and -Werror=unused-but-set-variable
since they are both included as part of -Wextra.

Test Plan: Rely on CI.

Reviewers: alband

Subscribers:

Tasks:

Tags:

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

Approved by: https://github.com/malfet
2022-06-13 21:07:31 +00:00
Michael Andreas Dagitses
3db1092da6 disable warnings for external repositories
Summary:
We don't own this code, don't spam our logs with their issues.

Test Plan: Verified actions manually with --subcommands.

Reviewers: seemethere

Subscribers:

Tasks:

Tags:

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

Approved by: https://github.com/malfet
2022-06-13 21:05:35 +00:00
Nikita Shulga
b370959da1 [MPS] Make it compilable with either xCode or CLI (#79430)
`xcrun --sdk macosx --show-sdk-version` works with either CommandLineTools or Xcode, but `xcodebuild -sdk macosx -version SDKVersion` works only if full Xcode is installed, which is not necessary to build PyTorch

Above command yield the same output when Xcode is installed:
```
% xcodebuild -sdk macosx -version SDKVersion
12.3
 %  xcrun --sdk macosx --show-sdk-version
12.3
```

But first one fails if Xcode is missing:
```
% xcodebuild -sdk macosx -version SDKVersion
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
% xcrun --sdk macosx --show-sdk-version
12.3

```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79430
Approved by: https://github.com/albanD
2022-06-13 21:03:48 +00:00
Mike Ruberry
1d47e0df5a Updates TF32 docs (#79401)
Updates TF32 docs to reflect PyTorch 1.12 updates.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79401
Approved by: https://github.com/ngimel
2022-06-13 21:02:00 +00:00
zengk95
bfb46ebb66 [mergebot] Add return on force (#79450)
See title
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79450
Approved by: https://github.com/clee2000, https://github.com/janeyx99
2022-06-13 20:36:12 +00:00
Michael Andreas Dagitses
70810a3691 turn on -Wall with a few exceptions in Bazel build
Summary:
We add the following exceptions:
 * sign-compare: this is heavily violated in our codebase
 * unknown-pragmas: we use this intentionally for some loop unrolling
   in CUDA

Because they are included in -Wall by default, we remove the following
warnings from our explicit list:
 * unused-function
 * unused-variable

Test Plan: Rely on CI.

Reviewers: alband, seemethere

Subscribers:

Tasks:

Tags:

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

Approved by: https://github.com/malfet
2022-06-13 20:29:14 +00:00
Michael Andreas Dagitses
52a5266aab turn on -Werror=unused-but-set-variable
Summary:
Also fix the one violation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

Approved by: https://github.com/malfet
2022-06-13 20:23:50 +00:00
Michael Suo
c77dc60143 [ci] set -e in get-workflow-job-id
So that errors get bubbled up and are retried properly

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

Approved by: https://github.com/janeyx99
2022-06-13 20:10:46 +00:00