[ET-VK] Support exporting graphs with symbolic shape ops + update view to accept sym_size args#10997
Merged
Conversation
…w to accept sym_size args ## Context The ultimate goal is to be able to export the transformer models with dynamic shapes enabled so that batched prefill can be done. With transformer models, when dynamic shapes are turned on, `sym_size` operators appear in the graph which are used to determine the `seq_len` of the inputs, i.e. how many tokens are being passed into the input sequence. The `sym_size` operator accepts a tensor and a dim, and extracts the size of the tensor at the specified dim as a symbolic integer. In the transformer model, the `seq_len` symint is used as an argument to `view` operators. This PR enables exporting graphs with symbolic integer nodes and in particular the `sym_size` operator, as well as handling when symints are used in a list of ints. # Changes * Miscellaneous fixes to fix errors that show occur when symint nodes are encountered * Add C++ implementation of symint nodes and add registration for it * Enable the view operator to handle when the sizes arg includes symints Differential Revision: [D75019798](https://our.internmc.facebook.com/intern/diff/D75019798/) ghstack-source-id: 284928657 Pull Request resolved: #10980
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10997
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c25a469 with merge base da62d5f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
|
@pytorchbot label "release notes: none" |
Gasoonjia
approved these changes
May 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #10980 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/228/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/228/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/228/orig
@diff-train-skip-merge