Skip to content

[ET-VK] Implement prepack nodes #6352

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

Closed
wants to merge 5 commits into from
Closed

Conversation

SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Oct 18, 2024

Stack from ghstack (oldest at bottom):

Context

This diff implements the idea described in the previous diff in this stack. During export, et_vk.prepack nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

Differential Revision: D64603666

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Oct 18, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 480d5a8 with merge base 7493aae (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 Oct 18, 2024
SS-JIA added a commit that referenced this pull request Oct 18, 2024
## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

ghstack-source-id: 248785585
Pull Request resolved: #6352
@facebook-github-bot
Copy link
Contributor

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

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Oct 18, 2024
Pull Request resolved: #6352

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

Differential Revision: [D64603666](https://our.internmc.facebook.com/intern/diff/D64603666/)
ghstack-source-id: 248799488
@facebook-github-bot
Copy link
Contributor

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

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

SS-JIA added a commit that referenced this pull request Oct 18, 2024
Pull Request resolved: #6352

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.
ghstack-source-id: 248824926

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

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

SS-JIA added a commit that referenced this pull request Oct 18, 2024
Pull Request resolved: #6352

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.
ghstack-source-id: 248830017

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

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

SS-JIA added a commit that referenced this pull request Oct 18, 2024
Pull Request resolved: #6352

## Context

This diff implements the idea described in the previous diff in this stack. During export, `et_vk.prepack` nodes will be inserted to convert constant tensors to GPU tensor objects. This makes it so that Vulkan operators will not have to account for the possibility that their arguments can potentially be constant tensor data instead of an actual tensor object.
ghstack-source-id: 248867364

Differential Revision: [D64603666](https://our.internmc.facebook.com/intern/diff/D64603666/)
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 339bb74.

@SS-JIA SS-JIA deleted the gh/SS-JIA/118/head branch January 24, 2025 19:45
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-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
SS-JIA pushed a commit that referenced this pull request Apr 25, 2025
…of constant tensors (#10488)

## 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/)
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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants