Commit Graph

47549 Commits

Author SHA1 Message Date
df1ef27e6a [AutoAccept][Codemod][FBSourceBuckFormatLinter] Daily arc lint --take BUCKFORMAT (#79692)
Reviewed By: ivanmurashko

Differential Revision: D37203030

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79692
Approved by: https://github.com/mehtanirav
2022-06-16 17:01:17 +00:00
61a1eef7fc [Quant][fx] Add get_default_qconfig_mapping
Summary: This follows https://github.com/pytorch/pytorch/pull/78452,
which replaced the qconfig_dict with QConfigMapping. This PR
additionally replaces get_default_*qconfig_dict with
get_default_*qconfig_mapping. For backward compatibility, we
deprecate the old functions instead of removing them.

Test Plan:
python test/test_quantization.py TestQuantizeFx
python test/test_quantization.py TestQuantizeFxOps

Reviewers: jerryzh168, vkuzo

Subscribers: jerryzh168, vkuzo, supriyar

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

Approved by: https://github.com/jerryzh168
2022-06-16 16:10:14 +00:00
355a1c8c3f MPS: TopK raise an error if K>16 (#79677)
* Error out in TopK when k>16.
* Add a test case too.

Fixes #78915

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79677
Approved by: https://github.com/albanD
2022-06-16 16:06:45 +00:00
270c518be0 [checkpoint] Implement interop between Tensor and Sharded Tensor (#78120)
This allows loading a Tensor from a checkpoint with a SharedTensor in the same FQN.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78120
Approved by: https://github.com/pritamdamania87
2022-06-16 15:31:09 +00:00
c6c207f620 use ufunc_defs.bzl in BUILD.bazel
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77747

This allows us to remove some duplication in aten.bzl.

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

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

Approved by: https://github.com/seemethere
2022-06-16 07:56:35 +00:00
24c2aff1b2 Back out "[const_fold] Set requires_grad based on the folded tensor; add device_for_folding option" (#79655)
Reviewed By: yinghai, khabinov

Differential Revision: D37192230

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79655
Approved by: https://github.com/khabinov, https://github.com/yinghai
2022-06-16 06:51:53 +00:00
afc037ae38 [quant] Add quantized levels visualization
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79198

Approved by: https://github.com/HDCharles
2022-06-16 06:10:34 +00:00
0088172e38 [tensorboard] update assertion error for scalar() and fix docs (#76859)
Summary: title

Test Plan: unit test

Reviewed By: Reubend

Differential Revision: D35922397

Pull Request resolved: https://github.com/pytorch/pytorch/pull/76859
Approved by: https://github.com/Reubend, https://github.com/ananthsub
2022-06-16 05:24:20 +00:00
f1fb575b9e Remove -Wno-unused-but-set-variable for clang 13.0.0 (#79666)
Fixes #74805

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79666
Approved by: https://github.com/malfet
2022-06-16 04:26:39 +00:00
8ef6356f26 Reland PySymInt (#79617)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79617
Approved by: https://github.com/Chillee
2022-06-16 04:18:06 +00:00
c8fb02b452 Use amax instead of max for softmax decomps (#79667)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79667
Approved by: https://github.com/Chillee
2022-06-16 04:09:33 +00:00
ef1e5d0e1e [Profiler] Prepare for change to unique_ptr in Kineto
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79621

Move profiler to use compat bridge methods on libkineto::CpuTraceBuffer. Note that there is a specific order in which these changes must land:
First, the change adding the methods to Kineto must land.
Second, the change updating the pinned version of Kineto in PyTorch must land.
Third, this change must land AND BE COMMITTED TO FBCODE.
Fourth, the change to change kineto to use unique_ptr must land.
And finally, the pinned commit in pytorch/third_party must be updated again.

Only after all of these can the profiler start to rely on kineto using a unique_ptr under the hood.

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

Approved by: https://github.com/aaronenyeshi
2022-06-16 03:56:32 +00:00
c348980b6c [CI] Disable Buck Build Test (#79675)
Seeing some infra issues on trunk

https://hud.pytorch.org/minihud?name_filter=trunk%20/%20buck-build-test%20/%20buck-build-test
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79675
Approved by: https://github.com/kit1980
2022-06-16 03:45:39 +00:00
ac0d540db2 [ci] don't upload sccache artifacts with the wrong extension
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79663

Approved by: https://github.com/zengk95
2022-06-16 03:33:22 +00:00
4b817f5816 [ONNX] Improve docstrings and typing annotations (#78231)
- Remove wrappers in `__init__` around utils and instead expose those functions directly. Move the docstrings from `__init__` to corresponding functions in utils
- Annotate `torch.onnx.export` types
- Improve docstrings
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78231
Approved by: https://github.com/BowenBao
2022-06-16 02:59:24 +00:00
9681c75fc7 [FSDP] Extend ignored modules test to not pass to root
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79557

Approved by: https://github.com/zhaojuanmao, https://github.com/rohan-varma
2022-06-16 02:34:13 +00:00
e21c0ac9a5 use exe/exepath in our genrules
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79626

Buck does not properly handle caching when the executable is
identified with `$(location ...)`. See
https://fb.workplace.com/groups/askbuck/posts/8600146743367198 for
more information.

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

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

Approved by: https://github.com/malfet
2022-06-16 02:23:51 +00:00
86606fbe22 fix generate-code caching by indicating that the binary is an executable
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79625

Per Josiah Gaskin's followup on
https://www.internalfb.com/intern/qa/365579, using $(exe ...) instead
of $(location ...) should address the caching behavior.

@override-unit-failures
(Note: this ignores all push blocking failures!)

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

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

Approved by: https://github.com/malfet
2022-06-16 02:21:03 +00:00
18fcd4826f [FSDP] Fix exec order validation for diff ignored modules across ranks
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79533

Approved by: https://github.com/rohan-varma
2022-06-16 02:00:53 +00:00
3064982fb8 Support percentages in random_split (#78877)
Fixes #78510

This PR adds support for using fractions with `random_split`. This should be completely backwards-compatible as the fractional-style splitting is only applied when the sum across the input lengths is lower than 1.0
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78877
Approved by: https://github.com/ejguan
2022-06-16 02:00:25 +00:00
2f43784708 fix at::from_blob_quantized_per_tensor_affine strides calculation (#79314)
Summary: There seems to be a off-by-one bug in `at::from_blob_quantized_per_tensor_affine`. For an input with sizes {N, C, H, W}, before strides would be calculated as {NCH, CH, H, 1}, now strides is calculated as {CHW, HW, W, 1}. The updated unit test catches this problem.

Test Plan:
```
buck test mode/dev-nosan //caffe2:quantized_test
```

before fix:
```
    ✓ ListingSuccess: caffe2:quantized_test : 9 tests discovered (15.632)
    ✓ Pass: caffe2:quantized_test - TestQTensor.QuantDequantAPIs (0.004)
    ✗ Fail: caffe2:quantized_test - TestQTensor.FromBlobQuantizedPerTensor (0.002)
Test output:
> caffe2/aten/src/ATen/test/quantized_test.cpp:247
Expected equality of these values:
  qtensor[h][w].item<float>()
    Which is: -0.5
  (custom_data[i] - zero_point) * scale
    Which is: 0

stdout: Note: Google Test filter = TestQTensor.FromBlobQuantizedPerTensor
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestQTensor
[ RUN      ] TestQTensor.FromBlobQuantizedPerTensor
caffe2/aten/src/ATen/test/quantized_test.cpp:247: Failure
Expected equality of these values:
  qtensor[h][w].item<float>()
    Which is: -0.5
  (custom_data[i] - zero_point) * scale
    Which is: 0
[  FAILED  ] TestQTensor.FromBlobQuantizedPerTensor (2 ms)
[----------] 1 test from TestQTensor (2 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (2 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] TestQTensor.FromBlobQuantizedPerTensor

 1 FAILED TEST
```

after fix:
```
    ✓ ListingSuccess: caffe2:quantized_test : 9 tests discovered (16.051)
    ✓ Pass: caffe2:quantized_test - TestQTensor.RoundingMode (0.002)
    ✓ Pass: caffe2:quantized_test - TestQTensor.QuantizePerChannel4dChannelsLast (0.217)
    ✓ Pass: caffe2:quantized_test - TestQTensor.QuantDequantAPIs (0.003)
    ✓ Pass: caffe2:quantized_test - TestQTensor.EmptyPerchannelQuantized (0.003)
    ✓ Pass: caffe2:quantized_test - TestQTensor.EmptyQuantized (0.002)
    ✓ Pass: caffe2:quantized_test - TestQTensor.FromBlobQuantizedPerChannel (0.004)
    ✓ Pass: caffe2:quantized_test - TestQTensor.QuantizePerChannel4d (0.005)
    ✓ Pass: caffe2:quantized_test - TestQTensor.FromBlobQuantizedPerTensor (0.003)
    ✓ Pass: caffe2:quantized_test - TestQTensor.Item (0.002)
Summary
  Pass: 9
  ListingSuccess: 1
```

Differential Revision: D37061355

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79314
Approved by: https://github.com/jerryzh168
2022-06-16 01:31:50 +00:00
44e5593b17 Revert "automate hash pinning (#79470)"
This reverts commit 8f8a661ddc629b8ab99ab64aef56220064958ec7.

Reverted https://github.com/pytorch/pytorch/pull/79470 on behalf of https://github.com/zengk95 due to typo in workflow
2022-06-16 01:19:20 +00:00
61a5c779bf Make l1_loss composite
Fixing the forward AD for `sgn` in the next PR of this stack uncovered a
number of issues with the derivatives of `l1_loss`. Upon inspection,
`l1_loss` was just implemented as a composite function, but it was not
differentiable. This PR makes it a fully differentiable function.

As a side note, `l1_loss_out` was incorrect in a number of ways. Even
more, it is not exposed to the public as `F.l1_loss` does not accept an
`out=` parameter. As such it is not even tested. I wonder how useful is
to have `out=` variants for loss functions if we don't expose them at
all. Even more, I wonder how useful is to have `_out` variants  for loss
functions, given that their most normal use case is to return just a
real number cc jbschlosser

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

Approved by: https://github.com/jbschlosser
2022-06-16 00:03:22 +00:00
42fd58eaa0 [JIT] Change SchemaCheckTensor into SchemaCheckMode and fix global variable issues
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79473

Approved by: https://github.com/eellison
2022-06-15 23:55:50 +00:00
c8b9b6266b [ONNX] Fix arg type in _set_training_mode (#78583)
When `TrainingMode.PRESERVE` is set for export, the exporter used to change the model's training mode based on some logic. Now we respect the option and not touch the model's training state.

- Previously `_set_training_mode`'s behavior doesn't match what the global variable expects. This PR removes the deprecated `_set_training_mode` and makes the type correct.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78583
Approved by: https://github.com/BowenBao
2022-06-15 23:47:12 +00:00
81f277002e [quant] Add param calcs and tests for APoT observers
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78905

Approved by: https://github.com/dzdang
2022-06-15 23:24:48 +00:00
adf8060600 add a new alias key for functional to view op decompositions
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79615

Approved by: https://github.com/zou3519
2022-06-15 23:18:09 +00:00
6114b0f921 [quant][core][improvement][feature] Enabled support for quantized fill of nhwc tensors
Summary:
Previously, filling a quantized tensor only worked for nchw tensors.
This PR enables support for nhwc tensors. Test cases were added for per
tensor and per channel quantized NHWC tensors.

Test Plan:
```
python test/test_quantization.py -k test_qtensor_fill_per_channel_nhwc
python test/test_quantization.py -k test_qtensor_fill_per_tensor_nhwc
```

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

Approved by: https://github.com/jerryzh168
2022-06-15 22:44:50 +00:00
89bae0665c Update ideep for ideep conv changes -v2 (#79258)
The original PR https://github.com/pytorch/pytorch/pull/78238 has been covered. This is to reopen.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79258
Approved by: https://github.com/frank-wei
2022-06-15 22:31:20 +00:00
55e3d7a483 update tensor impl support_as_strided for nested tensors (#79616)
This is needed for supporting nested tensors with autograd. See this discussion: https://github.com/pytorch/pytorch/pull/79446#discussion_r896334299

I was deciding between 3 options:
1. The proposed change- update impl base
2. Override function without making the base class method virtual
3. Make support_as_strided() virtual on base and override on nested

The comment above in impl made me think that option 1 is okay but feel free to correct me
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79616
Approved by: https://github.com/albanD, https://github.com/soulitzer
2022-06-15 22:28:05 +00:00
0ac2289a05 Create decoder class (#79438)
Summary: Implement decoder-only layer, which doesn't currently exist in torch. Implement incremental and forced decoding with a new multiheadattention and decoder forward pass. Rather similar to the transformer_encoder_layer_fwd. Not a public facing API, although may become public facing eventually.

Stacked on top of https://github.com/pytorch/pytorch/pull/79437.

Test Plan: See D36140513 numerical tests.

Reviewed By: mikekgfb

Differential Revision: D36987004

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79438
Approved by: https://github.com/zrphercule
2022-06-15 22:26:06 +00:00
110c730676 Refactor out QKV in projection (#79437)
Summary: Refactor to reduce amount of copied code for decoder by finding common chunks for encoder and decoder. QKV in projection is a reasonable unit to copy out.

Test Plan:
buck run mode/opt -c fbcode.platform=platform010 -c fbcode.enable_gpu_sections=true -c fbcode.nvcc_arch=a100 //pytext/fb/tools:benchmark_transformers -- transformer --batch-size 64 --avg-sequence-length 235 --max-sequence-length 256 --iters 100  --module native

Benchmark and numerical tests work fine.

Reviewed By: mikekgfb

Differential Revision: D36138504

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79437
Approved by: https://github.com/jbschlosser
2022-06-15 22:21:17 +00:00
70446c25d7 [FSDP] Add forward prefetching option in FSDP API (#78841)
Fixes #78608

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78841
Approved by: https://github.com/zhaojuanmao
2022-06-15 20:59:08 +00:00
26e1afe9f2 Made improvements to isGreen (#79619)
Relates to #76700

**Overview**: Made regex a local variable in the `isGreen` method and improved debugging message for missing relevant workflows. If there are required workflows missing, the message will now print which workflows were not found.

**Test Plan**: Updated relevant test case in `test_print_latest_commits.py`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79619
Approved by: https://github.com/janeyx99
2022-06-15 20:44:28 +00:00
aee9762a51 [static runtime] Disable unit test for linalg_svdvals (#79574)
Summary: The test is throwing a jit alias analysis not supporting error. Disabling it for now.

Test Plan: buck run mode/opt caffe2/benchmarks/static_runtime:static_runtime_cpptest

Reviewed By: mikeiovine

Differential Revision: D37056032

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79574
Approved by: https://github.com/mikeiovine
2022-06-15 20:35:19 +00:00
8f8a661ddc automate hash pinning (#79470)
automate the pr approval and merging of hash pinning
also switch to a python script for easier control flow
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79470
Approved by: https://github.com/seemethere
2022-06-15 20:20:58 +00:00
b9f83cb737 use is_same_size in autograd init (#79553)
Broke: #79446 into a smaller commit that just adds is_same_size to the the autograd __init_file. This function is_same_size will be dispatched to the original behavior for regular tensors
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79553
Approved by: https://github.com/soulitzer
2022-06-15 19:49:42 +00:00
8d7fcfa8f1 [static runtime] Add native ops: aten::index_put, aten::item, aten::tensor_split (#79065)
Summary: This adds the pytorch operators that are currently missing in non-ads models from c2->pt mitigation: aten::index_put, aten::item, aten::tensor_split

Test Plan: buck run mode/opt caffe2/benchmarks/static_runtime:static_runtime_cpptest

Differential Revision: D36984961

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79065
Approved by: https://github.com/davidberard98
2022-06-15 19:15:34 +00:00
0bc1b9e039 [static runtime] Add logging info for unspported ops (#79064)
Summary: This adds logging info for unspported ops in static runitme.

Test Plan: static runtime unit tests

Differential Revision: D36984962

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79064
Approved by: https://github.com/davidberard98
2022-06-15 18:38:16 +00:00
eb5751d84b move gen_aten and gen_aten_hip into shared build structure
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77751

This requires two changes to rule generation:
 * pulling the cpu static dispatch prediction into the rules
 * disabling the Bazel-style generated file aliases

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

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

Approved by: https://github.com/kit1980, https://github.com/seemethere
2022-06-15 18:22:52 +00:00
b9bb52d97b Revert "Put symint overloads on a different name"
This reverts commit 213a8fc9927e2c90bd28a37f714950e4aa367ca6.

Reverted https://github.com/pytorch/pytorch/pull/79281 on behalf of https://github.com/bigfootjon due to Diff reverted internally
2022-06-15 17:15:21 +00:00
e20c6a89f8 [quant][core][improvement] Added warnings to quantized dynamic conv and linear ops when reduce_range=true
Summary:
Previously, the backend code "silently" ignores reduce_range=true when
using the qnnpack backend (which does not require a reduction in range).
We evaluated either 1) respecting the reduction in range to conform with
other backends (e.g., fbgemm) even when qnnpack does support the full
range and outputting a warning to let the user know that reduce_range
shoudl be set to false for qnnpack backend 2) throwing a warning and letting the user know that the
reduce_range=true setting is being ignored.

Option 1 would halve the range which could have some negative
implications to accuracy and lead to bc-breaking changes. Option 2 is also not ideal because it ignores any user settings
for reduce_range=true when using the qnnpack backend with dynamic and
linear quantized ops. We decided to go with option 2 as it is not
bc-breaking.

Fixes #68278

Test plan:

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

Approved by: https://github.com/jerryzh168, https://github.com/vkuzo
2022-06-15 17:14:57 +00:00
09df27fe45 Revert "Revert "[distributed] Handle object collectives and NCCL. (#79034)""
This reverts commit 279634f384662b7c3a9f8bf7ccc3a6afd2f05657.
2022-06-15 10:04:37 -07:00
d79f99c4b4 Revert "Revert "[ci] convert empty s3 artifacts from error to warning""
This reverts commit 5de9f42486a5876440d2ab57ef4d213a94b460ba.
2022-06-15 10:04:23 -07:00
a083199d2e Revert "Revert "[ci] remove remaining RDS dependency""
This reverts commit 21e32d5a0b3b8c4f93aae00761a6befd6ab47765.
2022-06-15 10:04:13 -07:00
f2f4cdc9e5 [bc test] pull nightly from before the base commit (#79570)
Fixes #79146

Test plan:
https://github.com/pytorch/pytorch/runs/6902235940?check_suite_focus=true passes and installs yesterday's nightly

new test also passes: https://github.com/pytorch/pytorch/runs/6903723789?check_suite_focus=true#step:9:640
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79570
Approved by: https://github.com/malfet, https://github.com/albanD
2022-06-15 16:56:57 +00:00
bc82a5f79c [ci] turn sccache stats error into warning
This unbreaks ci

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

Approved by: https://github.com/janeyx99
2022-06-15 16:30:13 +00:00
21e32d5a0b Revert "[ci] remove remaining RDS dependency"
This reverts commit 964d5059587c017b02f1d7d62587722a38683c63.

Reverted https://github.com/pytorch/pytorch/pull/79370 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2022-06-15 16:29:46 +00:00
5de9f42486 Revert "[ci] convert empty s3 artifacts from error to warning"
This reverts commit d42d5fe778f6e0dd0a2bd7e96fb00b2894353861.

Reverted https://github.com/pytorch/pytorch/pull/79397 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2022-06-15 16:26:35 +00:00
2579b3ed77 Revert "[ci] turn sccache stats error into warning"
This reverts commit c31398653c76f7a1a445dc40331c9231731bb61d.

Reverted https://github.com/pytorch/pytorch/pull/79443 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2022-06-15 16:23:39 +00:00