Skip to content

Conversation

qihqi
Copy link
Contributor

@qihqi qihqi commented Feb 9, 2024

Reason:
Consumers of ExportProgram might choose to further lower exported_program.graph_module
to something else.
Then, it will need to setup the calling convention to call it.

This refactor concentrates these calling convention to one place and can be reused.

Fixes #ISSUE_NUMBER

Copy link

pytorch-bot bot commented Feb 9, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 657bba0 with merge base cd9a193 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@qihqi
Copy link
Contributor Author

qihqi commented Feb 9, 2024

discussed previously with @zhxchen17

Copy link
Contributor

@zhxchen17 zhxchen17 left a comment

Choose a reason for hiding this comment

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

is this something we discussed long ago last year?

Copy link
Contributor

Choose a reason for hiding this comment

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

@angelayi is working on removing this API. we can leave it as-is in the diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing __call__?
What is the replacement?

Copy link
Contributor

Choose a reason for hiding this comment

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

@qihqi we're changing to ep.module()(*args, **kwargs), because in a lot of cases people want a drop in replacement torch.nn.Module, and .module() does that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why not keep __call__ and it forwards to self.module()(...)?

Copy link
Contributor

Choose a reason for hiding this comment

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

that's also okayish to do, but we just feel it might cause some confusion to people, because there're two ways to call the same thing from API perspective.

halfjoking, that's not very pythonic(tm)

@qihqi
Copy link
Contributor Author

qihqi commented Feb 9, 2024

More context: introduction of constants variable (in #116985) made my logic at https://github.com/pytorch/xla/blob/master/torch_xla/stablehlo.py#L308 invalid; giving key errors when converting models. I expect the calling convention will keep changing as you deprecate fields. So let's share this bit of code so whatever changes done inside of it I'll get updated version automatically.

Thanks!

@qihqi qihqi requested a review from zhxchen17 February 9, 2024 17:23
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 9, 2024
@qihqi qihqi force-pushed the fix_export1 branch 2 times, most recently from 7bd5995 to 426e004 Compare February 9, 2024 18:53
Copy link
Contributor

Choose a reason for hiding this comment

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

@qihqi since you mentioned you want to land it soon, could we make temporarily make it a private API (_graph_module_flat_inputs)? In that way you can be unblocked and we can have some time later to make a formal design discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zhxchen17 done. Please keep me in the loop when these functions get renamed to become public.

@qihqi
Copy link
Contributor Author

qihqi commented Feb 10, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Feb 10, 2024
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

@qihqi
Copy link
Contributor Author

qihqi commented Feb 12, 2024

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Feb 12, 2024
@qihqi
Copy link
Contributor Author

qihqi commented Feb 12, 2024

@pytorchbot merge

@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

clee2000 pushed a commit that referenced this pull request Feb 14, 2024
…essing (#119513)

Reason:
Consumers of ExportProgram might choose to further lower exported_program.graph_module
to something else.
Then, it will need to setup the calling convention to call it.

This refactor concentrates these calling convention to one place and can be reused.

Fixes #ISSUE_NUMBER

Pull Request resolved: #119513
Approved by: https://github.com/zhxchen17
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 open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants