Skip to content

Update to pytorch 2.6#8944

Merged
tengyifei merged 2 commits intomasterfrom
hanq_xla2
Apr 9, 2025
Merged

Update to pytorch 2.6#8944
tengyifei merged 2 commits intomasterfrom
hanq_xla2

Conversation

@qihqi
Copy link
Copy Markdown
Collaborator

@qihqi qihqi commented Apr 5, 2025

Pytorch 2.6 introduced usage of decompositions via CompositeImplicitAutograd key: https://github.com/pytorch/pytorch/blob/60a45eb862d5e8b4ba2dd435d34ef04ae231e885/torch/_export/utils.py#L1249

These decompositions currently does not play nice with torch_dispatch based decomposition, resulting infinite recursion.
Likely we are using it wrong, I made a post here soliciting the right way to use decomposition https://dev-discuss.pytorch.org/t/what-is-the-right-way-to-use-decompositions-in-dispatch-mode/2888 soliciting advice on the topic.

Meanwhile the workaround is to explicitly list out decompositions we like without the CompositeImplicitAutograd decompositions. The explicit list is produced via keys in core_aten_decompositions() call using torch 2.5.1.

fixes #8952

@qihqi qihqi requested review from ManfeiBai and tengyifei April 5, 2025 17:50
Comment thread torchax/pyproject.toml Outdated
Comment thread torchax/test/test_ops.py Outdated
@tengyifei
Copy link
Copy Markdown
Collaborator

I wonder if it's possible to eliminate all autograd-related dispatch keys when calling these torch ops, since we just need decompositions in the forward direction and can rely on Jax autograd, I think..

It maybe runs into other PyTorch problems

Comment thread torchax/torchax/ops/jaten.py
Comment thread torchax/torchax/ops/jaten.py
Comment thread torchax/torchax/decompositions.py
Copy link
Copy Markdown
Collaborator

@ManfeiBai ManfeiBai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@tengyifei tengyifei merged commit 085f8bc into master Apr 9, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU test failure: test_dynamo.py

3 participants