Skip to content

Conversation

titaiwangms
Copy link
Collaborator

Fixes #150367

This PR makes decomposition table from onnx registry, which includes registered ops not only ATen and prim. This will help to keep the custom ops that are specified in the custom_translation table from decomposition during ONNX export.

Copy link

pytorch-bot bot commented Apr 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/151826

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 47618d2 with merge base cea43f7 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label Apr 21, 2025
@justinchuby
Copy link
Collaborator

Should we update self.functions: dict[TorchOp | str, list[OnnxDecompMeta]] = {} to self.functions: dict[TorchOp, list[OnnxDecompMeta]] = {}?

@justinchuby
Copy link
Collaborator

justinchuby commented Apr 21, 2025

Actually: We use str for all aten ops because they are sometimes not the same objects. Need to use logic to recover the aten ops. You can probably use getattr to do that.

@justinchuby
Copy link
Collaborator

justinchuby commented Apr 21, 2025

Need to update the logic in

target_or_name = target.name()

target_or_name = target.name()

?

@titaiwangms
Copy link
Collaborator Author

Need to update the logic in

target_or_name = target.name()

target_or_name = target.name()

?

Should be fine. That's why I am taking fx_target from OnnxDecompMeta.

@justinchuby
Copy link
Collaborator

Makes sense. I confused myself

@titaiwangms titaiwangms added module: onnx Related to torch.onnx topic: bug fixes topic category labels Apr 21, 2025
@titaiwangms
Copy link
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 22, 2025
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@justinchuby
Copy link
Collaborator

@pytorchbot cherry-pick --onto release/2.7.1 -c critical

@pytorchbot
Copy link
Collaborator

Cherry picking #151826

Command git -C /home/runner/work/pytorch/pytorch checkout release/2.7.1 returned non-zero exit code 1

error: pathspec 'release/2.7.1' did not match any file(s) known to git
Details for Dev Infra team Raised by workflow job

@justinchuby
Copy link
Collaborator

@pytorchbot cherry-pick --onto release/2.7 -c critical

pytorchbot pushed a commit that referenced this pull request May 8, 2025
Fixes #150367

This PR makes decomposition table from onnx registry, which includes registered ops not only ATen and prim. This will help to keep the custom ops that are specified in the custom_translation table from decomposition during ONNX export.
Pull Request resolved: #151826
Approved by: https://github.com/justinchuby

(cherry picked from commit 6cd1741)
@pytorchbot
Copy link
Collaborator

Cherry picking #151826

The cherry pick PR is at #153168 and it is recommended to link a critical cherry pick PR with an issue. The following tracker issues are updated:

Details for Dev Infra team Raised by workflow job

atalman pushed a commit that referenced this pull request May 20, 2025
* [ONNX] Update decomposition logic to loop over onnx registry (#151826)

Fixes #150367

This PR makes decomposition table from onnx registry, which includes registered ops not only ATen and prim. This will help to keep the custom ops that are specified in the custom_translation table from decomposition during ONNX export.
Pull Request resolved: #151826
Approved by: https://github.com/justinchuby

(cherry picked from commit 6cd1741)

* [ONNX] Add test for decomp_table update (#153671)

Added a test to strengthen the case for cherry-picking #153168. The original PR didn’t include this test since the fix for decomp_table and the registry was already covered by existing tests. However, it's reasonable to include a dedicated test for the specific issue (#150367 ) when considering the cherry-pick.
Pull Request resolved: #153671
Approved by: https://github.com/justinchuby

---------

Co-authored-by: titaiwangms <titaiwang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged module: onnx Related to torch.onnx open source release notes: onnx torch.onnx related changes that should show up in the release notes topic: bug fixes topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ONNX] decomp does not preserve custom CompositeImplicitAutograd ops
4 participants