Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[export] Serialize symbolic values #103273

Closed
wants to merge 6 commits into from

Conversation

angelayi
Copy link
Contributor

@angelayi angelayi commented Jun 8, 2023

  • Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
  • GraphModuleDeserializer.deserialize now also optionally map of symbol names to range.

ReplaceSymSizeOpPass should not be needed after #103107 lands

Stack from ghstack (oldest at bottom):

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Jun 8, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit ed4ef55:
💚 Looks good so far! There are no failures yet. 💚

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

@angelayi angelayi requested review from avikchaudhuri, zhxchen17 and SherlockNoMad and removed request for avikchaudhuri June 8, 2023 21:53
@angelayi angelayi changed the title [export] Serialize shape [export] Serialize symbolic values Jun 8, 2023
@angelayi angelayi mentioned this pull request Jun 9, 2023
5 tasks
test/export/test_serialize.py Outdated Show resolved Hide resolved
test/export/test_serialize.py Outdated Show resolved Hide resolved
torch/_export/serde/serialize.py Show resolved Hide resolved
torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
@avikchaudhuri
Copy link
Contributor

Requesting changes mainly because I'm unsure of the motivation behind adding extra params to graph module deserializer.

torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
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.

some initial comments

torch/_export/serde/schema.py Outdated Show resolved Hide resolved
torch/_export/serde/serialize.py Show resolved Hide resolved
* Serialized range constraints and inline constraints into symbols represented as strings
* These symbols are then reconstructed in the deserialize_sym_int/bool functions by adding them to the shape env along with the ranges.
* Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
* GraphModuleDeserializer.deserialize now also optionally takes in a shape env and map of symbols to names.

ReplaceSymSizeOpPass should not be needed after #103107 lands




[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jun 10, 2023
ghstack-source-id: 7c548e934c6e993cfb0dd9478058a28b106090cc
Pull Request resolved: #103273
* Serialized range constraints and inline constraints into symbols represented as strings
* These symbols are then reconstructed in the deserialize_sym_int/bool functions by adding them to the shape env along with the ranges.
* Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
* GraphModuleDeserializer.deserialize now also optionally takes in a shape env and map of symbols to names.

ReplaceSymSizeOpPass should not be needed after #103107 lands




[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jun 10, 2023
ghstack-source-id: 5beca86a3240cf7c7f61e0b740e166a639ee84d1
Pull Request resolved: #103273
@angelayi angelayi requested a review from zhxchen17 June 10, 2023 01:08
@pytorch-bot pytorch-bot bot added the release notes: fx release notes category label Jun 10, 2023
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.

I think we're good to go after 1 more iteration.

torch/_export/passes/replace_sym_size_ops_pass.py Outdated Show resolved Hide resolved
torch/_export/serde/schema.py Show resolved Hide resolved
torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
torch/_export/serde/serialize.py Outdated Show resolved Hide resolved
* Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
* GraphModuleDeserializer.deserialize now also optionally map of symbol names to range.

ReplaceSymSizeOpPass should not be needed after #103107 lands




[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jun 12, 2023
ghstack-source-id: a17228b8d3858d0230b86e4b4b4d536461248ae0
Pull Request resolved: #103273
@angelayi angelayi requested a review from zhxchen17 June 12, 2023 20:48
* Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
* GraphModuleDeserializer.deserialize now also optionally map of symbol names to range.

ReplaceSymSizeOpPass should not be needed after #103107 lands




[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jun 13, 2023
ghstack-source-id: 445954766a5e936669f17995a867ef8eb45f104d
Pull Request resolved: #103273
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.

let's go

torch/fx/experimental/symbolic_shapes.py Show resolved Hide resolved
@angelayi
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 13, 2023
@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

@facebook-github-bot facebook-github-bot deleted the gh/angelayi/47/head branch June 17, 2023 14:16
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 release notes: export release notes: fx release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants