Joel Schlosser
f954498edf
Dynamo: Fix to unpack ConstantVariable in call_range() ( #94202 )
...
Fixes the `pyhpc_turbulent_kinetic_energy` model in torchbench.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94202
Approved by: https://github.com/ezyang , https://github.com/voznesenskym
2023-02-07 15:12:00 +00:00
Jason Ansel
180adf8c18
Fix bug in generic_list_compare ( #94156 )
...
https://github.com/pytorch/pytorch/pull/94054 introduced a bug in list
comparisons other than `==`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94156
Approved by: https://github.com/voznesenskym
2023-02-06 19:50:04 +00:00
PyTorch MergeBot
0444b8f560
Revert "Support neg calls to dyn shapes ( #94068 )"
...
This reverts commit 9350bcf6ae .
Reverted https://github.com/pytorch/pytorch/pull/94068 on behalf of https://github.com/malfet due to This broke hugging_face shard, see https://hud.pytorch.org/hud/pytorch/pytorch/master/1?per_page=50&name_filter=inductor_huggin
2023-02-06 17:50:10 +00:00
Michael Voznesensky
9350bcf6ae
Support neg calls to dyn shapes ( #94068 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94068
Approved by: https://github.com/jansel
2023-02-05 21:38:16 +00:00
Michael Voznesensky
25c0737adc
dont graph break on list[SymInt] comparisons ( #94054 )
...
Reland of https://github.com/pytorch/pytorch/pull/92617
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94054
Approved by: https://github.com/jansel
2023-02-05 04:47:12 +00:00
Joel Schlosser
dc7bf1a7ea
General reversible binary op support (e.g. __add__ / __radd__) in dynamo ( #93271 )
...
Generic support for reversible binary op pairs (e.g. `__add__` / `__radd__`) in dynamo.
Adds logic to flip args and try the reverse op when the forward op is unsupported.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/93271
Approved by: https://github.com/voznesenskym , https://github.com/jansel , https://github.com/ezyang
2023-02-03 19:28:35 +00:00
Yanbo Liang
a6b51448f5
[Dynamo] Supports if condition on user defined object ( #90892 )
...
Fixes Meta internal user case, see the pattern in unit test.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90892
Approved by: https://github.com/jansel , https://github.com/mlazos
2023-01-26 04:19:32 +00:00
Will Constable
8e2e648f84
Propagate sources in VariableBuilder and add SuperSource ( #91729 )
...
**Motivation**
When adding support for default args (#90575 ), a lot of VariableTrackers missing sources were encountered. Currently, in a lot of cases it seems OK to skip the source for VariableTrackers created (especially during inlining), but that assumption breaks down when inlining functions with default arguments.
**Summary** of changes
- propagate the self.source of the VariableBuilder to the new variables being built, which seems like it was an omission previously
- Add SuperSource to track usages of super(), so that SuperVariables can support function calls with default args
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91729
Approved by: https://github.com/ezyang
2023-01-12 05:04:18 +00:00
Andrew M. James
7cd951c21e
Properly guard all numpy usage within dynamo and remove UnspecializedNumpyVariable ( #90795 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90795
Approved by: https://github.com/ngimel , https://github.com/cpuhrsch
2023-01-06 22:36:38 +00:00
Joel Schlosser
8b55b86dbd
Move sym_int and sym_float alongside SymInt / SymFloat in base torch package ( #91317 )
...
This PR moves the definitions for:
* `sym_int`
* `sym_ceil` (used only for `sym_int`)
* `sym_floor` (used only for `sym_int`)
* `sym_float`
from `torch/fx/experimental/symbolic_shapes.py` to `torch/__init__.py`, where `SymInt` and `SymFloat` are already defined.
This removes the need for several in-line imports, and enables proper JIT script gating for #91318 . I'm very open to doing this in a better way!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91317
Approved by: https://github.com/ezyang , https://github.com/anijain2305
2022-12-28 16:08:16 +00:00
Tugsbayasgalan (Tugsuu) Manlaibaatar
c8f5c194ca
Fix bug in dynamic shapes multiply ( #90336 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90336
Approved by: https://github.com/ezyang
2022-12-09 00:59:50 +00:00
William Wen
ebeecbf833
Dynamo FX graph stack traceback fix ( #87136 )
...
Migration from https://github.com/pytorch/torchdynamo/pull/1655 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87136
Approved by: https://github.com/voznesenskym
2022-12-06 02:22:16 +00:00
Yanbo Liang
37e46a5035
[Dynamo] Fix several bugs & code refactor in RangeVariable ( #89322 )
...
Fix bug in [7k github models](https://github.com/pytorch/torchdynamo/issues/1884 ): https://github.com/jansel/pytorch-jit-paritybench/blob/master/generated/test_clovaai_stargan_v2.py
```
E TypeError: 'list' object cannot be interpreted as an integer
E
E from user code:
E File "/scratch/ybliang/work/repos/pytorch-jit-paritybench/generated/test_clovaai_stargan_v2.py", line 335, in forward
E idx = torch.LongTensor(range(y.size(0)))
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89322
Approved by: https://github.com/jansel
2022-11-23 19:44:48 +00:00
Michael Voznesensky
06ce1338bc
[dynamo] Port all pytorch/dynamo and test/dynamo pieces over from symbolic-shapes branch ( #88768 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88768
Approved by: https://github.com/jansel , https://github.com/ezyang
2022-11-13 04:50:21 +00:00
Yanbo Liang
b1116a5117
[Dynamo] Improve BuiltinVariable log when incorrect arg count happens ( #88409 )
...
Fixes https://github.com/pytorch/torchdynamo/issues/1832
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88409
Approved by: https://github.com/mlazos
2022-11-05 00:17:18 +00:00
Michael Voznesensky
bc19494814
[Dynamo] Symbolic shape guards ( #87570 )
...
**Introduces symbolic shape guards into dynamo.**
In this PR, we take the existing fake tensor infra and plumbing in dynamo and we start passing a shape_env around. This shape_env does not get plumbed down to middle layers / backend yet - it only collects expressions from frontend invocations at the moment. We then translate these expressions into guards at the point where we take other guards installed throughout dynamo - and add them to check_fn.
Part 1 of https://docs.google.com/document/d/1QJ-M4zfMkD-fjHIqW089RptjLl9EgozZGCceUbvmgfY/edit#
cc @jansel @lezcano @fdrocha @mlazos @soumith @yanboliang @penguinwu @anijain2305
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87570
Approved by: https://github.com/ezyang
2022-10-25 21:15:40 +00:00
Michael Voznesensky
2fd008ed43
[dynamo] Add support for invoking nn sequential ( #87156 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87156
Approved by: https://github.com/jansel
2022-10-20 18:14:40 +00:00
PyTorch MergeBot
f3cc588d09
Revert "Dynamo FX graph stack traceback fix ( #87136 )"
...
This reverts commit 89e6078bc3 .
Reverted https://github.com/pytorch/pytorch/pull/87136 on behalf of https://github.com/clee2000 due to causing a lot of tests to fail on master even though pr is green
2022-10-19 18:57:24 +00:00
William Wen
89e6078bc3
Dynamo FX graph stack traceback fix ( #87136 )
...
Migration from https://github.com/pytorch/torchdynamo/pull/1655 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87136
Approved by: https://github.com/voznesenskym
2022-10-19 17:15:43 +00:00
Jason Ansel
c7c09722ad
Move TorchDynamo into PyTorch core ( #86461 )
...
Context:
https://github.com/pytorch/torchdynamo/issues/1588
This PR moves [TorchDynamo](https://github.com/pytorch/torchdynamo ) and TorchInductor into PyTorch core.
- `torchdynamo` becomes `torch._dynamo`
- `torchinductor` becomes `torch._inductor`
This PR was generated by running `copy_to_core.sh` in https://github.com/pytorch/torchdynamo/pull/1538
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86461
Approved by: https://github.com/voznesenskym
2022-10-13 23:18:06 +00:00