Skip to content

[ET-VK] Introduce DynamicDispatchNode #11000

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
Merged

[ET-VK] Introduce DynamicDispatchNode #11000

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: #10979 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/227/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/227/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/226/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/227/orig
@diff-train-skip-merge

SS-JIA added 2 commits May 20, 2025 07:26
Pull Request resolved: #10978

## Context

Add a test where `encode_execute()` is called again after resizing model inputs and propagating the new sizes.

Currently, dynamic shapes are handled by simply updating the tensor metadata when sizes are updated. Compute shaders will perform the same computations with the updated tensor sizes/strides information.

However, for some operators, different input sizes require different compute shaders in order to achieve maximum performance. One example of this is for matrix multiplication, where matrix-matrix multiplication typically uses a different algorithm than vector-matrix (or matrix-vector) multiplication.

Therefore, for some models, it would be best to trigger a re-encoding of the command buffer upon input resize, so that different compute shaders can be selected based on the current input sizes.

The actual changes for enabling shader re-selection will be introduced in the next diff. This diff simply checks that command buffer re-encoding "works as advertised".

## Changes

This diff simply adds a test in `vulkan_compute_api_test` to test whether the ComputeGraph API can handle the `encode_execute` function  being called multiple times.
ghstack-source-id: 285093287
@exported-using-ghexport

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

## Context

The `DynamicDispatchNode` class in introduced in this diff to allow for shader re-selection upon input resize. See the previous diff in the stack for more context on why this functionality is needed.
ghstack-source-id: 285093290
@exported-using-ghexport

Differential Revision: [D75013780](https://our.internmc.facebook.com/intern/diff/D75013780/)
@pytorchbot pytorchbot requested a review from SS-JIA as a code owner May 20, 2025 16:30
Copy link

pytorch-bot bot commented May 20, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 38c44cc with merge base 7d194cf (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 May 20, 2025
Base automatically changed from gh/SS-JIA/226/orig to main May 20, 2025 18:18
@SS-JIA SS-JIA merged commit d50f26f into main May 20, 2025
86 of 87 checks passed
@SS-JIA SS-JIA deleted the gh/SS-JIA/227/orig branch May 20, 2025 18:19
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