William Wen
5bae580502
Don't graph break on patched module methods ( #93115 )
...
Fix one case for https://github.com/pytorch/pytorch/pull/91018 since it's needed soon.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/93115
Approved by: https://github.com/angelayi
2023-01-27 06:14:44 +00:00
PyTorch MergeBot
6a3ddd0171
Revert "Don't graph break on patched module methods or aliased methods ( #91018 )"
...
This reverts commit d6fc2d82ca .
Reverted https://github.com/pytorch/pytorch/pull/91018 on behalf of https://github.com/kit1980 due to After this PR, inductor / cuda11.6-py3.10-gcc7-sm86 / test fails every time with CUDA out of memory during OPTForCausalLM
2022-12-21 19:54:15 +00:00
William Wen
d6fc2d82ca
Don't graph break on patched module methods or aliased methods ( #91018 )
...
See added tests for the cases that were fixed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91018
Approved by: https://github.com/Morgan77523 , https://github.com/anijain2305
2022-12-21 16:29:15 +00:00
Yanbo Liang
e2674aafed
[Dynamo] Supports calling parent class‘s non classmethod from child class ( #90682 )
...
Fixes https://github.com/pytorch/pytorch/issues/90558
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90682
Approved by: https://github.com/jansel
2022-12-12 22:33:46 +00:00
Yanbo Liang
2e0ce24890
[Dynamo] Support access nn.Module keys ( #90502 )
...
Fixes https://github.com/pytorch/torchdynamo/issues/1973
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90502
Approved by: https://github.com/jansel
2022-12-12 09:15:42 +00:00
Edward Z. Yang
3d4b92b171
Ensure that we fakeify tensor subclasses when they are initially tracked ( #90009 )
...
The old code didn't actually fakeify traceable tensor subclasses at the
time they are added as a GraphArg to the module; now we do, by ignoring
the subclass during fakeification and relying on Dynamo to simulate
the subclass on top. See comments for more details.
BTW, this codepath is super broken, see filed issues linked on the
inside.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90009
Approved by: https://github.com/wconstab , https://github.com/voznesenskym
2022-12-06 22:36:32 +00:00
Michael Voznesensky
41c3b41b92
Use dynamo fake tensor mode in aot_autograd, move aot_autograd compilation to lowering time [Merger of 89672 and 89773] ( #90039 )
...
After all of the preparatory commits, this is a subset of the
changes in https://github.com/pytorch/pytorch/pull/89392 that actually
change us to propagating fake tensors to backends.
Signed-off-by: Edward Z. Yang <ezyangfb.com>
This is the merger of Ed's PR #89672 , which is a rewrite of an older PR of mine (#89392 ), with CI Fixes on top of it (#89773 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90039
Approved by: https://github.com/ezyang
2022-12-05 01:56:50 +00:00
PyTorch MergeBot
4648baa911
Revert "Use dynamo fake tensor mode in aot_autograd, move aot_autograd compilation to lowering time [Merger of 89672 and 89773] ( #90039 )"
...
This reverts commit ef0c7ec958 .
Reverted https://github.com/pytorch/pytorch/pull/90039 on behalf of https://github.com/clee2000 due to broke xla tests ef0c7ec958 https://github.com/pytorch/pytorch/actions/runs/3606308473/jobs/6077646142
2022-12-04 21:57:30 +00:00
Michael Voznesensky
ef0c7ec958
Use dynamo fake tensor mode in aot_autograd, move aot_autograd compilation to lowering time [Merger of 89672 and 89773] ( #90039 )
...
After all of the preparatory commits, this is a subset of the
changes in https://github.com/pytorch/pytorch/pull/89392 that actually
change us to propagating fake tensors to backends.
Signed-off-by: Edward Z. Yang <ezyangfb.com>
This is the merger of Ed's PR #89672 , which is a rewrite of an older PR of mine (#89392 ), with CI Fixes on top of it (#89773 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90039
Approved by: https://github.com/ezyang
2022-12-03 01:19:55 +00:00
Yanbo Liang
d88b555577
[Dynamo] Fix source/reconstruction bugs in NNModule named_* calls ( #89729 )
...
Fixes https://github.com/pytorch/torchdynamo/issues/1931
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89729
Approved by: https://github.com/ezyang
2022-11-30 06:05:47 +00:00
Edward Z. Yang
856e2fa59c
Guard traceable_tensor_subclasses patching with finally ( #89689 )
...
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89689
Approved by: https://github.com/albanD , https://github.com/anjali411
2022-11-28 14:48:12 +00:00
Animesh Jain
30d9fb9157
[dynamo][reland] API Support for nn.Module ( #89113 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89113
Approved by: https://github.com/ezyang
2022-11-17 02:03:48 +00:00
PyTorch MergeBot
98bcb4acb6
Revert "[reland][dynamo] Better support for nn.Module ( #88959 )"
...
This reverts commit e950afc395 .
Reverted https://github.com/pytorch/pytorch/pull/88959 on behalf of https://github.com/malfet due to Broke `test_accuracy_issue1`
2022-11-13 16:21:14 +00:00
Animesh Jain
e950afc395
[reland][dynamo] Better support for nn.Module ( #88959 )
...
Relanding https://github.com/pytorch/pytorch/pull/88629
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88959
Approved by: https://github.com/msaroufim
2022-11-13 08:19:45 +00:00
PyTorch MergeBot
ae2c668cc0
Revert "[dynamo][api] Better support of torch.nn.Module ( #88629 )"
...
This reverts commit c83348597b .
Reverted https://github.com/pytorch/pytorch/pull/88629 on behalf of https://github.com/anijain2305 due to job failing on master https://github.com/pytorch/pytorch/actions/runs/3449914495/jobs/5758267231
2022-11-12 07:52:56 +00:00
Animesh Jain
c83348597b
[dynamo][api] Better support of torch.nn.Module ( #88629 )
...
This is an API change, so please review carefully.
With this PR, torchdynamo returns an `OptimizedModule` class object, a subclass of `torch.nn.Module`, when asked to optimize a `nn.Module` object. Most of the methods are redirected to the original `nn.Module`, which is installed as `_mod` in the `OptimizedModule`.
This is helpful for many cases
```
mod = MockModule()
opt_mod = torch._dynamo.optimize()(mod)
print(opt_mod) # Works
opt_mod = opt_mod.to(device="cuda")
print(opt_mod) # Works
opt_mod(input) # Triggers recompile if necessary, earlier we were shedding the TorchDynamo wrapper
opt_mod.parameters() # Refers to the original module
```
Topics unclear to me
* I have overridden many methods to raise NotImplementedError. A careful review of those will be good.
* hooks
* For the optimized forward, should we call torchdynamo optimization on `__call__` or `forward`
* What else to test
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88629
Approved by: https://github.com/Chillee , https://github.com/jansel , https://github.com/msaroufim
2022-11-12 04:45:17 +00:00
Michael Voznesensky
2b03a941f7
[dynamo] graph capture for calls to arbitrary self. methods on nn module ( #87040 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87040
Approved by: https://github.com/jansel
2022-10-18 16:54:40 +00:00
Jason Ansel
8f71e8de7e
Sync changes from pytorch/torchdynamo, enable tests ( #86950 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86950
Approved by: https://github.com/Chillee
2022-10-14 23:08:58 +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