Xuehai Pan
eaa449fbf0
[dynamo] simplify implementation for builtins.sum ( #133779 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133779
Approved by: https://github.com/jansel , https://github.com/anijain2305
ghstack dependencies: #133769 , #133778
2024-08-29 20:56:16 +00:00
Xuehai Pan
b5f1ffa7ab
[dynamo] simplify implementation for functools.reduce ( #133778 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133778
Approved by: https://github.com/jansel , https://github.com/anijain2305
ghstack dependencies: #133769
2024-08-29 20:56:16 +00:00
Xuehai Pan
e09324e7da
[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133769
Approved by: https://github.com/jansel
2024-08-29 20:56:16 +00:00
PyTorch MergeBot
4811dc3de9
Revert "[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )"
...
This reverts commit cc3a76edba .
Reverted https://github.com/pytorch/pytorch/pull/133769 on behalf of https://github.com/ZainRizvi due to Sorry but this has been discovered to be causing a performance regression internally ([comment](https://github.com/pytorch/pytorch/pull/133769#issuecomment-2316620213 ))
2024-08-29 03:00:47 +00:00
PyTorch MergeBot
50e90d7203
Revert "[dynamo] simplify implementation for functools.reduce ( #133778 )"
...
This reverts commit 6c0b15e382 .
Reverted https://github.com/pytorch/pytorch/pull/133778 on behalf of https://github.com/ZainRizvi due to Sorry, but this breaks internal tests because of using functools ([comment](https://github.com/pytorch/pytorch/pull/133778#issuecomment-2310445169 ))
2024-08-26 15:16:17 +00:00
PyTorch MergeBot
472c7cf962
Revert "[dynamo] simplify implementation for builtins.sum ( #133779 )"
...
This reverts commit 8d90392fb0 .
Reverted https://github.com/pytorch/pytorch/pull/133779 on behalf of https://github.com/ZainRizvi due to Sorry, but this breaks internal tests because of using functools ([comment](https://github.com/pytorch/pytorch/pull/133778#issuecomment-2310445169 ))
2024-08-26 15:16:17 +00:00
Xuehai Pan
8d90392fb0
[dynamo] simplify implementation for builtins.sum ( #133779 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133779
Approved by: https://github.com/jansel
ghstack dependencies: #133769 , #133778
2024-08-23 10:10:19 +00:00
Xuehai Pan
6c0b15e382
[dynamo] simplify implementation for functools.reduce ( #133778 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133778
Approved by: https://github.com/jansel
ghstack dependencies: #133769
2024-08-23 09:10:44 +00:00
Xuehai Pan
cc3a76edba
[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133769
Approved by: https://github.com/jansel
2024-08-23 09:05:24 +00:00
Xuehai Pan
b6abac68ec
[BE][dynamo] reorganize polyfill module hierarchy ( #133977 )
...
Changes:
1. Move `polyfill.py` -> `polyfills/__init__.py`. It can be used as `polyfill.xxx` -> `polyfills.xxx`.
2. Move submodule loading from `polyfills/__init__.py` to `polyfills/loader.py`.
Merge `polyfill.py` and `polyfills/` packages. Each polyfill module have its own namespace for better code organization.
The ultimate goal is make `polyfills/__init__.py` empty and all polyfill functions move to its own namespace.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133977
Approved by: https://github.com/jansel
2024-08-22 16:42:29 +00:00
PyTorch MergeBot
88ead0afc6
Revert "[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )"
...
This reverts commit 178e8563b8 .
Reverted https://github.com/pytorch/pytorch/pull/133769 on behalf of https://github.com/ZainRizvi due to breaking main windows cpu tests - this stack still causes that windows test to fail ([comment](https://github.com/pytorch/pytorch/pull/133712#issuecomment-2299776241 ))
2024-08-20 21:14:45 +00:00
PyTorch MergeBot
3fa874abbe
Revert "[dynamo] simplify implementation for functools.reduce ( #133778 )"
...
This reverts commit 37b4bc60a4 .
Reverted https://github.com/pytorch/pytorch/pull/133778 on behalf of https://github.com/ZainRizvi due to breaking main windows cpu tests - this stack still causes that windows test to fail ([comment](https://github.com/pytorch/pytorch/pull/133712#issuecomment-2299776241 ))
2024-08-20 21:14:45 +00:00
PyTorch MergeBot
98e6a1d8ff
Revert "[dynamo] simplify implementation for builtins.sum ( #133779 )"
...
This reverts commit 3f58a8051a .
Reverted https://github.com/pytorch/pytorch/pull/133779 on behalf of https://github.com/ZainRizvi due to breaking main windows cpu tests - this stack still causes that windows test to fail ([comment](https://github.com/pytorch/pytorch/pull/133712#issuecomment-2299776241 ))
2024-08-20 21:14:44 +00:00
Xuehai Pan
b03381cac2
[dynamo] support cls.__flags__ ( #133970 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133970
Approved by: https://github.com/jansel
ghstack dependencies: #133969
2024-08-20 20:03:31 +00:00
Xuehai Pan
5229b52bf2
[dynamo] support cls.__base__ ( #133969 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133969
Approved by: https://github.com/jansel
2024-08-20 20:03:31 +00:00
Xuehai Pan
3f58a8051a
[dynamo] simplify implementation for builtins.sum ( #133779 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133779
Approved by: https://github.com/jansel
ghstack dependencies: #133712 , #133769 , #133778
2024-08-20 19:48:57 +00:00
Xuehai Pan
37b4bc60a4
[dynamo] simplify implementation for functools.reduce ( #133778 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133778
Approved by: https://github.com/jansel
ghstack dependencies: #133712 , #133769
2024-08-20 19:48:57 +00:00
Xuehai Pan
178e8563b8
[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133769
Approved by: https://github.com/jansel
ghstack dependencies: #133712
2024-08-20 19:48:57 +00:00
PyTorch MergeBot
91fd270535
Revert "[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )"
...
This reverts commit 59ca56e56c .
Reverted https://github.com/pytorch/pytorch/pull/133769 on behalf of https://github.com/jeanschmidt due to breaking main windows cpu tests - reverting them all, so we can identify the culprit with more calmness ([comment](https://github.com/pytorch/pytorch/pull/133712#issuecomment-2298528797 ))
2024-08-20 10:34:41 +00:00
PyTorch MergeBot
5109c5ef23
Revert "[dynamo] simplify implementation for functools.reduce ( #133778 )"
...
This reverts commit ff9be0eda9 .
Reverted https://github.com/pytorch/pytorch/pull/133778 on behalf of https://github.com/jeanschmidt due to breaking main windows cpu tests - reverting them all, so we can identify the culprit with more calmness ([comment](https://github.com/pytorch/pytorch/pull/133712#issuecomment-2298528797 ))
2024-08-20 10:34:41 +00:00
PyTorch MergeBot
08b5e07e6c
Revert "[dynamo] simplify implementation for builtins.sum ( #133779 )"
...
This reverts commit 1fdeb4e329 .
Reverted https://github.com/pytorch/pytorch/pull/133779 on behalf of https://github.com/jeanschmidt due to breaking main windows cpu tests ([comment](https://github.com/pytorch/pytorch/pull/133779#issuecomment-2298285206 ))
2024-08-20 08:33:29 +00:00
Xuehai Pan
1fdeb4e329
[dynamo] simplify implementation for builtins.sum ( #133779 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133779
Approved by: https://github.com/jansel
ghstack dependencies: #133712 , #133769 , #133778
2024-08-19 22:14:34 +00:00
Xuehai Pan
ff9be0eda9
[dynamo] simplify implementation for functools.reduce ( #133778 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133778
Approved by: https://github.com/jansel
ghstack dependencies: #133712 , #133769
2024-08-19 22:14:33 +00:00
Xuehai Pan
59ca56e56c
[dynamo] simplify polyfill registration for builtins.all and builtins.any ( #133769 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133769
Approved by: https://github.com/jansel
ghstack dependencies: #133712
2024-08-19 22:14:33 +00:00
Animesh Jain
08f14d5492
[refactor][dynamo][side-effects] Helper function for __new__ for user defined class ( #133799 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133799
Approved by: https://github.com/jansel
ghstack dependencies: #133745 , #133747 , #133746
2024-08-19 17:21:48 +00:00
Animesh Jain
fed6096e73
[dynamo] Support object.__new__ call ( #133746 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133746
Approved by: https://github.com/Skylion007 , https://github.com/jansel
ghstack dependencies: #133745 , #133747
2024-08-18 07:18:52 +00:00
Animesh Jain
4dc9795ebf
[refactor][easy] Directly call var_getattr method for PythonModuleVariable ( #133745 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133745
Approved by: https://github.com/yanboliang
2024-08-17 05:30:01 +00:00
Isuru Fernando
e554f71d7e
Implement filter in dynamo ( #131674 )
...
Fixes https://github.com/pytorch/pytorch/issues/128944
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131674
Approved by: https://github.com/amjames , https://github.com/jansel
2024-08-14 14:54:13 +00:00
Edward Z. Yang
80ed3e9ccd
s/dipatch/dispatch/g ( #133192 )
...
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133192
Approved by: https://github.com/albanD
2024-08-12 20:26:58 +00:00
William Wen
01cdcbf7c8
[dynamo] revert map/zip iterator related changes ( #132528 )
...
Need to revert due to internal hangs: S437700
This reverts commit b6c1490cc0 .
Revert "[dynamo] implement IteratorVariable and polyfill fallbacks for enumerate (#131725 )"
This reverts commit 2576dbbc35 .
Revert "[dynamo] add itertools repeat/count bytecode reconstruction (#131716 )"
This reverts commit 35b4de32fa .
Revert "[dynamo] add lazy IteratorVariable implementations for map and zip (#131413 )"
This reverts commit 7d282d8755 .
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132528
Approved by: https://github.com/ZainRizvi
2024-08-04 18:46:55 +00:00
Oguz Ulgen
6e79932543
Add basic mypy annotations to dynamo ( #132415 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132415
Approved by: https://github.com/XuehaiPan , https://github.com/jamesjwu
2024-08-04 18:43:36 +00:00
PyTorch MergeBot
3558a8cf4a
Revert "Add basic mypy annotations to dynamo ( #132415 )"
...
This reverts commit 71e22e0959 .
Reverted https://github.com/pytorch/pytorch/pull/132415 on behalf of https://github.com/ZainRizvi due to Sorry, this PR has entered a weird state in the diff train. Trying to revert it to skip it, and then we can try relanding it ([comment](https://github.com/pytorch/pytorch/pull/132415#issuecomment-2267631785 ))
2024-08-04 18:39:29 +00:00
PyTorch MergeBot
0a25666f92
Revert "[dynamo] revert map/zip iterator related changes ( #132528 )"
...
This reverts commit e81e74ca6c .
Reverted https://github.com/pytorch/pytorch/pull/132528 on behalf of https://github.com/ZainRizvi due to This stack entered a weird state in the diff train. Reverting and relanding to clean the state ([comment](https://github.com/pytorch/pytorch/pull/132528#issuecomment-2267628475 ))
2024-08-04 18:26:09 +00:00
Animesh Jain
06581c277a
[dynamo][stable-diffusion] Support dict(obj) on constrained subclasses of dict and OrderedDict ( #132558 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132558
Approved by: https://github.com/jansel
2024-08-03 06:31:00 +00:00
William Wen
e81e74ca6c
[dynamo] revert map/zip iterator related changes ( #132528 )
...
Need to revert due to internal hangs: S437700
This reverts commit b6c1490cc0 .
Revert "[dynamo] implement IteratorVariable and polyfill fallbacks for enumerate (#131725 )"
This reverts commit 2576dbbc35 .
Revert "[dynamo] add itertools repeat/count bytecode reconstruction (#131716 )"
This reverts commit 35b4de32fa .
Revert "[dynamo] add lazy IteratorVariable implementations for map and zip (#131413 )"
This reverts commit 7d282d8755 .
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132528
Approved by: https://github.com/ZainRizvi
2024-08-02 19:40:57 +00:00
Animesh Jain
56f2917bef
[dynamo] Bugfix for recently added str handler ( #132461 )
...
There is probably more work to improve support. But this is hot fix to not fail on `.__func__`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132461
Approved by: https://github.com/williamwen42
ghstack dependencies: #132425
2024-08-02 13:16:39 +00:00
Yanbo Liang
5ea0f51187
[Dynamo] Support abc.MutableMapping.get ( #132363 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132363
Approved by: https://github.com/anijain2305 , https://github.com/mlazos
2024-08-02 04:17:35 +00:00
Chen Haifeng
50ed6ce277
Support built-in id function for TensorVariable on parameters ( #130100 )
...
Fixes #130087
This patch tries to provide a built-in id function implementation for TensorVariable when the id function is called on tensors like module parameters. The id function call on intermediate tensors is not supported.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/130100
Approved by: https://github.com/anijain2305
2024-08-02 01:19:25 +00:00
Oguz Ulgen
71e22e0959
Add basic mypy annotations to dynamo ( #132415 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132415
Approved by: https://github.com/XuehaiPan , https://github.com/jamesjwu
2024-08-01 20:14:25 +00:00
Xuehai Pan
e74ba1b34a
[BE][Easy][15/19] enforce style for empty lines in import segments in torch/_d*/ ( #129767 )
...
See https://github.com/pytorch/pytorch/pull/129751#issue-2380881501 . Most changes are auto-generated by linter.
You can review these PRs via:
```bash
git diff --ignore-all-space --ignore-blank-lines HEAD~1
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129767
Approved by: https://github.com/anijain2305
2024-07-31 21:18:11 +00:00
datagero
bdd7a0322d
[Dynamo] Fix - str handler for UserDefinedObjectVariable ( #130506 )
...
Fixes #130301
Adjusted the call_str method to handle str conversion for UserDefinedObjectVariable.
Attempt in a clean branch for unrelated test errors.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/130506
Approved by: https://github.com/oulgen , https://github.com/anijain2305
2024-07-31 16:39:59 +00:00
Animesh Jain
03e058189e
[dynamo] Support dict unpack of MutableMapping objects ( #131961 )
...
Fixes https://github.com/pytorch/pytorch/issues/128067
The basic functionality was alredy introduced earlier. This just ensures
that we support UserDefinedObjectVariable.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131961
Approved by: https://github.com/williamwen42 , https://github.com/mlazos , https://github.com/yanboliang
ghstack dependencies: #131827 , #131956
2024-07-30 05:49:58 +00:00
William Wen
2576dbbc35
[dynamo] implement IteratorVariable and polyfill fallbacks for enumerate ( #131725 )
...
Fixes https://github.com/pytorch/pytorch/issues/112794 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131725
Approved by: https://github.com/anijain2305
ghstack dependencies: #131413 , #131716
2024-07-26 17:17:09 +00:00
William Wen
7d282d8755
[dynamo] add lazy IteratorVariable implementations for map and zip ( #131413 )
...
Fixes https://github.com/pytorch/pytorch/issues/130750 .
Repro of lazy/eager `map` discrepancy without `islice`:
```python
def fn(a, b):
y = 1
def f(x):
nonlocal y
y += 1
return x
l = list(zip([a, b], map(f, [1, 2, 3, 4])))
return a + y
```
The major change is that we implement `MapVariable` and `ZipVariable` based on `IteratorVariable`. Before, `map` and `zip` were being traced by immediately unpacking the result as a `TupleVariable`, which is wrong in cases such as the example above.
`MapVariable`s are not allowed to be unpacked while `ZipVariable`s can only be unpacked if all of its iterables can also be unpacked.
We also add new `[has_]force_unpack_var_sequence` methods to `VariableTracker` for the case where it is safe to unpack the entire sequence lazily, e.g., when building a list from a map (i.e. `list(map(f, ...))`).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131413
Approved by: https://github.com/anijain2305
2024-07-26 10:47:38 +00:00
Oguz Ulgen
7a42470bcb
Annotate all InstructionTranslator ( #131509 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131509
Approved by: https://github.com/zou3519
2024-07-24 23:45:53 +00:00
PyTorch MergeBot
5db5865614
Revert "Annotate all InstructionTranslator ( #131509 )"
...
This reverts commit eafbd20f23 .
Reverted https://github.com/pytorch/pytorch/pull/131509 on behalf of https://github.com/clee2000 due to sorry need to revert this to revert something else, I think you only need to rebase and remerge ([comment](https://github.com/pytorch/pytorch/pull/131509#issuecomment-2249000843 ))
2024-07-24 22:29:49 +00:00
Oguz Ulgen
b56939dae1
Annotate more InstructionTranslator ( #131680 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131680
Approved by: https://github.com/zou3519
ghstack dependencies: #131676
2024-07-24 22:14:29 +00:00
Oguz Ulgen
eafbd20f23
Annotate all InstructionTranslator ( #131509 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131509
Approved by: https://github.com/zou3519
2024-07-24 05:31:01 +00:00
Animesh Jain
6850e42266
[dynamo][exception] Remove older specialization for StopIteration ( #131512 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131512
Approved by: https://github.com/yanboliang
ghstack dependencies: #131347 , #131367 , #131378 , #131389 , #131405 , #131480
2024-07-24 00:06:53 +00:00
Animesh Jain
6bbef2a06b
[dynamo] Support set on KeysView ( #131389 )
...
Fixes https://github.com/pytorch/pytorch/issues/129664
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131389
Approved by: https://github.com/mlazos
ghstack dependencies: #131347 , #131367 , #131378
2024-07-23 14:15:26 +00:00