Skip to content

[ET-VK] Support exporting graphs with symbolic shape ops + update view to accept sym_size args #10997

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

Merged
merged 2 commits into from
May 20, 2025

Conversation

pytorchbot
Copy link
Collaborator

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

…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
@pytorchbot pytorchbot requested a review from SS-JIA as a code owner May 20, 2025 16:11
Copy link

pytorch-bot bot commented May 20, 2025

🔗 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 Failures

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

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 20, 2025
@Gasoonjia
Copy link
Contributor

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label May 20, 2025
@SS-JIA SS-JIA merged commit 0c8cfa9 into main May 20, 2025
88 of 89 checks passed
@SS-JIA SS-JIA deleted the gh/SS-JIA/228/orig branch May 20, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants