Skip to content

[ET-VK][ez] Fix handling of assert ops #11349

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 5 commits into from
Jun 4, 2025
Merged

[ET-VK][ez] Fix handling of assert ops #11349

merged 5 commits into from
Jun 4, 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: #11258 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/234/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/234/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/233/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/234/orig
@diff-train-skip-merge

SS-JIA added 3 commits June 3, 2025 12:24
Pull Request resolved: #11256

## Changes

* Implement resize functions for several operators used in Transformers models

## Motivation

Be able to support batched prefill for llama models.
ghstack-source-id: 287935585
@exported-using-ghexport

Differential Revision: [D75686049](https://our.internmc.facebook.com/intern/diff/D75686049/)
Pull Request resolved: #11257

## Changes

* Add an implementation for operator.add which add symbolic integers.

## Motivation

Support executing llama models with dynamic shapes. This operator shows up when exporting with dynamic shapes.
ghstack-source-id: 287945686
@exported-using-ghexport

Differential Revision: [D75238029](https://our.internmc.facebook.com/intern/diff/D75238029/)
Pull Request resolved: #11258

## Changes

* Apply `RemoveAssertsTransform` as part of `vulkan_preprocess`
* Do not call `RemoveAssertsTransform` before lowering the graph
* Register ops related to asserts to the operator registry as ephemeral ops

## Motivation

assert ops are not implemented in Vulkan, so previously `RemoveAssertsTransform()` is called on the graph before the lowering process.

However, it turns out that the assertion ops are required to properly handle dynamic shapes, because they place constraints on the possible range of symbolic integers. If they are not present, then re-tracing the graph during a recompile (which may occur during a graph transform pass) may fail.

Therefore, instead of calling the transform before lowering, call it inside vulkan_preprocess after a point where subsequent passes will not attempt to trace the graph.
ghstack-source-id: 287945687
@exported-using-ghexport

Differential Revision: [D75686048](https://our.internmc.facebook.com/intern/diff/D75686048/)
Copy link

pytorch-bot bot commented Jun 4, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 33 Pending

As of commit c907163 with merge base c7896df (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 Jun 4, 2025
Base automatically changed from gh/SS-JIA/233/orig to main June 4, 2025 00:42
Copy link

github-actions bot commented Jun 4, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

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

@SS-JIA SS-JIA merged commit 401016d into main Jun 4, 2025
100 of 101 checks passed
@SS-JIA SS-JIA deleted the gh/SS-JIA/234/orig branch June 4, 2025 01:07
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants