Skip to content

[ET-VK][ez] Improve insert_prepack_node pass to handle multiple uses of constant tensors #10488

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 1 commit into from
Apr 25, 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: #10426 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/219/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/219/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/219/orig
@diff-train-skip-merge

…of constant tensors

## Context

Refer to #6352 for why the `insert_prepack_nodes` pass is needed.

The current logic of the pass assumes that each constant tensor node has only one use. However, in reality, a constant tensor node may have multiple uses; some of which may require the insertion of a prepacking node and some which may not (since they may choose to apply some special packing in the operator implementation).

Currently, if any uses of a constant tensor node handles its own prepacking, then prepacking nodes will not be inserted. This makes it so that a model will produce a type error during runtime when an operator receives a `TensorRef` but expects a `Tensor`.

## Changes

Improve the logic of the pass to handle constant tensor nodes which have multiple uses. If any use does not handle its own prepacking, then a prepacking node will be inserted for those usages.

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

ghstack-source-id: 280054012
Pull Request resolved: #10426
@pytorchbot pytorchbot requested a review from SS-JIA as a code owner April 25, 2025 18:54
Copy link

pytorch-bot bot commented Apr 25, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 75 Pending

As of commit 5b22cc9 with merge base dfd3dbe (image):

NEW FAILURE - The following job has failed:

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 Apr 25, 2025
Copy link

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.

@SS-JIA SS-JIA merged commit e7fb2bd into main Apr 25, 2025
81 of 84 checks passed
@SS-JIA SS-JIA deleted the gh/SS-JIA/219/orig branch April 25, 2025 19:09
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