linhaifeng
695cb0d342
[2/N][Fix] Fix typo in test folder ( #166374 )
...
Fix typo in test folder.
_typos.toml
```bash
[default.extend-words]
nd = "nd"
arange = "arange"
Nd = "Nd"
GLOBALs = "GLOBALs"
hte = "hte"
iy = "iy"
PN = "PN"
Dout = "Dout"
optin = "optin"
gam = "gam"
PTD = "PTD"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166374
Approved by: https://github.com/cyyever , https://github.com/ezyang
2025-10-29 03:02:07 +00:00
Guilherme Leobas
e6f766c7d7
[Dynamo] Fixes for exceptions ( #153966 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/153966
Approved by: https://github.com/Lucaskabela
2025-10-14 22:03:58 +00:00
Guilherme Leobas
d636c181f9
Fix range.__getitem__() ( #161804 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161804
Approved by: https://github.com/anijain2305
ghstack dependencies: #161801 , #161802 , #161803
2025-09-04 02:33:03 +00:00
Guilherme Leobas
485a7bd82e
Add range_count and range.__contains__ ( #161802 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161802
Approved by: https://github.com/anijain2305
ghstack dependencies: #161801
2025-09-04 02:33:03 +00:00
Guilherme Leobas
1ef7efa592
Add range_equals ( #161801 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161801
Approved by: https://github.com/anijain2305
2025-09-04 02:33:03 +00:00
William Wen
8678d831c4
[dynamo] rename set_fullgraph to error_on_graph_break ( #161739 )
...
Renaming `set_fullgraph` to `error_on_graph_break` for now. There are no semantic differences yet. In a followup PR, we will introduce a new `torch.compile` option `error_on_graph_break` that has lower priority than `fullgraph` so that `fullgraph` really returns 1 graph.
I could keep `set_fullgraph` as a deprecated alias for `error_on_graph_break` for now, but I'm hoping that won't be necessary since it's still private API (there are no internal callsites yet, and there are no significant OSS callsites yet).
cc @albanD @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @Lucaskabela @mlazos @guilhermeleobas @xmfan as primary users for `set_fullgraph`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161739
Approved by: https://github.com/xmfan , https://github.com/Lucaskabela , https://github.com/anijain2305 , https://github.com/mlazos
2025-09-04 01:15:06 +00:00
Guilherme Leobas
eb18d32bda
Add range_iterator ( #161800 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161800
Approved by: https://github.com/anijain2305
ghstack dependencies: #161799
2025-09-03 16:55:04 +00:00
Guilherme Leobas
889f01eb73
Add CPython test test_range ( #161799 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161799
Approved by: https://github.com/anijain2305
2025-09-03 16:55:04 +00:00
Guilherme Leobas
2d44969bbd
Wrap class definitions in set_fullgraph(False) in test_dict/test_ordered_dict ( #160156 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160156
Approved by: https://github.com/zou3519
2025-08-27 15:46:40 +00:00
Rob Timpe
4c36c8a994
[dynamo] Support method calls on complex ConstantVariables ( #161122 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161122
Approved by: https://github.com/mlazos , https://github.com/guilhermeleobas
2025-08-22 21:40:03 +00:00
Rob Timpe
162bf78df6
[dynamo] Support itertools.filterfalse ( #160596 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160596
Approved by: https://github.com/guilhermeleobas
2025-08-18 18:07:57 +00:00
Guilherme Leobas
f1bc843a5d
Wrap class definitions in set_fullgraph(False) in test_collections ( #159902 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159902
Approved by: https://github.com/mlazos
ghstack dependencies: #159365 , #159366 , #159368 , #159483
2025-08-16 20:42:15 +00:00
Guilherme Leobas
d387a48c38
[generator] Raise StopIteration(value) with value from the return stmt ( #157152 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157152
Approved by: https://github.com/zou3519
ghstack dependencies: #157148
2025-08-15 01:42:40 +00:00
Guilherme Leobas
831e85104a
[contextlib] Fixes for CPython contextlib tests ( #157148 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157148
Approved by: https://github.com/zou3519
2025-08-15 01:42:40 +00:00
Guilherme Leobas
1028c5e2d5
[Dynamo] Add CPython default dict tests ( #155263 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155263
Approved by: https://github.com/zou3519
2025-08-14 20:22:22 +00:00
Guilherme Leobas
3028fa6ce9
Wrap class definitions in set_fullgraph(False) in test_list/tuple ( #160277 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160277
Approved by: https://github.com/zou3519
ghstack dependencies: #160216 , #160217 , #160276 , #160278 , #160330 , #160331
2025-08-14 17:29:45 +00:00
Guilherme Leobas
3faee0a631
Update nullcontext to return input args ( #158776 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158776
Approved by: https://github.com/zou3519
2025-08-14 03:02:44 +00:00
Guilherme Leobas
af3cabc55d
Wrap class definitions in set_fullgraph(False) in test_sort ( #160331 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160331
Approved by: https://github.com/zou3519
ghstack dependencies: #160216 , #160217 , #160276 , #160278 , #160330
2025-08-14 02:12:20 +00:00
Guilherme Leobas
74bbe7b4a3
Wrap class definitions in set_fullgraph(False) in test_math/cmath ( #160330 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160330
Approved by: https://github.com/zou3519
ghstack dependencies: #160216 , #160217 , #160276 , #160278
2025-08-14 02:12:20 +00:00
Guilherme Leobas
7bfc424a61
Wrap class definitions in set_fullgraph(False) in test_iter ( #160278 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160278
Approved by: https://github.com/williamwen42 , https://github.com/zou3519
ghstack dependencies: #160216 , #160217 , #160276
2025-08-14 02:12:20 +00:00
Guilherme Leobas
85db508af5
Wrap class definitions in set_fullgraph(False) in test_int/bool/float/complex ( #160276 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160276
Approved by: https://github.com/zou3519
ghstack dependencies: #160216 , #160217
2025-08-13 04:53:03 +00:00
Guilherme Leobas
27156ec804
Wrap class definitions in set_fullgraph(False) in test_operator ( #160217 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160217
Approved by: https://github.com/zou3519
ghstack dependencies: #160216
2025-08-13 04:53:03 +00:00
Guilherme Leobas
6746bc59df
Wrap class definitions in set_fullgraph(False) in test_set ( #160216 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160216
Approved by: https://github.com/zou3519
2025-08-13 04:53:03 +00:00
Rob Timpe
5ed4f91779
[dynamo] support itertools.permutations ( #159694 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159694
Approved by: https://github.com/guilhermeleobas
ghstack dependencies: #159693
2025-08-09 03:01:58 +00:00
Rob Timpe
e07c52b2c0
[dynamo] Improve support for itertools.product ( #159693 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159693
Approved by: https://github.com/guilhermeleobas , https://github.com/mlazos
2025-08-09 03:01:58 +00:00
Guilherme Leobas
3fcd79e023
Fix infinite loop when iterating over an empty zip ( #159673 )
...
Dynamo would enter in an infinite recursion when
`ZipVariable.next_variable(tx)` was called and there was no iterable to
be iterated
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159673
Approved by: https://github.com/williamwen42
2025-08-08 02:50:21 +00:00
Rob Timpe
8becf646ef
[dynamo] Make filter handle None as filter function ( #159500 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159500
Approved by: https://github.com/guilhermeleobas , https://github.com/zou3519
ghstack dependencies: #158774 , #159102
2025-07-31 23:28:57 +00:00
Rob Timpe
fa68216ca1
[itertools] Implement itertools.cycle with a polyfill ( #159102 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159102
Approved by: https://github.com/guilhermeleobas , https://github.com/zou3519
ghstack dependencies: #158774
2025-07-31 23:28:57 +00:00
Guilherme Leobas
d0e8a0ec4c
Add CPython test for heapq ( #159370 )
...
Not used directly but used internally by `collections.Counter`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159370
Approved by: https://github.com/zou3519 , https://github.com/Skylion007
2025-07-30 18:43:06 +00:00
Guilherme Leobas
a91ddea61f
Add CPython tests for collections module ( #158950 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158950
Approved by: https://github.com/zou3519
2025-07-29 02:24:27 +00:00
Guilherme Leobas
acffd1a297
[iter] Update some of the tests to not call pickle ( #156369 )
...
Some tests in test_iter only fail because of pickle. I'm skipping the pickle section as Dynamo doesn't support it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156369
Approved by: https://github.com/zou3519
2025-07-18 16:48:27 +00:00
Guilherme Leobas
59c3cac454
Tag CPython test files with the commit or tag they were copied from. ( #158038 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158038
Approved by: https://github.com/XuehaiPan , https://github.com/zou3519
ghstack dependencies: #157799 , #157800 , #157801 , #157802 , #156981
2025-07-14 15:42:19 +00:00
Guilherme Leobas
7599bebead
Add CPython test test_itertools ( #156981 )
...
Test the itertools module
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156981
Approved by: https://github.com/zou3519
ghstack dependencies: #157799 , #157800 , #157801 , #157802
2025-07-11 00:12:50 +00:00
Guilherme Leobas
397ca98510
Add CPython test test_with ( #157802 )
...
Test with statement behavior and dunder methods __enter__ and __exit__
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157802
Approved by: https://github.com/zou3519
ghstack dependencies: #157799 , #157800 , #157801
2025-07-11 00:12:50 +00:00
Guilherme Leobas
4809f43867
Add CPython test test_numeric_tower ( #157801 )
...
Test abstract numeric types and dunder methods like __int__, __float__, __index__, etc.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157801
Approved by: https://github.com/zou3519
ghstack dependencies: #157799 , #157800
2025-07-11 00:12:50 +00:00
Guilherme Leobas
0ebf2447da
Add CPython test test_operator ( #157800 )
...
Test operators via operator module like add, sub, eq, lt, etc.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157800
Approved by: https://github.com/zou3519
ghstack dependencies: #157799
2025-07-11 00:12:50 +00:00
Guilherme Leobas
91041f559d
Add CPython test test_bool ( #157799 )
...
Test dunder methods `__bool__` and `__len__`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157799
Approved by: https://github.com/zou3519 , https://github.com/XuehaiPan
2025-07-11 00:12:50 +00:00
Guilherme Leobas
e49acfc5c5
[list] Raise exception in invalid list method call ( #156148 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156148
Approved by: https://github.com/zou3519
ghstack dependencies: #153969
2025-07-07 14:51:10 +00:00
Guilherme Leobas
9d175bc7e6
Fixes for CPython int/float tests ( #155978 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978
Approved by: https://github.com/zou3519
2025-07-02 15:04:00 +00:00
PyTorch MergeBot
c202a7329a
Revert "Fixes for CPython int/float tests ( #155978 )"
...
This reverts commit 23491519d2 .
Reverted https://github.com/pytorch/pytorch/pull/155978 on behalf of https://github.com/XuehaiPan due to sys.get_int_max_str_digits is not always available ([comment](https://github.com/pytorch/pytorch/pull/155978#issuecomment-3021990027 ))
2025-07-01 06:16:49 +00:00
Guilherme Leobas
23491519d2
Fixes for CPython int/float tests ( #155978 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978
Approved by: https://github.com/zou3519
2025-06-30 19:42:11 +00:00
PyTorch MergeBot
da1f337bc4
Revert "Fixes for CPython int/float tests ( #155978 )"
...
This reverts commit fab53dfdf1 .
Reverted https://github.com/pytorch/pytorch/pull/155978 on behalf of https://github.com/guilhermeleobas due to failing in trunk ([comment](https://github.com/pytorch/pytorch/pull/155978#issuecomment-3019457531 ))
2025-06-30 14:49:44 +00:00
Guilherme Leobas
fab53dfdf1
Fixes for CPython int/float tests ( #155978 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978
Approved by: https://github.com/zou3519
2025-06-30 14:15:47 +00:00
PyTorch MergeBot
0decd966af
Revert "Fixes for CPython int/float tests ( #155978 )"
...
This reverts commit 216bd6091e .
Reverted https://github.com/pytorch/pytorch/pull/155978 on behalf of https://github.com/huydhn due to Some tests are still failing in trunk ([comment](https://github.com/pytorch/pytorch/pull/155978#issuecomment-3014185210 ))
2025-06-27 19:39:41 +00:00
Guilherme Leobas
216bd6091e
Fixes for CPython int/float tests ( #155978 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978
Approved by: https://github.com/zou3519
2025-06-27 16:41:00 +00:00
Guilherme Leobas
644cc58dff
Add CPython exception tests ( #150789 )
...
----
* test_baseexception.py
* test_exceptions.py
* test_exception_variations.py
* test_raise.py
* test_sys.py
Minor changes were made to each test to run them inside Dynamo
One can reproduce the changes by downloading the tests from CPython and applying the diff:
```bash
for f in "test_raise" "test_sys" "test_exceptions" "test_baseexception" "test_exception_variations"; do
wget -O "test/dynamo/cpython/3_13/${f}.py" "https://raw.githubusercontent.com/python/cpython/refs/heads/3.13/Lib/test/${f}.py "
git apply "test/dynamo/cpython/3_13/${f}.diff"
done
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/150789
Approved by: https://github.com/zou3519
2025-06-24 18:06:42 +00:00
Guilherme Leobas
dd78d6e7ea
Add CPython generator/contextlib tests ( #150796 )
...
Tests:
* test_generator.py
* test_generator_stop.py
* test_contextlib.py
Minor changes were made to each test to run them inside Dynamo. We
intentionally didn't copy the binary files stored in
`python/Lib/test/archivetestdata` for security reasons. There's a single
test that requires a binary file and it is skipped because of that.
The tests were downloaded from CPython 3.13 and the diff was generated
using `git diff` to apply the changes:
```bash
for f in "test_contextlib" "test_generators" "test_generator_stop"; do
wget -O "test/dynamo/cpython/3_13/${f}.py" "https://raw.githubusercontent.com/python/cpython/refs/heads/3.13/Lib/test/${f}.py "
git apply "test/dynamo/cpython/3_13/${f}.diff"
done
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/150796
Approved by: https://github.com/williamwen42
2025-06-24 13:15:04 +00:00
Guilherme Leobas
b8fc5e0c0d
skip flaky test in CPython 3.13 tests ( #155561 )
...
Changed files:
* test_math.py
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155561
Approved by: https://github.com/zou3519
2025-06-20 20:25:35 +00:00
David Berard
be2ab96347
Inductor unit tests: cuda 12.6 -> 12.8 ( #155056 )
...
Fixes #154938
When we update the Triton version in CI, we'll require cuda >= 12.8 for certain AOTI tests to pass: these AOTI tests try to run nvcc on the triton-generated PTX, and triton-generated PTX is PTX 8.7, which requires CUDA 12.8
Regarding the revert & reland:
* This PR causes the python 3.13 version to be bumped from 3.13.2 to 3.13.3. test_deopt_from_append_list starts unexpectedly passing on 3.13.3, so I originally modified the test in https://github.com/pytorch/pytorch/pull/155167 to xfail only for <=3.13.2
* However there was a land race with https://github.com/pytorch/pytorch/pull/150796 , which introduced another test that passes only for >=3.13.3.
Resolution:
* @guilhermeleobas reverted https://github.com/pytorch/pytorch/pull/150796 so I will reland this (and I've merged the test_deopt_from_append_list change into this PR. And based on Guilherme's feedback, I'm just skipping the test instead of selectively failing/passing the test.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155056
Approved by: https://github.com/atalman , https://github.com/nWEIdia
2025-06-05 17:17:27 +00:00
PyTorch MergeBot
a1057cda31
Revert "Add CPython generator/contextlib tests ( #150796 )"
...
This reverts commit d5f642211f .
Reverted https://github.com/pytorch/pytorch/pull/150796 on behalf of https://github.com/guilhermeleobas due to This is breaking tests on trunk. https://hud.pytorch.org/hud/pytorch/pytorch/main/1?per_page=50&name_filter=3.13&mergeEphemeralLF=true ([comment](https://github.com/pytorch/pytorch/pull/150796#issuecomment-2944469866 ))
2025-06-05 13:51:54 +00:00