Commit Graph

43927 Commits

Author SHA1 Message Date
Kim Juhyeong
ccaceda4a5 fix typo 2022-02-23 23:32:33 +09:00
Kim Juhyeong
3a37173665 optimize exp_family methods and reduce redundant computation 2022-02-23 23:11:04 +09:00
Kim Juhyeong
71f0a768cf remove redundant computation 2022-02-19 22:26:30 +09:00
Kim Juhyeong
9f28a193dc Revert using torch.floor
This reverts commit 4e718f8775.
2022-02-19 22:18:45 +09:00
Kim Juhyeong
1d2cd4c357 apply change in function name 2022-02-19 19:10:42 +09:00
Kim Juhyeong
5062350c2e merge private function to class method 2022-02-19 16:05:44 +09:00
Kim Juhyeong
f785226a0b change name of the util function 2022-02-19 16:00:40 +09:00
Kim Juhyeong
4e718f8775 use torch functions rather than built-in int function 2022-02-19 15:55:39 +09:00
Kim Juhyeong
2ea655fae9 revert modifications 2022-02-18 08:35:33 +09:00
Kim Juhyeong
4a8ba08799 Use correct constraints 2022-02-17 23:43:57 +09:00
Kim Juhyeong
5723979372 Specify detailed perturbation 2022-02-17 23:09:59 +09:00
Kim Juhyeong
966ccd9e5c Merge branch master into distributions/wishart_improvement_v1 2022-02-17 18:11:35 +09:00
Juhyeong (Odd) Kim
bd28b9af02
Merge branch 'pytorch:master' into distributions/wishart_improvement_v1 2022-02-17 16:51:04 +09:00
Chen Lai
cee84f4051 fix model dump for the lowered module (#72866)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72866

https://github.com/pytorch/pytorch/pull/71597 adds a wrapper `torch.jit.LoweredWrapper` and it breaks the model dump. Fix the model_dump in the notebook
ghstack-source-id: 149311636

Test Plan:
CI and test with N509022

Before:

{F701413403}

After:

{F701412963}

Reviewed By: iseeyuan

Differential Revision: D34247216

fbshipit-source-id: 695b02b03675fae596bb450441b327e4cdcffe9c
(cherry picked from commit d46a82a4c1)
2022-02-17 07:09:44 +00:00
Jordan Fix
540cb5fee2 [graph_manipulation] Unpack list of outputs (#72940)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72940

att

Reviewed By: jackm321

Differential Revision: D34282062

fbshipit-source-id: 743710c18e1f38286d1b91c91868bb22c760f3ca
(cherry picked from commit fd2bdd189d)
2022-02-17 06:38:52 +00:00
Don Jang
5ea74b4996 [Static Runtime] Remove ProcessedNode::num_outputs_ (#72592)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72592

Only code paths that are not perf-critical read `ProcessedNode::num_outputs_` and also its static feature of the op that `ProcessedNode` instance is executing.

Therefore, it's better to move `ProcessedNode::num_outputs_` into `ProcessedFunction::num_outputs_` and let `ProcessedNode` access it via `ProcessedNode::fn_` for its occasional use. Note that this prevents duplicating num_outputs_ per node & per Static Runtime instance since `ProcessedFunction` instances are shared across all runtime instances.

It's confirmed that this change reduces the `sizeof(ProcessedNode)` by 14% from local instrumentation as follows:

- Before
-- sizeof(ProcessedNode): 56

- After
-- sizeof(Processednode): 48

Test Plan: `buck test //caffe2/benchmarks/static_runtime:static_runtime_cpptest`

Reviewed By: mikeiovine

Differential Revision: D33984792

fbshipit-source-id: e29ffc97b799e679215f42e1e85cd3fcd7e88983
(cherry picked from commit 0f7003f4df)
2022-02-17 05:09:17 +00:00
Pearu Peterson
e785c0a1ab Enable Half/BFloat16 support for to_dense and coalesce methods. (#72397)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72397

Test Plan: Imported from OSS

Reviewed By: jbschlosser, zou3519

Differential Revision: D34286114

Pulled By: cpuhrsch

fbshipit-source-id: a4f7e2abc3b2d37437cbd09d693c1b409bb011b9
(cherry picked from commit 74f94447fc)
2022-02-17 02:54:23 +00:00
Pearu Peterson
456d96d544 Generate static docstrings for torch._masked functions. (#72865)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72865

Fixes #72636

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D34286183

Pulled By: cpuhrsch

fbshipit-source-id: 9cf81bfed6ba8c82593f6a1d9e0b20d0a083310d
(cherry picked from commit 0a3f57896b)
2022-02-17 02:44:16 +00:00
Juhyeong (Odd) Kim
846e208673
Merge branch 'pytorch:master' into distributions/wishart_improvement_v1 2022-02-17 11:43:29 +09:00
Philip Meier
1f74e082e2 only compare attributes for meta tensors (#72508)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72508

Todo:

- [x] document this behavior
- [x] add tests

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D34262452

Pulled By: ezyang

fbshipit-source-id: bc5c9653d5c3ad5c6efccc9c8e0efc0d28e15104
(cherry picked from commit 233142c88e)
2022-02-17 02:33:08 +00:00
Philip Meier
b5f2574f36 no longer coalesce sparse COO tensors before comparison (#69751)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69751

cc nikitaved pearu cpuhrsch IvanYashchuk

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D34262453

Pulled By: ezyang

fbshipit-source-id: e2e62d2aa03fc569d2951c880960b256f5dc4aaa
(cherry picked from commit cb6b0ef719)
2022-02-17 02:33:08 +00:00
Vitaly Fedyunin
81fbeea760 Add docstrings to native_channel_shuffle (#72919)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72919

Test Plan: Imported from OSS

Reviewed By: bdhirsh

Differential Revision: D34274717

Pulled By: VitalyFedyunin

fbshipit-source-id: fa42f91ef2335e2594b19ef65d914c711f7a94fd
(cherry picked from commit a6f6fe9112)
2022-02-17 02:33:08 +00:00
Juhyeong (Odd) Kim
1a2703c358
Merge branch 'pytorch:master' into distributions/wishart_improvement_v1 2022-02-17 11:30:10 +09:00
David Dang
e2c1533c7b [quant][core][gpu][eager] Improved quantized conv operator in cudnn (#72770)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72770

This PR improves upon PR70622 by removing the call to_make_per_tensor_quantized_tensor
and directly creating a quantized int8 tensor that is passed into raw_cudnn_convolution_forward as
opposed to a non-quantized int8 tensor.

Test Plan: Imported from OSS

Reviewed By: H-Huang

Differential Revision: D34243926

Pulled By: dzdang

fbshipit-source-id: 7725db27d0a276e8108086fecb7ecb18aa227102
(cherry picked from commit e20e99c7b9)
2022-02-17 02:28:12 +00:00
Edward Yang
2f222fc88c Mild refactor of native_functions.yaml dispatch parsing (#66109)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66109

This refactor is no longer necessary for ufunc codegen, as I changed
the format of ufuncs to not directly be inserted into the 'dispatch'
key, but I think the refactored code here is better.  The basic concept
is to directly construct BackendMetadata as we are parsing entries of
the dispatch dictionary, rather than post facto creating them later.
This centralizes the compute and means that the creation of the backend index
is just a simple reindexing by operator name (nothing nontrivial).

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

Test Plan: Imported from OSS

Reviewed By: bdhirsh

Differential Revision: D31385760

Pulled By: ezyang

fbshipit-source-id: 4fcb491ba025d2aa6fd356586b57affb97a507fc
(cherry picked from commit 21c93d4199)
2022-02-17 02:01:36 +00:00
Eli Uriegas
6a2624f7c4 ci: Add credentials to upload_test_statistics
Adds credentials to macOS workflows to upload_test_statistics when
needed

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

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72955
2022-02-16 23:47:01 +00:00
lkct
352eeb2ef9 doc fix nn.Module: docstring should come after class variable (#72912)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/72862

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

Reviewed By: cpuhrsch

Differential Revision: D34286017

Pulled By: jbschlosser

fbshipit-source-id: d172f7600e7f66c30187996ee42c72bf273643cc
(cherry picked from commit d9f9b5b418)
2022-02-16 23:10:38 +00:00
BowenBao
bbac8c9c48 [ONNX] List of files to consider for mergebot onnx rule (#72297)
Summary:
Based on past PRs, here is an non-exhaustive list of files to consider for extension. The PR is not meant to be final. Based on feedback and discussion, files could be dropped from the list, or PR could be updated to move code around such that extension is no longer needed.

List of files below and description:

* These files are for converting from IR to ONNX proto. These should be used only for ONNX.
```
"torch/csrc/jit/serialization/export.*",
"torch/csrc/jit/serialization/onnx.*",
```

* This file is touched whenever pass signature is updated.
```
"torch/_C/__init__.pyi.in",
```

* These files are touched whenever pass signature is updated. Somehow it's been convention that onnx passes are also added here, but it could be possible to move them. Let me know what you think.
~~"torch/csrc/jit/python/init.cpp",~~
~~"torch/csrc/jit/python/script_init.cpp",~~
Update: Bowen will move onnx passes to files under onnx folder.

* ~~Touched when need new attr::xxx, or onnx::xxx.~~
~~"aten/src/ATen/core/interned_strings.h"~~
Update: Nikita will help separate this file.

malfet

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

Reviewed By: H-Huang

Differential Revision: D34254666

Pulled By: malfet

fbshipit-source-id: 032cfa590cbedf4648b7335fe8f09a2380ab14cb
(cherry picked from commit 88653eadbf)
2022-02-16 23:01:13 +00:00
Gary Miguel
dbac0f5cdc Update persons of interest for ONNX (#72072)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72072

Reviewed By: H-Huang

Differential Revision: D34230534

Pulled By: malfet

fbshipit-source-id: ed5abdfacf0d9628c6cc99957fa578d71a79d025
(cherry picked from commit 4669c346c4)
2022-02-16 23:01:13 +00:00
Eli Uriegas
5cf2228405 ci: Add documentation for github actions (#72943)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72943

Adds some documentation about our github actions setup and examples on
how to add workflows / regenerate workflows

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

Test Plan: Imported from OSS

Reviewed By: kit1980

Differential Revision: D34283475

Pulled By: seemethere

fbshipit-source-id: a4ac9711c19aaf9312361f46db681d4457ab790c
(cherry picked from commit f352bba8e9)
2022-02-16 22:30:54 +00:00
ganler
3d8b6d3361 fix: onnx PReLU unidirectional broadcasting
Fixes https://github.com/pytorch/pytorch/issues/70570

Pull Request resolved: https://github.com/pytorch/pytorch/pull/70571
2022-02-16 22:28:08 +00:00
Nikita Shulga
e6fd28fb05 Revert D34126542: [Qunat] Add ConvTranspose reference module
Test Plan: revert-hammer

Differential Revision:
D34126542 (7a031ec17f)

Original commit changeset: 7da167695a1f

Original Phabricator Diff: D34126542 (7a031ec17f)

fbshipit-source-id: 14e40884807b9908017ae30af83a8dea23ff1f0f
(cherry picked from commit f99a7f5a69)
2022-02-16 22:24:15 +00:00
Sergii Dymchenko
486572223b Fix command example (#72847)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72847

Reviewed By: malfet

Differential Revision: D34260868

Pulled By: kit1980

fbshipit-source-id: 1b225f3c2c7a822e44df4bbd91766e6533eab6d7
(cherry picked from commit c9e874c4d8)
2022-02-16 21:45:45 +00:00
Nikita Shulga
0b117a3956 Revert D34245091: [pytorch][PR] Improve numerical stability of torch.distributions.wishart.Wishart
Test Plan: revert-hammer

Differential Revision:
D34245091 (5343cfe949)

Original commit changeset: 1cd653c1d5c6

Original Phabricator Diff: D34245091 (5343cfe949)

fbshipit-source-id: 90975456c5290b162da493ba0ef0a35920c73857
(cherry picked from commit 452fab8217)
2022-02-16 21:40:07 +00:00
Michael Suo
bb736fac33 fix workflow lint
Fixing issue due to land race
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72942
2022-02-16 21:10:36 +00:00
Michael Suo
3fcdff0615 Set pull_request checkout to head sha
**this is a re-submit of this PR, the previous version broke forked pull requests by checkout out the head ref as opposed to the head sha**

There are two commits that we test sometimes in CI:
1. The merge commit (a test merge between the PR head ref and the latest base ref)
2. The head ref (the exact commit that was at the head of the user's branch when they pushed).

This distinction is fairly subtle; in the case of 1, you are effectively running against a "rebased" version of your PR's branch. The problem is that we use *both* of these commits today, with confusing results—depending on how you put up your PR and what workflows are running, we might be testing two different commits!

We should probably consolidate on one. This would eliminate a subtle but complex part of our CI (I am mildly horrified by the complexity of [this explanation](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md#which-commit-is-used-in-ci), although it's heroic that someone went and documented it lol). This PR consolidates on using the head ref (option 2).
- This is the behavior of phabricator/fbcode, which many PT devs will be more familiar with.
- This is the behavior of ghstack
- Our master branch moves quite quickly, so the chance that there is a substantial divergence between your local test runs and CI is high, with confusing results that are nondeterministic based on when you put up the PR.
- We use a linear history/squash-rebase-merge workflow, which is better modeled by option 2. Option 1 effectively emulates a merge-commit-style workflow.

The primary disadvantage is that now when re-running workflows, you will not be re-running against a "rebased" version of the PR, but the exact head ref that was pushed. Tbh I find it quite unintuitive that what you're testing changes depending on when you press the re-run button, but I know at least @malfet does this so it's worth mentioning.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71974
2022-02-16 21:03:09 +00:00
Will Constable
889f3f48b2 Revert D34178476: Update lazy_ir.py from lazy_tensor_staging
Test Plan: revert-hammer

Differential Revision:
D34178476 (3842140fd5)

Original commit changeset: 7190b2e0d82b

Original Phabricator Diff: D34178476 (3842140fd5)

fbshipit-source-id: 4c969a355f01244c6f5acc52bc31679f2182aa55
(cherry picked from commit 17082075dd)
2022-02-16 19:34:41 +00:00
Guo Yejun
c19255840f codegen: do not generate code for dispatch_namespaced_definitions (#69074)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69074

Reviewed By: jbschlosser

Differential Revision: D32758621

Pulled By: bdhirsh

fbshipit-source-id: f8a174fd9d74039003f9713d8dfaae2b4eaa7089
(cherry picked from commit 462e92c82d)
2022-02-16 19:30:38 +00:00
Ivan Kobzarev
c32b74cecb [nnc][aot_compiler] Memory formats args to aot_compiler (#72873)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72873

Test Plan: Imported from OSS

Reviewed By: priyaramani

Differential Revision: D34250984

Pulled By: IvanKobzarev

fbshipit-source-id: e723ee64b024883eef78853e1b185b7040cafb09
(cherry picked from commit e9908df045)
2022-02-16 18:39:31 +00:00
Scott Wolchok
41ad221751 [PyTorch] MHA: fix contiguity assumption in transform_bias_rescale_qkv (#72465)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72465

This code path incorrectly assumed input tensors were contiguous. Now we check that.
ghstack-source-id: 149201476

Test Plan: CI

Reviewed By: ngimel

Differential Revision: D34007665

fbshipit-source-id: c43438f2495e32304ea3f7846e01eceb4a9448f7
(cherry picked from commit 0767b225f2)
2022-02-16 18:36:21 +00:00
Howard Huang
dadbf43eff Fix asserts in tests (#72864)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72864

Fixes #72860

Test Plan: Imported from OSS

Reviewed By: rohan-varma

Differential Revision: D34246987

Pulled By: H-Huang

fbshipit-source-id: 1ba47585533aff4cff9beec49bdc801f8320ffc8
(cherry picked from commit 03e45ceb89)
2022-02-16 18:35:16 +00:00
Will Constable
3842140fd5 Update lazy_ir.py from lazy_tensor_staging (#72730)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72730

This diff contains changes from several PRs landed to lazy_tensor_staging branch.
- generating 'fallback' overrides for each codegenned op, useful for debugging
- supports operators which are missing aten:: symbols for op names, instead using their string counterpart
- makes the IR class a base class instead of hardcoding the assumption of TS

Test Plan: tested on lazy_tensor_staging branch

Reviewed By: desertfire

Differential Revision: D34178476

fbshipit-source-id: 7190b2e0d82b4eb1f4510c858c24446c6df3f9d0
(cherry picked from commit 6713d3f0ef)
2022-02-16 18:33:31 +00:00
Scott Wolchok
ae8198121c [PyTorch] Handle non-vectorizable parameters for native MHA CUDA rescale kernel (#72671)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72671

The existing kernel did not handle cases where D % 4 != 0 or dim_per_head % 4 != 0. Now we have a non-vectorized kernel for these cases.
ghstack-source-id: 149201477

Test Plan: Updated test_nn to cover these cases.

Reviewed By: zrphercule, ngimel

Differential Revision: D34119371

fbshipit-source-id: 4e9b4d9b636224ef2c433593f6f236df040de782
(cherry picked from commit f5393878e4)
2022-02-16 18:33:31 +00:00
Scott Wolchok
ad623fdecf [PyTorch] MHA: add test for transform_bias_rescale_qkv (#72464)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72464

We had some trouble getting this component (and this test!) right, so let's test it.
ghstack-source-id: 149201478

Test Plan: new test passes

Reviewed By: zrphercule

Differential Revision: D33992477

fbshipit-source-id: cc377eed5d4a4412b42bdabf360601c6e52947cf
(cherry picked from commit 9832867b12)
2022-02-16 18:11:56 +00:00
Yeounoh Chung
443a337e14 Create a CI workflow for XLA tests using the XLA test image (#72496)
Summary:
This PR resolves https://github.com/pytorch/pytorch/issues/72693

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

Reviewed By: H-Huang

Differential Revision: D34255441

Pulled By: seemethere

fbshipit-source-id: fdfd54fbd59ef7266a78c9f729c1d5b6ed25e9d6
(cherry picked from commit ba14f0ee6c)
2022-02-16 18:03:43 +00:00
Junjie Wang (PyTorch)
b02c514764 [PT-D][Sharded Tensor] new init api for local tensor and sharding spec auto inference (#72733)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72733

To improve the perf cost due to communication in the process of init the sharded tensor. There are two changes in this PR/diff:

1. We create a new API named `_init_from_local_tensor` so that if we have only one local tensor, we can initiate a sharded tensor directly from it. (GH issue: https://github.com/pytorch/pytorch/issues/72092)
2. We create a new API to infer the sharding spec from global meta data, so we don't have to manually set the sharding spec when it's not `EnumerableShardingSpec`. (GH issue: https://github.com/pytorch/pytorch/issues/67244)
ghstack-source-id: 149229259

Test Plan: CI

Reviewed By: wanchaol

Differential Revision: D34132739

fbshipit-source-id: 3a60135761bcc19d6020b6c45cb2979869645ce6
(cherry picked from commit af569325e2)
2022-02-16 17:42:39 +00:00
Nikita Shulga
3493646f76 [CircleCI] Re-enable nightly android builds
A stop-gap measure to re-enable publishing of Android maven packages by
CI, see https://github.com/pytorch/pytorch/issues/72902

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72903
2022-02-16 17:38:17 +00:00
Nikita Shulga
c1032bf0d1 [.github] Fix typo in job name
Also add spaces, job name does not have to be a single world

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72917
2022-02-16 17:30:26 +00:00
Jacob Szwejbka
76df91215f [Pytorch Edge] Caffe2 Serialize files into indepedent target. Clean up function.cpp deps
Summary:
It seemed strange to me that min_runtime_lib was dependent on the serialization headers but didnt have a dependency on their .cc. This puts them into their own target that contains both and then updates deps.

(Note: this ignores all push blocking failures!)

Test Plan: ci

Reviewed By: iseeyuan

Differential Revision: D34159900

fbshipit-source-id: 57102414be2439f5f4e3ed8ccd2b0c375b9de9b2
(cherry picked from commit c9ff2d2d9d)
2022-02-16 17:22:24 +00:00
Pavithran Ramachandran
d79aec91f7 [easy][PTE] Reduce unnecessary ref count bumps in callstack debug (#72547)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72547

toTuple() returns a  new intrusive pointer that bumps its underlying ref count. Whereas, toTupeRef returns a reference. We can save an unnecessary ref count bump.

Based on https://fb.workplace.com/groups/pytorch.edge.team/permalink/1021780808376658/

similar to D34047666 (85d7e73a8a)
ghstack-source-id: 148665193

Test Plan:
```
> Executing task: buck: buck test //xplat/caffe2:test_lite_interpreter  --config client.id=nuclide <

Executing in directory: /data/users/pavithran/fbsource
buck test //xplat/caffe2:test_lite_interpreter  --config client.id=nuclide

clang-9: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

Parsing buck files: finished in 2.1 sec
Creating action graph: finished in 0.5 sec
[RE] Metadata: Session ID=[reSessionID-66858379-0761-4966-a933-bc7f0d0add95]
[RE] Waiting on 0 remote actions. Completed 523 actions remotely, action cache hit rate: 0.00%.
Downloaded 3947/5089 artifacts, 20.92 Mbytes, 12.5% cache miss (for updated rules)
Building: finished in 01:04.0 min (100%) 5438/5438 jobs, 5192/5438 updated
  Total time: 01:06.6 min
Testing: finished in 06:53.7 min (71 PASS/0 FAIL)
BUILD SUCCEEDED
RESULTS FOR //xplat/caffe2:test_lite_interpreter
PASS    406.0s 71 Passed   0 Skipped   0 Failed   //xplat/caffe2:test_lite_interpreter
TESTS PASSED

Terminal will be reused by tasks, press any key to close it.
```

Reviewed By: kimishpatel

Differential Revision: D34082609

fbshipit-source-id: 4bcbdb2d11dd4c3bc392010487dccd2270278222
(cherry picked from commit dd64eb386d)
2022-02-16 16:58:43 +00:00