Nikita Karetnikov
a8964d6377
[pt2] add meta and SymInt support for linalg_householder_product ( #101315 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101315
Approved by: https://github.com/lezcano
2023-05-15 02:56:49 +00:00
Nikita Karetnikov
6abde61f8e
[pt2] add meta function for _linalg_eigh ( #100964 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100964
Approved by: https://github.com/ezyang
2023-05-10 15:45:15 +00:00
Khushi
51fe53e619
[opinfo] item ( #100313 )
...
Follows #100223
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100313
Approved by: https://github.com/ezyang
2023-05-10 11:32:45 +00:00
Nikita Karetnikov
1e591a8b64
[pt2] add meta function for solve_triangular ( #100829 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100829
Approved by: https://github.com/ezyang
2023-05-08 13:48:15 +00:00
Nikita Karetnikov
266c84e3ab
[pt2] add meta function for linalg_qr ( #100714 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100714
Approved by: https://github.com/ezyang , https://github.com/lezcano
2023-05-06 15:04:02 +00:00
Nikita Karetnikov
37f1be041a
[pt2] enable svd in fake_tensor ( #100130 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100130
Approved by: https://github.com/ezyang , https://github.com/lezcano
2023-05-05 06:27:59 +00:00
Michael Voznesensky
fe3ecfe0cf
Add AotAutogradFallbackTests to dynamic suite ( #100454 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100454
Approved by: https://github.com/ezyang
2023-05-04 04:28:45 +00:00
Nikita Karetnikov
e87ed2a88d
[primTorch] add ref for polar ( #100345 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100345
Approved by: https://github.com/ezyang
2023-05-04 01:37:02 +00:00
Nikita Karetnikov
279f3cd0a6
[pt2] add SymInt support for dsplit, hsplit, vsplit ( #100352 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100352
Approved by: https://github.com/Skylion007 , https://github.com/ezyang
2023-05-02 18:51:03 +00:00
Nikita Karetnikov
41361538a9
[pt2] add SymInt support for tensordot and inner ( #100356 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100356
Approved by: https://github.com/ezyang
2023-05-02 14:42:50 +00:00
Brian Hirsh
62fad315c1
fix per-dispatchkey-mode caching bug ( #98030 )
...
The bug was that: if you want to move a mode to the autograd key, we need to use the "functionality" key for it (AutogradFunctionality). But when we do that, we need to clear any PythonDispatcher caches for every op for **every** autograd key (since you could run autograd ops with both cpu and cuda tensors underneath the mode, which both may have been cached).
I didn't add a test, since this ends up getting indirectly tests by export in the PR. If someone would prefer a direct test I can add one.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98030
Approved by: https://github.com/ezyang
2023-04-25 21:58:14 +00:00
Aaron Gokaslan
e2a3817dfd
[BE] Enable C419 rule for any all shortcircuiting ( #99890 )
...
Apparently https://github.com/pytorch/pytorch/pull/78142 made torch.JIT allow for simple generator expressions which allows us to enable rules that replace unnecessary list comprehensions with generators in any/all. This was originally part of #99280 but I split it off into this PR so that it can be easily reverted should anything break.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99890
Approved by: https://github.com/justinchuby , https://github.com/kit1980 , https://github.com/malfet
2023-04-25 15:02:13 +00:00
Nikita Karetnikov
fbb0ff10a4
[pt2] add SymInt support for trapezoid ops ( #99281 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99281
Approved by: https://github.com/ezyang
2023-04-25 00:44:25 +00:00
Wanchao Liang
ff7d5b62d4
Improve ProxyTensor tensor_tree list/tuple handling ( #99897 )
...
This PR improves the list/tuple handling by merging the logic into
`wrap_with_proxy` directly, and set_meta when we find the current
proxy is a fx.Proxy. This also solves the problem that even `fused_adam`
have `val`, some corresponding `getitem` calls followed after `fused_adam` don't have val
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99897
Approved by: https://github.com/ezyang
2023-04-24 22:50:02 +00:00
Michael Voznesensky
4c2892944f
Guard static shapes alongside tensors, instead of from shape_env, in dynamic_shapes=True ( #99566 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99566
Approved by: https://github.com/ezyang
2023-04-22 16:46:52 +00:00
Edward Z. Yang
10c938abef
Handle meta['val'] for tuple of lists. ( #99724 )
...
Fixes https://github.com/pytorch/pytorch/issues/99356
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99724
Approved by: https://github.com/wanchaol
2023-04-21 22:33:21 +00:00
Elias Ellison
638feec4e3
Turn on meta converter for complex ( #98869 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98869
Approved by: https://github.com/ngimel
2023-04-20 16:42:38 +00:00
Richard Zou
44b09bf673
Reland "Simple Custom Operator API, V0 ( #98440 )" ( #99416 )
...
See the original PR (#98440 ) for the description. It broke internal
builds due to proxy_tensor.py not importing torch._dynamo, which is
being fixed in the previous PR in the stack.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99416
Approved by: https://github.com/soulitzer , https://github.com/bdhirsh
2023-04-18 23:48:33 +00:00
PyTorch MergeBot
f497031df9
Revert "Simple Custom Operator API, V0 ( #98440 )"
...
This reverts commit 0157b2d722 .
Reverted https://github.com/pytorch/pytorch/pull/98440 on behalf of https://github.com/DanilBaibak due to Break internal build
2023-04-18 13:04:27 +00:00
Nikita Karetnikov
106ccf4a2a
[pt2] add meta function for linalg.cross ( #99279 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99279
Approved by: https://github.com/ezyang
2023-04-17 21:21:45 +00:00
Nikita Karetnikov
6f7b434f7b
[pt2] add SymInt support for column_stack ( #99276 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99276
Approved by: https://github.com/ezyang
2023-04-17 21:21:45 +00:00
PyTorch MergeBot
08dd4ad0b9
Revert "[pt2] add SymInt support for column_stack ( #99276 )"
...
This reverts commit 775dd869d0 .
Reverted https://github.com/pytorch/pytorch/pull/99276 on behalf of https://github.com/ezyang due to reverting this one too for safety
2023-04-17 19:37:58 +00:00
PyTorch MergeBot
f957334c2b
Revert "[pt2] add meta function for linalg.cross ( #99279 )"
...
This reverts commit efc3887ea5 .
Reverted https://github.com/pytorch/pytorch/pull/99279 on behalf of https://github.com/ezyang due to Apparently this is breaking inductor on master? So weird
2023-04-17 19:33:16 +00:00
Tugsbayasgalan Manlaibaatar
7401f0f8ce
Add unbacked symbool support ( #98877 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98877
Approved by: https://github.com/ezyang
2023-04-17 17:45:10 +00:00
Richard Zou
0157b2d722
Simple Custom Operator API, V0 ( #98440 )
...
This PR introduces CustomOp, a wrapper around a dispatcher operator that allows
users to define custom operators. It adds the skeleton for CustomOp and
some very simple behavior: as of this PR:
- one can create a CustomOp for an operator that does not have inplace or aliasing
- give it CPU/CUDA and Meta implementations
- and trace it into a graph via make_fx.
The design follows
https://docs.google.com/document/d/19Uc5OUCA187q9BZggJb70RT2ZoSTDoG5QQkJkZwd25M/edit
Concretely, we implement the following things mentioned in the doc in this PR:
- Entrypoint 1 (CustomOp.define, creating a new custom operator)
- impl (to define device-specific code) and impl_meta (to define meta
formulas)
The goal for the short term is to get the code to a state where it can be trialed
by the export folks. On top of this PR, the blockers are:
- adding Entrypoint 3 (CustomOp.from_existing)
- adding a way to do data-dependent shape formulas
These will come in future PRs since this one is getting long.
Things that will come in the longer-near-term (before 2.1):
- adding the other entrypoints mentioned in the doc (2 & 3)
- more safety checks and better error messages
- support for views and mutation
- support for defining autograd formulas
- support for functionalization
- making this API public (it's private right now).
Test Plan:
- added a new test case, TestCustomOp. It mostly tests a bunch of error
cases.
- added OpInfos for custom operators and hooked these up to
test_proxy_tensor to test that they work with make_fx. These custom
operators were based off of the ones in the autograd_function_db.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98440
Approved by: https://github.com/ezyang
2023-04-17 12:17:32 +00:00
Nikita Karetnikov
efc3887ea5
[pt2] add meta function for linalg.cross ( #99279 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99279
Approved by: https://github.com/ezyang
2023-04-17 03:05:20 +00:00
Nikita Karetnikov
775dd869d0
[pt2] add SymInt support for column_stack ( #99276 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99276
Approved by: https://github.com/ezyang
2023-04-17 03:05:20 +00:00
Nikita Karetnikov
21681f36f4
[pt2] add SymInt support for fft ops ( #99115 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99115
Approved by: https://github.com/ezyang
2023-04-15 18:01:39 +00:00
Peter Bell
7b91bd2a7b
[primTorch] Add count_nonzero ( #98995 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98995
Approved by: https://github.com/lezcano
2023-04-13 22:08:19 +00:00
Nikita Karetnikov
8db04e080c
[pt2] add SymInt support for cdist ( #98881 )
...
Fixes #98853 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98881
Approved by: https://github.com/ezyang
2023-04-12 23:06:40 +00:00
Edward Z. Yang
419ad49e65
Make Tensor.__contains__ accept SymInt/Float/Bool. ( #98933 )
...
Fixes https://github.com/pytorch/pytorch/issues/98870
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98933
Approved by: https://github.com/albanD , https://github.com/Skylion007
2023-04-12 19:16:33 +00:00
Nikita Karetnikov
ff825de442
[primTorch] add ref for cumprod ( #98670 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98670
Approved by: https://github.com/ezyang
2023-04-09 15:22:28 +00:00
Nikita Karetnikov
a2e7910dfd
[pt2] remove skip for masked.logsumexp in test_proxy_tensor.py ( #98676 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98676
Approved by: https://github.com/ezyang
2023-04-09 01:28:16 +00:00
Nikita Karetnikov
b411238d76
[pt2] add meta function for logcumsumexp ( #98683 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98683
Approved by: https://github.com/ezyang
2023-04-09 01:26:37 +00:00
Nikita Karetnikov
1c226f5aad
[pt2] add meta functions for cummax and cummin ( #98552 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98552
Approved by: https://github.com/Chillee
2023-04-07 17:58:28 +00:00
Nikita Karetnikov
7b25976323
[pt2] add meta function for take ( #98451 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98451
Approved by: https://github.com/ezyang
2023-04-06 14:48:35 +00:00
Michael Voznesensky
b1e60bfb6a
Pass f_locals as a dict rather than kwargs ( #98107 )
...
Fixes https://github.com/pytorch/pytorch/issues/97688
One big problem is that instead of printing x < y we now print
`E["x"] < E["y"]` and now all of the tests wobbled and I'm mad.
Signed-off-by: Edward Z. Yang <ezyangmeta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98107
Approved by: https://github.com/ezyang
2023-04-04 00:30:08 +00:00
Edward Z. Yang
8372c5dc68
Refactor dynamic dims api, stateless internals, higher level export API ( #96699 )
...
The purpose of this API is to execute a few large components of work:
1) Refactor all the internals of plumbing dynamic dimension information after dynamo to be stateless
2) Decouple allocation controls around dynamic dimensions from verification
3) For (2), for allocation, create an enum that dictates whether we are in DUCK (default today), STATIC (aka assume_static_default in the past), or DYNAMIC (aka user constrained, do not duck shape)
4) For (2), for verification, we separate out the list of dynamic ranges entirely from allocation. This means shape_env does not tracking for what we verify on, and instead, it is the callers job to invoke produce_guards() with the various things they want verified, specifically, with the valid ranges. We do use constrain ranges to refine value ranges when doing analysis.
5) We have decided, therefore, as an extension of (4) to double down on "late" checks versus "eager" checks, primarily because the mechanisms for gathering what actually matters happens during guards, and should be a purview of the caller seeking guards, not the shape env. However, for dynamo, these structures are essentially one and the same.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96699
Approved by: https://github.com/avikchaudhuri , https://github.com/ezyang
2023-03-29 16:55:49 +00:00
Brian Hirsh
35c9ea89fa
dont bake in defaults when tracing *_like factories ( #97564 )
...
quick fix for https://github.com/pytorch/pytorch/issues/97541 . letting CI run to see if there's any fallout
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97564
Approved by: https://github.com/ezyang
2023-03-27 22:53:44 +00:00
Brian Hirsh
af440c427b
[draft for discussion] add per-dispatch key modes ( #97052 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97052
Approved by: https://github.com/ezyang , https://github.com/zou3519
2023-03-21 23:45:45 +00:00
Rohan Gupta
b01d6f2cdb
addmv decomp #2 ( #96264 )
...
Fixes #94617
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96264
Approved by: https://github.com/ngimel , https://github.com/ezyang
2023-03-16 23:09:45 +00:00
Nikita Karetnikov
0d7c44096a
Add baddbmm meta function ( #96548 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96548
Approved by: https://github.com/ezyang
2023-03-11 19:09:24 +00:00
Nikita Karetnikov
8e0d5bf538
[primTorch] add meta implementation for aten.min.dim ( #96442 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96442
Approved by: https://github.com/ngimel
2023-03-11 18:51:51 +00:00
Edward Z. Yang
98ff841a75
Use maxint to bound integers. ( #96121 )
...
We don't actually support arbitrary precision integers.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96121
Approved by: https://github.com/tugsbayasgalan , https://github.com/lezcano
2023-03-07 12:46:19 +00:00
Edward Z. Yang
680214ac11
SymIntify a few more relatively non-controversial schemas ( #96100 )
...
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96100
Approved by: https://github.com/Skylion007
2023-03-06 23:12:40 +00:00
Jason Ansel
5dd52e250f
[inductor] Add some simple decomps ( #96039 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96039
Approved by: https://github.com/ngimel
2023-03-05 17:07:56 +00:00
Edward Z. Yang
027ebca4d7
Don't use guardless contiguity/stride-like implementations ( #95733 )
...
These prevent us from simplifying tests involving unbacked SymInts,
and then you end up with unbacked SymInt in guards, which is bad.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95733
Approved by: https://github.com/tugsbayasgalan
2023-03-03 21:56:41 +00:00
PyTorch MergeBot
4026c62174
Revert "Don't use guardless contiguity/stride-like implementations ( #95733 )"
...
This reverts commit deaf077de8 .
Reverted https://github.com/pytorch/pytorch/pull/95733 on behalf of https://github.com/ezyang due to apparently this regresses executorch tests internally
2023-03-03 17:43:05 +00:00
Edward Z. Yang
deaf077de8
Don't use guardless contiguity/stride-like implementations ( #95733 )
...
These prevent us from simplifying tests involving unbacked SymInts,
and then you end up with unbacked SymInt in guards, which is bad.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95733
Approved by: https://github.com/tugsbayasgalan
2023-03-01 23:14:58 +00:00
Edward Z. Yang
e628a3e724
Don't generate guards that refer to unbacked SymInts ( #95732 )
...
This regresses unbacked batch resnet, but I have a plan to recover that
too.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95732
Approved by: https://github.com/tugsbayasgalan
2023-03-01 06:14:27 +00:00