Skip to content

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

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

SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Apr 24, 2025

Stack from ghstack (oldest at bottom):

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

…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-poisoned]
SS-JIA added a commit that referenced this pull request Apr 24, 2025
…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
Copy link

pytorch-bot bot commented Apr 24, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 73c5660 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 24, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73592619

@SS-JIA SS-JIA added the release notes: vulkan Changes to the Vulkan backend delegate label Apr 24, 2025
@facebook-github-bot facebook-github-bot merged commit 469c6f4 into gh/SS-JIA/219/base Apr 25, 2025
84 of 89 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/SS-JIA/219/head branch April 25, 2025 18:54
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. fb-exported release notes: vulkan Changes to the Vulkan backend delegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants