pytorch/torch/_export
angelayi 3fe42d4d5d [export] Dynamo symint support (#152677)
Basically adds native _IntWrapper support to dynamo. Here's my process of trying to make symint input support work on dynamo, and how I ended up with this approach [(doc)](https://docs.google.com/document/d/1GvNRQd8BnxlMay_hrEVgEta6VUeUW_hcFeRuB7q1nDY/edit?tab=t.0).

What I did was, before passing inputs to dynamo.export, I first wrap them with a class, `_IntWrapper`. When processing dynamic shapes, I will then add the corresponding dynamic shape specification to the `dynamism` field stored on the `_IntWrapper`. If there is no dynamism specified, then this will get unwrapped back to an integer. When dynamo tracing, when we encounter an `_IntWrapper`, we will convert this to a symint if the dynamism was specified as `Dim.DYNAMIC/AUTO`. Dynamo will then trace a graph that contains symint inputs, which will get passed to AOTAutograd and so on.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152677
Approved by: https://github.com/pianpwk
2025-05-16 07:51:50 +00:00
..
db PEP585 update - torch/_export (#145138) 2025-01-19 18:48:35 +00:00
pass_infra PEP585 update - torch/_export (#145138) 2025-01-19 18:48:35 +00:00
passes [export][function schema] support exporting hop with function schema argument (#152073) 2025-05-01 05:22:02 +00:00
serde GPU lowering uses aoti_call_delegate (#153282) 2025-05-13 23:23:27 +00:00
__init__.py PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
converter.py [export] refactor DimHints for type errors (#149424) 2025-03-19 18:51:07 +00:00
error.py Fix global flake8 issues (#124771) 2024-04-26 15:35:53 +00:00
non_strict_utils.py [export] support functools.partial forward (non-strict) (#153408) 2025-05-13 23:30:13 +00:00
pass_base.py BE: Swap functorch --> torch._higher_order_ops (#152620) 2025-05-01 21:53:23 +00:00
tools.py PEP585 update - torch/_export (#145138) 2025-01-19 18:48:35 +00:00
utils.py [export] Dynamo symint support (#152677) 2025-05-16 07:51:50 +00:00
verifier.py Expand allowed_getattr_types_for_subgm to torch.Tensor (#150867) 2025-04-09 11:01:45 +00:00
wrappers.py Support subclass constructor capturing in export (#147014) 2025-03-16 18:19:19 +00:00